move theme types to Styling

This commit is contained in:
Benjamin Palko 2025-09-25 13:54:02 -04:00
parent 823dd66719
commit fe8261f7af
3 changed files with 51 additions and 62 deletions

View file

@ -1,35 +1,28 @@
pragma Singleton
pragma ComponentBehavior: Bound
import "theme"
import QtQuick
import Qt.labs.folderlistmodel 2.9
import Quickshell
import Quickshell.Io
Singleton {
id: root
property var palette: theme
property alias themes: cache.themes
property alias currentTheme: cache.current
property int currentThemeIndex: themes.indexOf(currentTheme)
Process {
running: true
command: ["bash", "-c", `inotifywait -m -r ~/.config/lux/themes/ -e modify,move,create,delete | while read dir action; do ls -m "$dir"; done`]
stderr: StdioCollector {
onStreamFinished: console.log(`line read: ${this.text}`)
}
stdout: SplitParser {
splitMarker: "\n"
onRead: data => {
const themes = data.split(", ").filter(item => item.endsWith(".json")).map(item => item.replace(".json", ""));
if (themes.length == 0) {
return;
}
root.themes = themes;
FolderListModel {
id: model
nameFilters: ["*.json"]
folder: `${Paths.config}/themes/`
showDirs: false
onCountChanged: {
const arr = [];
for (let i = 0; i < count; i++) {
arr.push(get(i, "fileName").replace(".json", ""));
}
root.themes = arr;
}
}
@ -54,17 +47,4 @@ Singleton {
}
}
}
FileView {
path: `${Paths.config}/themes/${root.currentTheme}.json`
watchChanges: true
onFileChanged: reload()
// when changes are made to properties in the adapter, save them
onAdapterUpdated: writeAdapter()
Theme {
id: theme
}
}
}