quickshell/modules/applets/ThemeSwitcher.qml
2026-09-11 01:32:58 +02:00

81 lines
2.4 KiB
QML

pragma ComponentBehavior: Bound
import Quickshell
import Quickshell.Io
import QtQuick
import QtQuick.Layouts
import Qt.labs.folderlistmodel 2.11
import qs
import qs.settings
import qs.widgets
import qs.modules.Services
Rectangle {
id: child
implicitWidth: 800
implicitHeight: 600
color: Colors.c.base01
radius: Config.cfg.appearance.rounding
MouseArea {
acceptedButtons: Qt.AllButtons
anchors.fill: parent
}
FolderListModel {
id: schemeModel
folder: Qt.resolvedUrl(Quickshell.shellDir + "/schemes/")
}
Rectangle {
anchors.fill: parent
anchors.centerIn: parent
anchors.margins: 10
radius: Config.cfg.appearance.rounding
color: Colors.c.base01
clip: true
RowLayout {
id: contentLayout
anchors.fill: parent
anchors.margins: 30
ListView {
id: schemeList
spacing: 5
Layout.fillHeight: true
model: schemeModel
implicitWidth: 300
delegate: Rectangle {
id: container
required property var modelData
color: Colors.c.base02
height: 30
radius: Config.cfg.appearance.rounding
implicitWidth: 300
StyledText {
id: schemeName
anchors.centerIn: parent
text: container.modelData.fileName
}
MouseArea {
id: schemeSetter
anchors.fill: container
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
onClicked: {
setTheme.themeName = modelData.fileName;
setTheme.running = true;
Config.cfg.appearance.currentTheme = modelData.fileName;
}
Process {
id: setTheme
property string themeName
command: ["tinty", "apply", themeName]
}
}
}
}
StyledText {
id: currentScheme
text: Config.cfg.appearance.currentTheme
}
}
}
}