mirror of
https://github.com/belsabbagh/dotfiles.git
synced 2026-04-11 09:36:46 +00:00
quickshell and hyprland additions
This commit is contained in:
54
.config/quickshell/nucleus-shell/services/Theme.qml
Normal file
54
.config/quickshell/nucleus-shell/services/Theme.qml
Normal file
@@ -0,0 +1,54 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.config
|
||||
pragma Singleton
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
property var map: ({
|
||||
})
|
||||
|
||||
function notifyMissingVariant(theme, variant) {
|
||||
Quickshell.execDetached(["notify-send", "Nucleus Shell", `Theme '${theme}' does not have a ${variant} variant.`, "--urgency=normal", "--expire-time=5000"]);
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 5000
|
||||
repeat: true
|
||||
running: true
|
||||
onTriggered: loadThemes.running = true
|
||||
}
|
||||
|
||||
Process {
|
||||
id: loadThemes
|
||||
|
||||
command: ["ls", Directories.shellConfig + "/colorschemes"]
|
||||
running: true
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
const map = {
|
||||
};
|
||||
text.split("\n").map((t) => {
|
||||
return t.trim();
|
||||
}).filter((t) => {
|
||||
return t.endsWith(".json");
|
||||
}).forEach((t) => {
|
||||
const name = t.replace(/\.json$/, "");
|
||||
const parts = name.split("-");
|
||||
const variant = parts.pop();
|
||||
const base = parts.join("-");
|
||||
if (!map[base])
|
||||
map[base] = {
|
||||
};
|
||||
|
||||
map[base][variant] = name;
|
||||
});
|
||||
root.map = map;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user