add primitive shit for theme switching

This commit is contained in:
lucy 2026-09-09 18:48:35 +02:00
commit 143889683b
6 changed files with 111 additions and 20 deletions

View file

@ -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<string> 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
}
}
}
}

View file

@ -42,6 +42,9 @@ Variants {
RowLayout {
anchors.centerIn: parent
Date {}
ColorPickerButton {
barScreen: root.modelData
}
}
RowLayout {
anchors.rightMargin: 10

View file

@ -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) }
}
}

View file

@ -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();
}
}

View file

@ -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()
}
}