Files
glassMxrph/quickshell/services/SystemService.qml
T
mxandClaude Opus 5.5 73de4b06a8 Give notch mode its own control layout and backgroundless islands
- The notch's cog edits a separate tile layout (notch.controls); normal
  mode keeps the Control Center's. Reset follows the Control Center again.
- Notch islands draw no bar behind their modules.
- The notch strip picker comes first in Settings → Notch, and an empty
  strip offers a shortcut to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 17:08:46 +01:00

88 lines
3.0 KiB
QML

pragma Singleton
import QtQuick
import Quickshell
import "../core"
Singleton {
id: root
property string helper: "helpers/system.py"
property var state: ({})
property string error: ""
readonly property bool busy: job.running
// A user action is in flight. Controls lock on this, not on busy: locking
// them for every background status poll flickered them every five seconds.
readonly property bool acting: (job.running && job.request.op === "action") || queued !== null
property var queued: null
readonly property var features: {
if (!ConfigService.ready)
return [];
if (ShellState.controlCenterOpen || ShellState.notchOpen)
return ((ShellState.notchOpen || ShellState.controlCenterTarget === "notch") && ConfigService.data.notch.controls.length ? ConfigService.data.notch.controls : ConfigService.data.controlCenter.modules).filter(m => m.enabled && ["brightness", "nightLight", "dnd", "profiles", "power"].includes(m.id)).map(m => m.id);
if (ShellState.dashboardOpen)
return ["power"];
if (!ShellState.settingsOpen)
return [];
if (ShellState.settingsPage === "displays")
return ["brightness", "nightLight"];
if (ShellState.settingsPage === "notifications")
return ["dnd"];
if (ShellState.settingsPage === "power")
return ["power", "profiles"];
return [];
}
readonly property bool observed: features.length > 0
onFeaturesChanged: if (observed)
refresh()
onObservedChanged: if (observed)
refresh()
function refresh() {
if (ConfigService.ready && !busy)
job.start({
op: "status",
features: features,
options: ConfigService.data.system
});
}
function action(kind, value, confirmed) {
if (acting || !ConfigService.ready)
return false;
error = "";
const request = {
op: "action",
action: kind,
value: value,
confirmed: confirmed === true,
options: ConfigService.data.system
};
// A status poll is running: run the action as soon as it finishes.
if (busy) {
queued = request;
return true;
}
return job.start(request);
}
ProviderJob {
id: job
helper: root.helper
onFinished: (request, result) => {
if (result.ok) {
root.state = Object.assign({}, root.state, result.state);
if (request.op === "action")
root.error = "";
} else
root.error = result.error || "System request failed";
if (root.queued) {
const next = root.queued;
root.queued = null;
job.start(next);
}
}
}
Timer {
interval: 5000
repeat: true
running: root.observed
onTriggered: root.refresh()
}
}