Settings → Notch switches it on. The bar becomes left and right islands with a notch at the top centre. Super+C, Super+X and a click on the notch open a three-column panel: dashboard pages on the left (Media, Performance, Calendar; the wheel switches them), the Control Center tiles and weather in the middle, and notifications on the right. The Performance card opens the full "Your computer" view. The launcher drops out of the notch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
88 lines
2.9 KiB
QML
88 lines
2.9 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 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()
|
|
}
|
|
}
|