Add glassMxrph shell sources
Initial commit of the Quickshell desktop suite: bar, dock, launcher, settings, Control Center, dashboard, OSD, lock screen, desktop widgets, plugin host with the vendored Noctalia/Omarchy compatibility layer, helpers, packaging, tests and phase documentation. Includes the optimization work so far: usage widgets and dashboard gauges no longer animate continuously, desktop widgets pause while covered, system controls stop flickering on background polls, dock app matching uses an indexed catalog, and workspace ghosts are created only for occupied slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
99e64a7713
433 files changed
+57792
No files matched your search
@@ -0,0 +1,146 @@
|
||||
pragma Singleton
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import "../services"
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
property color accent: "transparent"
|
||||
property color accentText: "transparent"
|
||||
property bool available: false
|
||||
property string error: ""
|
||||
property string version: ""
|
||||
property var schemes: []
|
||||
property int generation: 0
|
||||
property var pending: null
|
||||
readonly property bool busy: worker.running || pending !== null
|
||||
readonly property string palettePath: (Quickshell.env("XDG_STATE_HOME") || Quickshell.env("HOME") + "/.local/state") + "/glassMxrph/palette.json"
|
||||
readonly property string optionsKey: ConfigService.ready ? JSON.stringify([ConfigService.data.appearance.accentSource, ConfigService.data.matugen.executable, ConfigService.data.matugen.scheme, ConfigService.data.matugen.contrast]) : ""
|
||||
readonly property string sourcePath: WallpaperService.palettePath
|
||||
onOptionsKeyChanged: {
|
||||
generation++;
|
||||
pending = null;
|
||||
if (ConfigService.ready && ConfigService.data.appearance.accentSource === "matugen") {
|
||||
probe();
|
||||
if (sourcePath)
|
||||
regenerate();
|
||||
else
|
||||
WallpaperService.refresh();
|
||||
}
|
||||
}
|
||||
onSourcePathChanged: if (ConfigService.ready && ConfigService.data.matugen.regenerateOnWallpaperChange)
|
||||
regenerate()
|
||||
function probe() {
|
||||
if (ConfigService.ready)
|
||||
probeJob.start({
|
||||
action: "matugen-probe",
|
||||
executable: ConfigService.data.matugen.executable
|
||||
});
|
||||
}
|
||||
function regenerate() {
|
||||
if (!ConfigService.ready || ConfigService.data.appearance.accentSource !== "matugen")
|
||||
return false;
|
||||
if (!sourcePath) {
|
||||
error = "Select a wallpaper, then regenerate its palette.";
|
||||
return false;
|
||||
}
|
||||
generation++;
|
||||
pending = {
|
||||
action: "palette",
|
||||
generation: generation,
|
||||
path: sourcePath,
|
||||
executable: ConfigService.data.matugen.executable,
|
||||
scheme: ConfigService.data.matugen.scheme,
|
||||
contrast: ConfigService.data.matugen.contrast
|
||||
};
|
||||
debounce.restart();
|
||||
return true;
|
||||
}
|
||||
function launchPending() {
|
||||
if (!worker.running && pending) {
|
||||
const next = pending;
|
||||
pending = null;
|
||||
worker.start(next);
|
||||
}
|
||||
}
|
||||
Timer {
|
||||
id: debounce
|
||||
interval: 200
|
||||
onTriggered: root.launchPending()
|
||||
}
|
||||
ProviderJob {
|
||||
id: probeJob
|
||||
onFinished: (request, result) => {
|
||||
if (request.executable !== ConfigService.data.matugen.executable) {
|
||||
Qt.callLater(root.probe);
|
||||
return;
|
||||
}
|
||||
if (result.ok) {
|
||||
root.version = result.version;
|
||||
root.schemes = result.schemes;
|
||||
} else {
|
||||
root.version = "";
|
||||
root.schemes = [];
|
||||
root.error = result.error;
|
||||
}
|
||||
}
|
||||
}
|
||||
ProviderJob {
|
||||
id: worker
|
||||
onFinished: (request, result) => {
|
||||
if (request.generation === root.generation) {
|
||||
if (result.ok) {
|
||||
root.version = result.version;
|
||||
palette.setText(JSON.stringify(result.palette) + "\n");
|
||||
root.error = "";
|
||||
} else
|
||||
root.error = result.error;
|
||||
}
|
||||
Qt.callLater(root.launchPending);
|
||||
}
|
||||
}
|
||||
FileView {
|
||||
id: palette
|
||||
path: root.palettePath
|
||||
watchChanges: true
|
||||
atomicWrites: true
|
||||
printErrors: false
|
||||
onFileChanged: reload()
|
||||
onSaved: root.loadPalette()
|
||||
onLoaded: root.loadPalette()
|
||||
onSaveFailed: error => root.error = "Could not save generated palette (" + error + ")"
|
||||
}
|
||||
function loadPalette() {
|
||||
try {
|
||||
const data = JSON.parse(palette.text());
|
||||
if (!/^#[0-9a-fA-F]{6}$/.test(data.accent))
|
||||
throw Error("Invalid palette accent");
|
||||
if (data.accentText !== undefined && !/^#[0-9a-fA-F]{6}$/.test(data.accentText))
|
||||
throw Error("Invalid palette accent text");
|
||||
root.accent = data.accent;
|
||||
root.accentText = data.accentText || "transparent";
|
||||
root.available = true;
|
||||
root.error = "";
|
||||
} catch (error) {
|
||||
root.error = String(error);
|
||||
}
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
target: "theme"
|
||||
function regenerate(): bool {
|
||||
return root.regenerate();
|
||||
}
|
||||
function status(): string {
|
||||
return JSON.stringify({
|
||||
generation: root.generation,
|
||||
busy: root.busy,
|
||||
error: root.error,
|
||||
available: root.available,
|
||||
version: root.version,
|
||||
accent: root.accent.toString()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user