diff --git a/config/Paths.qml b/config/Paths.qml deleted file mode 100644 index 34116da..0000000 --- a/config/Paths.qml +++ /dev/null @@ -1,47 +0,0 @@ -pragma Singleton - -import Quickshell -import Qt.labs.platform - -Singleton { - id: root - - readonly property url home: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0] - readonly property url pictures: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0] - - readonly property url data: `${StandardPaths.standardLocations(StandardPaths.GenericDataLocation)[0]}/lux` - readonly property url state: `${StandardPaths.standardLocations(StandardPaths.GenericStateLocation)[0]}/lux` - readonly property url cache: `${StandardPaths.standardLocations(StandardPaths.GenericCacheLocation)[0]}/lux` - readonly property url config: `${StandardPaths.standardLocations(StandardPaths.GenericConfigLocation)[0]}/lux` - - readonly property url imagecache: `${cache}/imagecache` - - function stringify(path: url): string { - let str = path.toString(); - if (str.startsWith("root:/")) - str = `file://${Quickshell.shellDir}/${str.slice(6)}`; - else if (str.startsWith("/")) - str = `file://${str}`; - return new URL(str).pathname; - } - - function expandTilde(path: string): string { - return strip(path.replace("~", stringify(root.home))); - } - - function shortenHome(path: string): string { - return path.replace(strip(root.home), "~"); - } - - function strip(path: url): string { - return stringify(path).replace("file://", ""); - } - - function mkdir(path: url): void { - Quickshell.execDetached(["mkdir", "-p", strip(path)]); - } - - function copy(from: url, to: url): void { - Quickshell.execDetached(["cp", strip(from), strip(to)]); - } -} diff --git a/config/Theme.qml b/config/Theme.qml index afc58e4..91fbf0b 100644 --- a/config/Theme.qml +++ b/config/Theme.qml @@ -1,9 +1,7 @@ pragma Singleton -pragma ComponentBehavior: Bound import QtQuick import Quickshell -import Quickshell.Io Singleton { id: root @@ -12,68 +10,30 @@ Singleton { source: "../assets/lucide.woff" } property string fontFamily: "JetBrainsMono Nerd Font" - property var palette: theme.palette + property Palette palette: Palette {} - property list themes: [] - onThemesChanged: { - if (!themes.includes(currentTheme)) { - currentTheme = "dark"; - } - } - property string currentTheme: "dark" + component Palette: QtObject { + id: palette - Process { - running: true - command: ["bash", "-c", `inotifywait -m -r ~/.config/lux -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; - } - } - } - - FileView { - id: jsonFile - path: `${Paths.config}/themes/${root.currentTheme}.json` - watchChanges: true - onFileChanged: reload() - - // when changes are made to properties in the adapter, save them - onAdapterUpdated: writeAdapter() - - JsonAdapter { - id: theme - - property JsonObject palette: JsonObject { - property color primary: "#605dff" - property color primarycontent: "#edf1fe" - property color secondary: "#f43098" - property color secondarycontent: "#f9e4f0" - property color accent: "#00d3bb" - property color accentcontent: "#084d49" - property color neutral: "#09090b" - property color neutralcontent: "#e4e4e7" - property color base100: "#1d232a" - property color base200: "#191e24" - property color base300: "#15191e" - property color basecontent: "#ecf9ff" - property color info: "#00bafe" - property color infocontent: "#042e49" - property color success: "#00d390" - property color successcontent: "#004c39" - property color warning: "#fcb700" - property color warningcontent: "#793205" - property color error: "#ff627d" - property color errorcontent: "#4d0218" - } - } + property color primary: "#1fb854" + property color primarycontent: "#000000" + property color secondary: "#1eb88e" + property color secondarycontent: "#000c07" + property color accent: "#1fb8ab" + property color accentcontent: "#010c0b" + property color neutral: "#19362d" + property color neutralcontent: "#cdd3d1" + property color base100: "#1b1717" + property color base200: "#161212" + property color base300: "#110d0d" + property color basecontent: "#cac9c9" + property color info: "#00b5ff" + property color infocontent: "#000000" + property color success: "#00a96e" + property color successcontent: "#000000" + property color warning: "#ffbe00" + property color warningcontent: "#000000" + property color error: "#ff5861" + property color errorcontent: "#000000" } }