90 lines
2.7 KiB
QML
90 lines
2.7 KiB
QML
import Quickshell
|
|
import Quickshell.Io
|
|
import Quickshell.Wayland
|
|
import Quickshell.Widgets
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
|
|
import qs
|
|
import qs.settings
|
|
import qs.widgets
|
|
|
|
FloatingWindow {
|
|
id: child
|
|
implicitWidth: 800
|
|
implicitHeight: 600
|
|
visible: Config.cfg.themeSwitcherVisible
|
|
color: Colors.base00
|
|
title: "qs-themepicker"
|
|
onClosed: Config.cfg.themeSwitcherVisible = false
|
|
Process {
|
|
id: getSchemes
|
|
property list<string> schemes
|
|
running: true
|
|
command: ["tinty", "list"]
|
|
stdout: SplitParser {
|
|
onRead: text => {
|
|
getSchemes.schemes.push(text);
|
|
}
|
|
}
|
|
}
|
|
Rectangle {
|
|
anchors.fill: child.contentItem
|
|
anchors.centerIn: child.contentItem
|
|
anchors.margins: 10
|
|
radius: Config.cfg.appearance.rounding / 1.5
|
|
color: Colors.base01
|
|
clip: true
|
|
RowLayout {
|
|
id: contentLayout
|
|
anchors.fill: parent
|
|
ListView {
|
|
id: schemeList
|
|
spacing: 5
|
|
Layout.fillHeight: true
|
|
model: getSchemes.schemes
|
|
implicitWidth: 300
|
|
delegate: Rectangle {
|
|
id: container
|
|
required property string modelData
|
|
color: Colors.base02
|
|
height: 30
|
|
radius: Config.cfg.appearance.rounding
|
|
implicitWidth: 300
|
|
StyledText {
|
|
id: schemeName
|
|
anchors.centerIn: parent
|
|
text: container.modelData
|
|
}
|
|
MouseArea {
|
|
id: schemeSetter
|
|
anchors.fill: container
|
|
acceptedButtons: Qt.LeftButton
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: {
|
|
setTheme.themeName = modelData;
|
|
setTheme.running = true;
|
|
}
|
|
Process {
|
|
id: setTheme
|
|
property string themeName
|
|
command: ["tinty", "apply", themeName]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
StyledText {
|
|
id: currentScheme
|
|
text: ""
|
|
Process {
|
|
id: getCurrentScheme
|
|
command: ["tinty", "current"]
|
|
running: true
|
|
stdout: StdioCollector {
|
|
onStreamFinished: currentScheme.text = text
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|