Files
mxandClaude Opus 5.5 bc197339fa Add bar spots beside the notch, and Caffeine and Night Light modules
Notch mode gets two more module lists, notch.innerLeft and
notch.innerRight: spots right beside the notch at the same distance on
both sides. They follow the notch's edges as it springs wider for media,
never draw pills (plugins and the tray drop theirs there), and fade out
while the notch is open or widened. Picking a module for one of the four
side spots in Settings -> Notch moves it there from the others.

Caffeine and Night Light are now bar modules too; Night Light polls its
state every 30 s while only the bar watches it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 23:27:01 +01:00

95 lines
3.3 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
// Bar modules showing Night Light; while only they watch, it polls slowly.
property int nightLightWatchers: 0
readonly property var features: {
const own = panelFeatures;
return nightLightWatchers > 0 && !own.includes("nightLight") ? own.concat(["nightLight"]) : own;
}
readonly property bool panelObserved: panelFeatures.length > 0
readonly property var panelFeatures: {
if (!ConfigService.ready)
return [];
if (ShellState.controlCenterOpen || ShellState.notchOpen)
return (ShellState.notchOpen && 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: root.panelObserved ? 5000 : 30000
repeat: true
running: root.observed
onTriggered: root.refresh()
}
}