From 143889683b73c604c4104229cb74a638349be8c2 Mon Sep 17 00:00:00 2001 From: lucy Date: Wed, 9 Sep 2026 18:48:35 +0200 Subject: [PATCH] add primitive shit for theme switching --- Colors.js | 32 ++++++++++----------- modules/applets/ThemeSwitcher.qml | 48 +++++++++++++++++++++++++++++++ modules/bar/Bar.qml | 3 ++ modules/bar/ColorPickerButton.qml | 21 ++++++++++++++ modules/ipc/Ipc.qml | 12 ++++++-- modules/overlays/Top.qml | 15 +++++++++- 6 files changed, 111 insertions(+), 20 deletions(-) create mode 100644 modules/applets/ThemeSwitcher.qml create mode 100644 modules/bar/ColorPickerButton.qml diff --git a/Colors.js b/Colors.js index 4f4d276..944fd03 100644 --- a/Colors.js +++ b/Colors.js @@ -1,18 +1,18 @@ const colors = { - base00: "#161616", - base01: "#262626", - base02: "#393939", - base03: "#525252", - base04: "#dde1e6", - base05: "#f2f4f8", - base06: "#ffffff", - base07: "#08bdba", - base08: "#ee5396", - base09: "#ff7eb6", - base0A: "#ff6f00", - base0B: "#42be65", - base0C: "#3ddbd9", - base0D: "#33b1ff", - base0E: "#be95ff", - base0F: "#82cfff", + base00: "#1f2430", + base01: "#242936", + base02: "#323844", + base03: "#4a5059", + base04: "#707a8c", + base05: "#cccac2", + base06: "#d9d7ce", + base07: "#f3f4f5", + base08: "#f28779", + base09: "#ffad66", + base0A: "#ffd173", + base0B: "#d5ff80", + base0C: "#95e6cb", + base0D: "#73d0ff", + base0E: "#d4bfff", + base0F: "#f27983", } diff --git a/modules/applets/ThemeSwitcher.qml b/modules/applets/ThemeSwitcher.qml new file mode 100644 index 0000000..886a864 --- /dev/null +++ b/modules/applets/ThemeSwitcher.qml @@ -0,0 +1,48 @@ +import Quickshell +import Quickshell.Io +import Quickshell.Wayland +import Quickshell.Widgets +import QtQuick +import QtQuick.Layouts + +import qs +import qs.settings +import qs.widgets + +Rectangle { + id: root + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.AllButtons + } + clip: true + color: Colors.base00 + Process { + id: getSchemes + property list schemes + running: true + command: ["tinty", "list"] + stdout: SplitParser { + onRead: text => { + getSchemes.schemes.push(text); + } + } + } + ListView { + id: schemeList + orientation: ListView.Horizontal + anchors.fill: root + model: getSchemes.schemes + delegate: Rectangle { + id: container + required property string modelData + color: Colors.base01 + height: 30 + implicitWidth: schemeName.width + 16 + StyledText { + id: schemeName + text: container.modelData + } + } + } +} diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index 6358be3..9c25c64 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -42,6 +42,9 @@ Variants { RowLayout { anchors.centerIn: parent Date {} + ColorPickerButton { + barScreen: root.modelData + } } RowLayout { anchors.rightMargin: 10 diff --git a/modules/bar/ColorPickerButton.qml b/modules/bar/ColorPickerButton.qml new file mode 100644 index 0000000..99a111a --- /dev/null +++ b/modules/bar/ColorPickerButton.qml @@ -0,0 +1,21 @@ +import qs +import qs.widgets +import QtQuick +import Quickshell +import qs.modules.Services + +BarComponent { + implicitWidth: text.width + required property ShellScreen barScreen + StyledText { + id: text + text: "temp!!!" + } + MouseArea { + id: clickHandler + acceptedButtons: Qt.LeftButton + cursorShape: Qt.PointingHandCursor + anchors.fill: parent + onClicked: { WidgetTracker.toggle("colorschemes", parent.barScreen) } + } +} diff --git a/modules/ipc/Ipc.qml b/modules/ipc/Ipc.qml index e79efff..fcfb127 100644 --- a/modules/ipc/Ipc.qml +++ b/modules/ipc/Ipc.qml @@ -1,12 +1,18 @@ import Quickshell import Quickshell.Io - - +import qs.modules.Services IpcHandler { id: handler target: "config" function reload() { - Quickshell.reload(true) + Quickshell.reload(true); + } + function openPicker() { + WidgetTracker.toggle("colorschemes", null) + console.log(WidgetTracker.current) + } + function closeWidgets() { + WidgetTracker.close(); } } diff --git a/modules/overlays/Top.qml b/modules/overlays/Top.qml index 56f29df..fa0dee0 100644 --- a/modules/overlays/Top.qml +++ b/modules/overlays/Top.qml @@ -114,11 +114,24 @@ Variants { } } } + ThemeSwitcher { + z: 1 + id: colorschemes + property bool shown: WidgetTracker.current === "colorschemes" && root.shown + visible: shown + focus: shown + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + anchors.topMargin: Config.cfg.bar.floating ? Config.cfg.bar.height + 20 : Config.cfg.bar.height + 10 + anchors.margins: 20 + implicitHeight: 60 + } MouseArea { id: dismisser z: 0 anchors.fill: parent - acceptedButtons: Qt.LeftButton + acceptedButtons: Qt.AllButtons onClicked: WidgetTracker.close() } }