Compare commits
No commits in common. "c53f0c2c41f1b1a5395b6d6f766b16fa610e3596" and "16e5059c7afff8c500c0fd3d44fd1329bc353fea" have entirely different histories.
c53f0c2c41
...
16e5059c7a
2 changed files with 23 additions and 110 deletions
|
|
@ -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)]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
pragma Singleton
|
pragma Singleton
|
||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
@ -12,68 +10,30 @@ Singleton {
|
||||||
source: "../assets/lucide.woff"
|
source: "../assets/lucide.woff"
|
||||||
}
|
}
|
||||||
property string fontFamily: "JetBrainsMono Nerd Font"
|
property string fontFamily: "JetBrainsMono Nerd Font"
|
||||||
property var palette: theme.palette
|
property Palette palette: Palette {}
|
||||||
|
|
||||||
property list<string> themes: []
|
component Palette: QtObject {
|
||||||
onThemesChanged: {
|
id: palette
|
||||||
if (!themes.includes(currentTheme)) {
|
|
||||||
currentTheme = "dark";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
property string currentTheme: "dark"
|
|
||||||
|
|
||||||
Process {
|
property color primary: "#1fb854"
|
||||||
running: true
|
property color primarycontent: "#000000"
|
||||||
command: ["bash", "-c", `inotifywait -m -r ~/.config/lux -e modify,move,create,delete | while read dir action; do ls -m "$dir"; done`]
|
property color secondary: "#1eb88e"
|
||||||
stderr: StdioCollector {
|
property color secondarycontent: "#000c07"
|
||||||
onStreamFinished: console.log(`line read: ${this.text}`)
|
property color accent: "#1fb8ab"
|
||||||
}
|
property color accentcontent: "#010c0b"
|
||||||
stdout: SplitParser {
|
property color neutral: "#19362d"
|
||||||
splitMarker: "\n"
|
property color neutralcontent: "#cdd3d1"
|
||||||
onRead: data => {
|
property color base100: "#1b1717"
|
||||||
const themes = data.split(", ").filter(item => item.endsWith(".json")).map(item => item.replace(".json", ""));
|
property color base200: "#161212"
|
||||||
if (themes.length == 0) {
|
property color base300: "#110d0d"
|
||||||
return;
|
property color basecontent: "#cac9c9"
|
||||||
}
|
property color info: "#00b5ff"
|
||||||
root.themes = themes;
|
property color infocontent: "#000000"
|
||||||
}
|
property color success: "#00a96e"
|
||||||
}
|
property color successcontent: "#000000"
|
||||||
}
|
property color warning: "#ffbe00"
|
||||||
|
property color warningcontent: "#000000"
|
||||||
FileView {
|
property color error: "#ff5861"
|
||||||
id: jsonFile
|
property color errorcontent: "#000000"
|
||||||
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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue