diff --git a/Colors.qml b/Colors.qml new file mode 100644 index 0000000..10a57b6 --- /dev/null +++ b/Colors.qml @@ -0,0 +1,22 @@ +pragma Singleton +import QtQuick +import Quickshell + +Singleton { + readonly property color base00: "#011840" + readonly property color base01: "#1e315a" + readonly property color base02: "#3c4b73" + readonly property color base03: "#5a648c" + readonly property color base04: "#777ea5" + readonly property color base05: "#9597be" + readonly property color base06: "#b3b0d7" + readonly property color base07: "#d0caf0" + readonly property color base08: "#2b5b89" + readonly property color base09: "#245382" + readonly property color base0A: "#204c78" + readonly property color base0B: "#396491" + readonly property color base0C: "#2a5780" + readonly property color base0D: "#325d87" + readonly property color base0E: "#19426b" + readonly property color base0F: "#0a315b" +} diff --git a/ThemeLoader.qml b/ThemeLoader.qml deleted file mode 100644 index cfc79a7..0000000 --- a/ThemeLoader.qml +++ /dev/null @@ -1,65 +0,0 @@ -pragma ComponentBehavior: Bound -pragma Singleton -import Quickshell -import Quickshell.Io - -Singleton { - id: root - property alias colors: loader - function reload() { - loader.reload(); - } - - FileView { - id: loader - watchChanges: true - onFileChanged: this.reload() - onAdapterUpdated: this.reload() - - // create color properties, initialize them to black and helper color array - property var colors: text().split('\n') - property var base00: "#000000" - property var base01: "#000000" - property var base02: "#000000" - property var base03: "#000000" - property var base04: "#000000" - property var base05: "#000000" - property var base06: "#000000" - property var base07: "#000000" - property var base08: "#000000" - property var base09: "#000000" - property var base0A: "#000000" - property var base0B: "#000000" - property var base0C: "#000000" - property var base0D: "#000000" - property var base0E: "#000000" - property var base0F: "#000000" - property bool ready: false - - path: "file:///home/lucy/.config/stylix/palette.json" - - onLoaded: { - // assign values to colors after the json file has been loaded to avoid errors - base00 = "#" + colors[1].split(':')[1].slice(2, 8); - base01 = "#" + colors[2].split(':')[1].slice(2, 8); - base02 = "#" + colors[3].split(':')[1].slice(2, 8); - base03 = "#" + colors[4].split(':')[1].slice(2, 8); - base04 = "#" + colors[5].split(':')[1].slice(2, 8); - base05 = "#" + colors[6].split(':')[1].slice(2, 8); - base06 = "#" + colors[7].split(':')[1].slice(2, 8); - base07 = "#" + colors[8].split(':')[1].slice(2, 8); - base08 = "#" + colors[9].split(':')[1].slice(2, 8); - base09 = "#" + colors[10].split(':')[1].slice(2, 8); - base0A = "#" + colors[11].split(':')[1].slice(2, 8); - base0B = "#" + colors[12].split(':')[1].slice(2, 8); - base0C = "#" + colors[13].split(':')[1].slice(2, 8); - base0D = "#" + colors[14].split(':')[1].slice(2, 8); - base0E = "#" + colors[15].split(':')[1].slice(2, 8); - base0F = "#" + colors[16].split(':')[1].slice(2, 8); - ready = true; - } - adapter: JsonAdapter { - id: themeAdapter - } - } -} diff --git a/modules/Bar/Bar.qml b/modules/Bar/Bar.qml index 6c8f94d..504bef9 100644 --- a/modules/Bar/Bar.qml +++ b/modules/Bar/Bar.qml @@ -27,7 +27,7 @@ Variants { id: bar radius: Settings.config.floating ? Settings.config.rounding * 2 : 0 anchors.fill: parent - color: ThemeLoader.colors.base00 + color: Colors.base00 RowLayout { id: left anchors.leftMargin: Settings.config.floating ? Settings.config.barHeight / 2 - 10: 10 diff --git a/modules/Bar/Clock.qml b/modules/Bar/Clock.qml index d950c44..2125b3f 100644 --- a/modules/Bar/Clock.qml +++ b/modules/Bar/Clock.qml @@ -6,7 +6,7 @@ import qs.widgets Rectangle { id: root - color: ThemeLoader.colors.base01 + color: Colors.base01 implicitWidth: clockText.implicitWidth + 14 implicitHeight: Settings.config.barHeight / 2 + 6 radius: Settings.config.rounding diff --git a/modules/Bar/MPris.qml b/modules/Bar/MPris.qml index 7dd3c84..f6f527a 100644 --- a/modules/Bar/MPris.qml +++ b/modules/Bar/MPris.qml @@ -8,7 +8,7 @@ import qs.widgets Rectangle { id: root - color: ThemeLoader.colors.base01 + color: Colors.base01 implicitWidth: songLayout.implicitWidth + 14 implicitHeight: Settings.config.barHeight / 2 + 6 radius: Settings.config.rounding @@ -17,12 +17,15 @@ Rectangle { function getSpotify() { for (var i = 0; i < Mpris.players.values.length; i++) { - if (Mpris.players.values[i].identity == "spotify" || "Spotify") { + if (Mpris.players.values[i].identity == "Spotify" || Mpris.players.values[i] == "spotify") { return Mpris.players.values[i]; + } else { + return null; } } return null; } + RowLayout { id: songLayout anchors.centerIn: parent diff --git a/modules/Bar/StatusIcons.qml b/modules/Bar/StatusIcons.qml index 9a5fa50..615f880 100644 --- a/modules/Bar/StatusIcons.qml +++ b/modules/Bar/StatusIcons.qml @@ -8,7 +8,7 @@ import qs.widgets Rectangle { id: root - color: ThemeLoader.colors.base01 + color: Colors.base01 implicitWidth: iconLayout.implicitWidth + 14 implicitHeight: Settings.config.barHeight / 2 + 6 radius: Settings.config.rounding diff --git a/modules/Bar/Title.qml b/modules/Bar/Title.qml index 246cf51..726602e 100644 --- a/modules/Bar/Title.qml +++ b/modules/Bar/Title.qml @@ -11,7 +11,7 @@ Rectangle { property var activeWindow: ToplevelManager.activeToplevel property bool active: activeWindow ? activeWindow.activated ? true : false : false radius: Settings.config.rounding - color: active ? ThemeLoader.colors.base01 : "transparent" + color: active ? Colors.base01 : "transparent" implicitHeight: Settings.config.barHeight / 2 + 6 implicitWidth: titleText.width + 14 RowLayout { diff --git a/modules/Bar/Tray.qml b/modules/Bar/Tray.qml index cfb78e4..acdc5d5 100644 --- a/modules/Bar/Tray.qml +++ b/modules/Bar/Tray.qml @@ -9,7 +9,7 @@ Rectangle { implicitWidth: trayRow.implicitWidth + 14 implicitHeight: trayRow.implicitHeight + 6 visible: trayRep.count > 0 - color: ThemeLoader.colors.base01 + color: Colors.base01 radius: Settings.config.rounding RowLayout { id: trayRow diff --git a/modules/Bar/Ws.qml b/modules/Bar/Ws.qml index 384a267..8935e30 100644 --- a/modules/Bar/Ws.qml +++ b/modules/Bar/Ws.qml @@ -10,7 +10,7 @@ import qs.widgets Rectangle { id: wsWrap required property ShellScreen barScreen - color: ThemeLoader.colors.base01 + color: Colors.base01 radius: Settings.config.rounding implicitWidth: wsLayout.implicitWidth + 6 implicitHeight: wsLayout.implicitHeight + 6 @@ -33,7 +33,7 @@ Rectangle { id: wsText anchors.centerIn: parent text: wsRect.modelData.id - color: ThemeLoader.colors.base07 + color: Colors.base07 opacity: parent.modelData.focused ? 1 : 0.5 } MouseArea { diff --git a/modules/widgets/wallpicker/WallPicker.qml b/modules/widgets/wallpicker/WallPicker.qml new file mode 100644 index 0000000..261e8cf --- /dev/null +++ b/modules/widgets/wallpicker/WallPicker.qml @@ -0,0 +1,81 @@ +pragma ComponentBehavior: Bound +import Quickshell +import Quickshell.Hyprland +import Quickshell.Io +import QtQuick +import Qt.labs.folderlistmodel 2.10 +import qs +import qs.settings + +FloatingWindow { + id: root + GlobalShortcut { + id: wallswitcherToggle + name: "showWallSwitcher" + onPressed: { + Settings.config.wallswitchershown = true; + } + } + Process { + id: matugenRunner + property string matugen: "matugen image " + Settings.config.currentWall + " --source-color-index=0" + running: false + command: [ "sh", "-c", matugen ] + } + implicitWidth: 700 + title: "qs-wallpicker" + implicitHeight: 600 + color: Colors.base00 + visible: Settings.config.wallswitchershown + onClosed: Settings.config.wallswitchershown = false + + Rectangle { + id: container + radius: Settings.config.rounding + anchors { + fill: parent + margins: 8 + } + color: Colors.base01 + FolderListModel { + id: wpModel + folder: "file:///home/lucy/.walls/" + nameFilters: ["*.png"] + } + Component { + id: wallDelegate + Rectangle { + id: wpPreview + required property var filePath + implicitWidth: 80 + implicitHeight: 60 + color: "transparent" + Image { + asynchronous: true + anchors.fill: parent + source: wpPreview.filePath ? wpPreview.filePath : null + } + MouseArea { + id: updater + acceptedButtons: Qt.LeftButton + cursorShape: Qt.PointingHandCursor + anchors.fill: parent + onClicked: { + Settings.config.currentWall = wpPreview.filePath; + matugenRunner.running = true + } + } + } + } + GridView { + id: wallLayout + anchors.centerIn: parent + anchors.margins: 20 + anchors.leftMargin: 40 + anchors.fill: parent + clip: true + model: wpModel + delegate: wallDelegate + } + } +} diff --git a/settings/Settings.qml b/settings/Settings.qml index 4c4af1d..9e086f0 100644 --- a/settings/Settings.qml +++ b/settings/Settings.qml @@ -1,3 +1,4 @@ +pragma ComponentBehavior: Bound pragma Singleton import Quickshell import Quickshell.Io @@ -7,9 +8,12 @@ Singleton { property alias config: settingsAdapter FileView { id: settingsView - path: "file:///home/lucy/.config/qs.json" - onFileChanged: reload() - watchChanges: true + path: "file:///home/lucy/.config/quickshell/settings/settings.json" + onFileChanged: reload() + onAdapterUpdated: writeAdapter() + + watchChanges: true + adapter: JsonAdapter { id: settingsAdapter property int barHeight @@ -18,7 +22,8 @@ Singleton { property string font property int fontSize property int margins - property var currentWall + property var currentWall + property bool wallswitchershown } } } diff --git a/settings/settings.json b/settings/settings.json new file mode 100644 index 0000000..5eab28d --- /dev/null +++ b/settings/settings.json @@ -0,0 +1,10 @@ +{ + "barHeight": 32, + "currentWall": "/home/lucy/.walls/mooon.png", + "floating": true, + "font": "Maple Mono NF", + "fontSize": 14, + "margins": 10, + "rounding": 15, + "wallswitchershown": false +} diff --git a/shell.qml b/shell.qml index 738778c..1bf4dc2 100644 --- a/shell.qml +++ b/shell.qml @@ -4,10 +4,12 @@ import QtQuick import qs.modules.Bar import qs.modules.ipc import qs.modules.wallpaper +import qs.modules.widgets.wallpicker ShellRoot { id: root Bar {} Ipc {} Wallpaper {} + WallPicker {} } diff --git a/widgets/CIcon.qml b/widgets/CIcon.qml index 534f895..7e031a1 100644 --- a/widgets/CIcon.qml +++ b/widgets/CIcon.qml @@ -4,12 +4,12 @@ import qs.settings Text { id: root - color: ThemeLoader.colors.base05 + color: Colors.base07 property real iconSize: 14 property real fill: 1 renderType: Text.NativeRendering font { - family: "Material Symbols Rounded" + family: "Material Symbols Sharp" pointSize: iconSize variableAxes: { "FILL": fill.toFixed(1), diff --git a/widgets/CText.qml b/widgets/CText.qml index 161b3c3..6697f38 100644 --- a/widgets/CText.qml +++ b/widgets/CText.qml @@ -5,5 +5,5 @@ import qs.settings Text { font.family: Settings.config.font font.pixelSize: Settings.config.fontSize - color: ThemeLoader.colors.base07 + color: Colors.base07 }