repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

refactor(nuguland): rework panels — real states over prototype scaffolding

2635bf2bed5121ef3fab525bbd72d036b667f9d8

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Replace prototype-era debug UI with real, useful states across the shell:
- Media: beautiful empty state; drop 'unknown artist/album' debug fallbacks
- Tray: render real SystemTray items (icon+title, click-to-activate) with
  an empty state, deleting the fake activate/secondary/scroll/menu grid and
  close-propagation debug strip
- Power: clean debug-style labels ('battery 95%' -> '95%', etc.)
- Remove ~50 dead 'readonly property' descriptors (self-documentation that
  referenced non-existent prototype .qml files; nothing read them)
- Add Util.js shared JSON helper; add Brightness widget
- Diagnostics/gesture machinery removal wiring across shell.qml/Bar.qml

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Changed files (27)

quickshell/nuguland/AGENTS.md

Modified
1 1 # Quickshell / Nuguland
3 -The justfile is the source of truth for working with Nuguland: `quickshell/nuguland/justfile`.
3 +The justfile is the source of truth for working with Nuguland: `./justfile`.
4 4 Agents must use it.
6 6 Public API only:
8 8 ```sh
9 -cd quickshell/nuguland
10 9 just lint
11 10 just fmt
12 11 just build
13 -just check
14 +Do not manually test by restarting/killing the parent niri session. Keep screenshots, pointer, keyboard, `wdotool`, and `wtype` proofs inside nested niri.
16 16 Zero-warning policy:
18 18 - `just lint` is the real gate: typecheck, lint, format-check, shader freshness, and Quickshell load.
19 -- `just check` is only an alias for `just lint`.
20 19 - `just lint` must emit no warnings.
21 -- Nuguland lint must pass Quickshell import paths and installed Quickshell `.qmltypes` to `qmllint`.
22 20 - Nuguland runtime never compiles shaders.
23 21 - Every future shader source must live under `shaders/*.frag`; `just build` must compile its checked-in `*.frag.qsb` blob.
24 22 - `just lint` must fail when any shader blob is missing, stale, or orphaned.
27 25 - Do not exclude files from lint/format/build/check without explicit human approval.
28 26 - Do not hide failures behind `|| true`, output filters, allowlists, or warning downgrades.
29 27 - If tooling fails on existing code, report the blocker and fix it; do not call the work clean.
29 +UI text rule:
31 +- All Nuguland UI labels are lowercase.
33 +Shader implementation rule:
35 +- Before implementing any shader, research prior art online first: Shadertoy, Qt/QML shader examples, compositor shader examples, demoscene snippets, or other relevant sources.
36 +- Adapt the chosen prior art to Nugu semantics, Nuguland performance budgets, and the shader lifecycle above.
37 +- Write shaders from scratch only as a last resort, after prior-art search fails or proves unsuitable.
38 +- Document source inspiration in the comments when a shader is added.

quickshell/nuguland/AuroraBackdrop.qml

Modified
7 7 id: root
9 9 required property var screen
10 + required property QtObject resourceService
10 11 property real targetX: 0.5
11 12 property real targetY: 0.5
12 13 property real smoothX: 0.5
13 14 property real smoothY: 0.5
14 15 property int activeTicks: 0
15 16 property bool auroraAvailable: false
17 + property bool lowPowerMode: false
18 + property real firestormMix: 0
20 + function targetFirestormMix() {
21 + return root.resourceService ? Number(root.resourceService.firestormTarget || 0) : 0;
22 + }
17 24 screen: root.screen
18 25 visible: true
46 53 id: auroraLoader
48 55 anchors.fill: parent
49 - active: root.auroraAvailable
56 + active: root.auroraAvailable && !root.lowPowerMode
51 58 sourceComponent: ShaderEffect {
52 59 property real iTime: 0
53 60 property vector2d iResolution: Qt.vector2d(width, height)
54 61 property vector2d iMouse: Qt.vector2d(root.smoothX, root.smoothY)
62 + property real iFirestormMix: root.firestormMix
56 64 blending: true
57 65 fragmentShader: Qt.resolvedUrl("shaders/aurora.frag.qsb")
66 74 onPositionChanged: (mouse) => {
67 75 root.targetX = mouse.x / Math.max(1, width);
68 76 root.targetY = mouse.y / Math.max(1, height);
69 - root.activeTicks = 45;
77 + root.activeTicks = root.lowPowerMode ? 0 : 45;
73 81 Timer {
74 82 interval: 67
75 - running: root.activeTicks > 0
83 + running: (root.activeTicks > 0 || Math.abs(root.firestormMix - root.targetFirestormMix()) > 0.001) && !root.lowPowerMode
76 84 repeat: true
77 85 onTriggered: {
78 - root.activeTicks -= 1;
86 + root.activeTicks = Math.max(0, root.activeTicks - 1);
79 87 if (auroraLoader.item)
80 88 auroraLoader.item.iTime += 0.04;
82 90 root.smoothX += (root.targetX - root.smoothX) * 0.035;
83 91 root.smoothY += (root.targetY - root.smoothY) * 0.035;
92 + root.firestormMix += (root.targetFirestormMix() - root.firestormMix) * 0.0035;

quickshell/nuguland/Bar.qml

Modified
17 17 required property QtObject clipboardService
18 18 required property QtObject launcherService
19 19 required property QtObject audioService
20 + required property QtObject brightnessService
20 21 required property QtObject networkService
21 22 required property QtObject bluetoothService
22 23 required property QtObject powerService
23 - required property QtObject screenshotsService
24 24 required property QtObject idleService
25 25 required property QtObject lockService
26 - required property QtObject diagnosticsService
27 26 required property QtObject surfaces
29 28 function itemRectInBar(item) {
51 50 root.surfaces.registerAnchor(name, `${Math.round(rect.x)},${Math.round(rect.y)},${Math.round(rect.width)},${Math.round(rect.height)}`);
54 - function registerRepeaterAnchors(repeater) {
55 - for (let i = 0; i < repeater.count; i++) {
56 - const item = repeater.itemAt(i);
57 - if (item)
58 - root.registerAnchor(item.popoutName, item);
60 - }
61 - }
63 53 function activatePopout(name) {
64 54 if (!root.surfaces)
65 55 return ;
125 115 BarChip {
126 116 popoutName: "launcher"
127 - label: "Launch"
117 + label: "launch"
128 118 preferredWidth: 68
131 121 BarChip {
132 122 popoutName: "media"
133 - label: "Media"
123 + label: "media"
134 124 preferredWidth: 60
141 131 spacing: 4
143 133 BarChip {
144 - popoutName: "cpu"
145 - label: root.resourceService ? `CPU ${Math.round(root.resourceService.cpuUsage * 100)}%` : "CPU --"
146 - preferredWidth: 72
147 - tone: root.resourceService ? root.resourceService.cpuSignal(root.resourceService.cpuUsage) : "normal"
134 + popoutName: "system"
135 + label: "system"
136 + preferredWidth: 96
150 139 BarChip {
151 140 popoutName: "clipboard"
152 - label: "Clip"
141 + label: "clip"
153 142 preferredWidth: 54
156 145 BarChip {
157 146 popoutName: "audio"
158 - label: "Audio"
159 - preferredWidth: 62
147 + label: root.audioService ? root.audioService.privacyLabel().toLowerCase() : "audio"
148 + preferredWidth: root.audioService && root.audioService.privacyLabel() === "Mic Cam" ? 80 : 62
151 + BarChip {
152 + popoutName: "brightness"
153 + label: "bright"
154 + preferredWidth: 66
162 157 BarChip {
163 158 popoutName: "connectivity"
164 - label: "Network"
159 + label: "network"
165 160 preferredWidth: 78
168 163 BarChip {
169 164 popoutName: "power"
170 - label: "Power"
165 + label: "power"
171 166 preferredWidth: 64
174 169 BarChip {
175 170 popoutName: "notifications"
176 - label: root.notificationService && Math.max(root.notificationService.attentionCount, root.notificationService.unreadCount) > 0 ? `Notify ${Math.max(root.notificationService.attentionCount, root.notificationService.unreadCount)}` : "Notify"
177 - preferredWidth: root.notificationService && Math.max(root.notificationService.attentionCount, root.notificationService.unreadCount) > 0 ? 78 : 66
178 - tone: root.notificationService && Math.max(root.notificationService.attentionCount, root.notificationService.unreadCount) > 0 ? "warning" : "normal"
171 + label: "notify"
172 + preferredWidth: 66
181 175 BarChip {
182 176 popoutName: "tray"
183 - label: root.trayService && root.trayService.attentionCount > 0 ? `Tray ${root.trayService.attentionCount}` : "Tray"
177 + label: root.trayService && root.trayService.attentionCount > 0 ? `tray ${root.trayService.attentionCount}` : "tray"
184 178 preferredWidth: root.trayService && root.trayService.attentionCount > 0 ? 66 : 54
185 - tone: root.trayService && root.trayService.attentionCount > 0 ? "warning" : "normal"
186 - }
188 - BarChip {
189 - popoutName: "screenshots"
190 - label: "Shot"
191 - preferredWidth: 54
194 181 BarChip {
195 182 popoutName: "idle"
196 - label: "Idle"
183 + label: "idle"
197 184 preferredWidth: 50
202 - Rectangle {
203 - id: windowButton
189 + Row {
190 + id: workspaceStrip
205 192 Layout.fillWidth: true
206 193 Layout.minimumWidth: 160
207 194 Layout.preferredHeight: 26
208 195 Layout.alignment: Qt.AlignVCenter
209 - radius: 9
210 - color: root.surfaces && root.theme && root.surfaces.popoutName === "window" ? root.theme.ui.focus : (root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.1) : "transparent")
211 - border.width: 0
212 - Component.onCompleted: Qt.callLater(() => {
213 - return root.registerAnchor("window", windowButton);
214 - })
215 - onXChanged: root.registerAnchor("window", windowButton)
216 - onYChanged: root.registerAnchor("window", windowButton)
217 - onWidthChanged: root.registerAnchor("window", windowButton)
218 - onHeightChanged: root.registerAnchor("window", windowButton)
196 + spacing: 4
197 + clip: true
220 - NuguText {
221 - id: windowText
199 + Repeater {
200 + model: root.niriService ? root.niriService.visibleWorkspaces : []
223 - anchors.left: parent.left
224 - anchors.right: parent.right
225 - anchors.leftMargin: 10
226 - anchors.rightMargin: 10
227 - anchors.verticalCenter: parent.verticalCenter
228 - theme: root.theme
229 - selected: root.surfaces && root.surfaces.popoutName === "window"
230 - text: root.niriService && root.niriService.focusedTitle.length > 0 ? root.niriService.focusedTitle.replace(/\\n/g, " ") : "No focused window"
231 - elide: Text.ElideMiddle
232 - }
202 + delegate: Rectangle {
203 + id: workspaceChip
234 - StateLayer {
235 - theme: root.theme
236 - checked: root.surfaces && root.surfaces.popoutName === "window"
237 - onEntered: {
238 - if (root.surfaces)
239 - root.surfaces.hoverRegisteredPopout("window");
205 + required property var modelData
206 + readonly property bool active: !!modelData.is_focused
207 + readonly property string workspaceLabel: `${modelData.idx || modelData.id || "?"}${modelData.name ? ` ${modelData.name}` : ""}`.toLowerCase()
209 + width: Math.max(34, workspaceText.implicitWidth + 18)
210 + height: 26
211 + radius: 9
212 + color: root.theme ? (active ? root.theme.ui.focus : root.theme.withAlpha(root.theme.ui.minor, 0.1)) : "transparent"
213 + border.width: 0
215 + NuguText {
216 + id: workspaceText
218 + anchors.centerIn: parent
219 + theme: root.theme
220 + variant: "meta"
221 + selected: workspaceChip.active
222 + text: workspaceChip.workspaceLabel
225 + MouseArea {
226 + anchors.fill: parent
227 + hoverEnabled: true
228 + cursorShape: Qt.PointingHandCursor
229 + onClicked: {
230 + if (root.niriService)
231 + root.niriService.focusWorkspace(workspaceChip.modelData.name || workspaceChip.modelData.idx || workspaceChip.modelData.id);
242 - onActivated: {
243 - if (root.surfaces)
244 - root.activatePopout("window");
246 - }
264 255 clipboardService: root.clipboardService
265 256 launcherService: root.launcherService
266 257 audioService: root.audioService
258 + brightnessService: root.brightnessService
267 259 networkService: root.networkService
268 260 bluetoothService: root.bluetoothService
269 261 powerService: root.powerService
270 - screenshotsService: root.screenshotsService
271 262 idleService: root.idleService
272 263 lockService: root.lockService
273 - diagnosticsService: root.diagnosticsService
274 264 barWindow: root
378 368 Behavior on y {
379 369 NumberAnimation {
380 - duration: 220
370 + duration: odometer.theme && odometer.theme.lowPowerMode ? 0 : 220
381 371 easing.type: Easing.OutCubic
478 468 Behavior on opacity {
479 469 NumberAnimation {
480 - duration: 120
470 + duration: layer.theme && layer.theme.lowPowerMode ? 0 : 120
481 471 easing.type: Easing.OutCubic
497 487 Behavior on opacity {
498 488 NumberAnimation {
499 - duration: 160
489 + duration: layer.theme && layer.theme.lowPowerMode ? 0 : 160
500 490 easing.type: Easing.OutCubic
510 500 target: layer
511 501 property: "rippleRadius"
512 502 to: layer.endRadius
513 - duration: 220
503 + duration: layer.theme && layer.theme.lowPowerMode ? 0 : 220
514 504 easing.type: Easing.OutCubic
522 512 required property string popoutName
523 513 required property string label
524 514 property int preferredWidth: Math.max(52, labelText.implicitWidth + 18)
525 - property string tone: "normal"
526 515 readonly property bool selected: root.surfaces && root.surfaces.popoutName === popoutName
527 - readonly property color toneColor: {
528 - if (!root.theme)
529 - return "transparent";
531 - if (tone === "warning")
532 - return root.theme.warning;
534 - if (tone === "error")
535 - return root.theme.error;
537 - if (tone === "info")
538 - return root.theme.info;
540 - return root.theme.ui.accent;
541 - }
543 517 Layout.preferredWidth: preferredWidth
544 518 Layout.preferredHeight: 26
545 519 Layout.alignment: Qt.AlignVCenter
546 520 radius: 9
547 521 color: selected && root.theme ? root.theme.ui.focus : (root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.1) : "transparent")
548 - border.width: tone === "normal" || selected ? 0 : 1
549 - border.color: toneColor
522 + clip: true
523 + border.width: 0
524 + border.color: "transparent"
550 525 Component.onCompleted: Qt.callLater(() => {
551 526 return root.registerAnchor(chip.popoutName, chip);
564 539 variant: "meta"
565 540 selected: chip.selected
566 541 text: chip.label
542 + font.bold: false
567 543 horizontalAlignment: Text.AlignHCenter
568 544 elide: Text.ElideRight
569 - color: chip.selected && root.theme ? root.theme.content.backdrop : (chip.tone === "normal" && root.theme ? root.theme.content.normal : chip.toneColor)
545 + color: root.theme ? (chip.selected ? root.theme.content.backdrop : root.theme.content.normal) : "transparent"
546 + z: 2
572 549 StateLayer {
573 550 theme: root.theme
574 551 checked: chip.selected
552 + z: 3
575 553 onEntered: {
576 554 if (root.surfaces)
577 555 root.surfaces.hoverRegisteredPopout(chip.popoutName);

quickshell/nuguland/Bluetooth.qml

Modified
5 5 Item {
6 6 id: root
8 - readonly property bool testHarness: Quickshell.env("NUGULAND_SMOKE") === "1"
9 - property bool testEnabled: true
10 - property bool testDiscovering: false
11 8 property string error: ""
12 9 property var lastAction: ({
14 - property var testDevices: [{
15 - "id": "headphones",
16 - "name": "Nugu Headphones",
17 - "type": "audio",
18 - "connected": true,
19 - "paired": true,
20 - "trusted": true,
21 - "blocked": false,
22 - "battery": 87
23 - }, {
24 - "id": "mouse",
25 - "name": "Nugu Mouse",
26 - "type": "pointer",
27 - "connected": true,
28 - "paired": true,
29 - "trusted": true,
30 - "blocked": false,
31 - "battery": 62
32 - }]
33 11 readonly property string nativeApi: "Quickshell.Bluetooth.Bluetooth.defaultAdapter BluetoothAdapter BluetoothDevice"
34 12 readonly property var boundedActions: ["scan", "toggle", "connect", "disconnect", "pair", "forget", "trust", "block"]
35 - readonly property bool nativeActionRoute: !testHarness
36 - readonly property var connectivityPanelMarkers: ({
37 - "combinedConnectivityPanel": true,
38 - "bluetoothToggleScanList": true,
39 - "sortedDeviceRows": true,
40 - "batteryBadges": true,
41 - "serviceActionsOnly": true,
42 - "source": "Nuguland bar popouts Network.qml plus Nuguland connections Network.qml Bluetooth.qml"
43 - })
13 + readonly property bool nativeActionRoute: true
45 14 function nativeAdapter() {
46 - if (testHarness)
47 - return null;
49 15 return Bluetooth.defaultAdapter;
101 67 function devicesList() {
102 - return sortedDevices(testHarness ? testDevices : nativeDevices());
68 + return sortedDevices(nativeDevices());
105 71 function devicesById() {
113 79 function enabled() {
114 80 const adapter = nativeAdapter();
115 - return testHarness ? testEnabled : !!(adapter && adapter.enabled);
81 + return !!(adapter && adapter.enabled);
118 84 function discovering() {
119 85 const adapter = nativeAdapter();
120 - return testHarness ? testDiscovering : !!(adapter && adapter.discovering);
86 + return !!(adapter && adapter.discovering);
123 89 function role() {
145 111 "usesNativeQuickshellBluetooth": true,
146 112 "nativeApi": nativeApi,
147 113 "nativeActionRoute": nativeActionRoute,
148 - "testHarness": testHarness,
149 114 "nativeAdapterAvailable": !!nativeAdapter(),
150 115 "nativeAdapterName": nativeAdapter() ? String(nativeAdapter().name) : "",
151 116 "helperProcesses": [],
153 118 "boundedActions": boundedActions,
154 119 "error": error,
155 120 "adapter": {
156 - "id": testHarness || !nativeAdapter() ? "nugu-bt0" : String(nativeAdapter().adapterId || ""),
121 + "id": !nativeAdapter() ? "" : String(nativeAdapter().adapterId || ""),
157 122 "state": enabled() ? "powered" : "disabled",
158 123 "discovering": discovering(),
159 - "discoverable": testHarness || !nativeAdapter() ? false : !!nativeAdapter().discoverable,
160 - "pairable": testHarness || !nativeAdapter() ? true : !!nativeAdapter().pairable
124 + "discoverable": !nativeAdapter() ? false : !!nativeAdapter().discoverable,
125 + "pairable": !nativeAdapter() ? false : !!nativeAdapter().pairable
162 127 "devices": devicesList().map((device) => {
163 128 return cloneDevice(device);
178 143 function scan() {
179 - if (testHarness) {
180 - testEnabled = true;
181 - testDiscovering = true;
182 - } else if (nativeAdapter()) {
183 - nativeAdapter().enabled = true;
184 - nativeAdapter().discovering = true;
144 + const adapter = nativeAdapter();
145 + const wasEnabled = enabled();
146 + if (adapter) {
147 + adapter.enabled = true;
148 + if (wasEnabled)
149 + adapter.discovering = true;
186 152 error = "";
187 153 lastAction = {
188 154 "kind": "scan",
155 + "poweredBeforeScan": wasEnabled,
189 156 "nativeActionRoute": nativeActionRoute
191 158 return stateJson();
194 161 function toggle(on) {
195 - if (testHarness) {
196 - testEnabled = !!on;
197 - testDiscovering = false;
198 - } else if (nativeAdapter()) {
162 + if (nativeAdapter()) {
199 163 nativeAdapter().enabled = !!on;
200 164 if (!on)
201 165 nativeAdapter().discovering = false;
213 177 function deviceAction(kind, id) {
214 178 const actionName = String(kind);
215 179 const deviceIdValue = String(id);
216 - if (testHarness) {
217 - const next = [];
218 - for (let i = 0; i < testDevices.length; i++) {
219 - const device = Object.assign({
220 - }, testDevices[i]);
221 - if (device.id === deviceIdValue) {
222 - if (actionName === "connect")
223 - device.connected = true;
225 - if (actionName === "disconnect")
226 - device.connected = false;
228 - if (actionName === "pair")
229 - device.paired = true;
231 - if (actionName === "trust")
232 - device.trusted = true;
234 - if (actionName === "block")
235 - device.blocked = true;
237 - }
238 - if (!(device.id === deviceIdValue && actionName === "forget"))
239 - next.push(device);
241 - }
242 - testDevices = next;
243 - } else {
244 181 const list = devicesList();
245 182 for (let i = 0; i < list.length; i++) {
246 183 if (deviceId(list[i]) !== deviceIdValue || !list[i].nativeObject)
266 203 device.blocked = true;
269 - }
206 + };
270 207 error = "";
271 208 lastAction = {
272 209 "kind": actionName,

quickshell/nuguland/Brightness.qml

Added
new file mode 100644
1 +import QtQuick
2 +import Quickshell
3 +import Quickshell.Io
5 +Item {
6 + id: root
8 + property QtObject osdService
9 + property string devicePath: "/sys/class/backlight/intel_backlight"
10 + property var lastAction: ({
11 + })
12 + property var lastOsd: ({
13 + })
14 + readonly property var boundedActions: ["increase", "decrease", "set-level"]
16 + function clamp01(value) {
17 + const n = Number(value);
18 + if (!isFinite(n))
19 + return 0;
21 + return Math.max(0, Math.min(1, n));
22 + }
24 + function intText(text, fallback) {
25 + const n = parseInt(String(text || "").trim(), 10);
26 + return isFinite(n) ? n : fallback;
27 + }
29 + function nativeMax() {
30 + return Math.max(1, intText(maxFile.text(), 1));
31 + }
33 + function nativeBrightness() {
34 + return Math.max(1, intText(brightnessFile.text(), nativeMax()));
35 + }
37 + function levelFraction() {
38 + return clamp01(nativeBrightness() / nativeMax());
39 + }
41 + function osd(value) {
42 + const text = String(Math.round(clamp01(value) * 100));
43 + if (!osdService)
44 + return {
45 + "event": "brightness",
46 + "value": text
47 + };
49 + try {
50 + return JSON.parse(osdService.trigger("brightness", text));
51 + } catch (error) {
52 + return {
53 + "event": "brightness",
54 + "value": text
55 + };
56 + }
57 + }
59 + function stateObject() {
60 + const level = Math.round(levelFraction() * 100) / 100;
61 + return {
62 + "backend": "Brightness.qml",
63 + "devicePath": devicePath,
64 + "helperProcesses": ["sh"],
65 + "serviceOwnedActions": true,
66 + "boundedActions": boundedActions,
67 + "level": level,
68 + "compact": {
69 + "label": "Bright",
70 + "role": level <= 0.15 ? "ui.minor" : level >= 0.85 ? "warning" : "ui.accent"
71 + },
72 + "shader": {
73 + "kind": "brightness-gradient",
74 + "clipped": true,
75 + "source": "shaders/brightness-gradient.frag.qsb",
76 + "priorArt": "GLSL luminance gradients and smoothstep bar masks plus Inigo Quilez-style rounded-box SDF alpha mask",
77 + "values": [level, 1 - level, level >= 0.85 ? 1 : 0, level <= 0.15 ? 1 : 0],
78 + "colors": ["ui.accent", "ui.focus", "warning", "ui.backdrop"]
79 + },
80 + "lastAction": lastAction,
81 + "lastOsd": lastOsd
82 + };
83 + }
85 + function stateJson() {
86 + return JSON.stringify(stateObject());
87 + }
89 + function applyNative(level) {
90 + const value = clamp01(level);
91 + Quickshell.execDetached(["sh", "-c", `d='${devicePath}'; m=$(cat "$d/max_brightness"); n=$(awk -v v=${value} -v m=$m 'BEGIN { x=int(v*m); if (x<1) x=1; if (x>m) x=m; print x }'); printf '%s\n' "$n" > "$d/brightness"`]);
92 + }
94 + function setLevel(level) {
95 + const value = clamp01(level);
96 + applyNative(value);
97 + lastAction = {
98 + "kind": "set-level",
99 + "level": Math.round(value * 100) / 100
100 + };
101 + lastOsd = osd(value);
102 + return stateJson();
105 + function increase() {
106 + return setLevel(levelFraction() + 0.05);
109 + function decrease() {
110 + return setLevel(levelFraction() - 0.05);
113 + FileView {
114 + id: brightnessFile
116 + path: `${root.devicePath}/brightness`
117 + blockLoading: true
118 + blockAllReads: true
119 + printErrors: false
122 + FileView {
123 + id: maxFile
125 + path: `${root.devicePath}/max_brightness`
126 + blockLoading: true
127 + blockAllReads: true
128 + printErrors: false

quickshell/nuguland/Clipboard.qml

Modified
1 1 import QtQuick
2 +import Quickshell
3 +import Quickshell.Io
3 5 Item {
4 6 id: root
6 8 property bool privateMode: false
7 - property var rows: [{
8 - "id": "clip-nugu",
9 - "title": "Nugu palette note",
10 - "body": "Nugu semantic colors for Nuguland",
11 - "pinned": false
12 - }, {
13 - "id": "clip-nuguland",
14 - "title": "Nuguland shell note",
15 - "body": "Nuguland niri Quickshell desktop shell",
16 - "pinned": false
17 - }, {
18 - "id": "clip-temp",
19 - "title": "Temporary scratch",
20 - "body": "delete action smoke row",
21 - "pinned": false
22 - }]
9 + property var rows: []
23 10 property var lastAction: ({
12 + property bool persistenceReady: false
13 + readonly property int maxRows: 40
14 + readonly property string historyPath: Quickshell.statePath("clipboard-history.json")
26 16 function normalize(text) {
27 17 return String(text || "").toLowerCase();
20 + function isReadableText(text) {
21 + const value = String(text || "");
22 + if (value.length === 0 || value.length > 65536)
23 + return false;
25 + let bad = 0;
26 + for (let i = 0; i < value.length; i++) {
27 + const code = value.charCodeAt(i);
28 + if ((code >= 0 && code < 9) || (code > 13 && code < 32) || code === 65533)
29 + bad++;
31 + }
32 + return bad <= Math.max(2, Math.floor(value.length / 100));
33 + }
30 35 function isTempImagePath(text) {
31 36 const value = String(text || "");
32 37 return value.indexOf("/tmp/") === 0 && /\.(png|jpg|jpeg|webp|gif)$/i.test(value);
40 + function hashText(text) {
41 + const value = String(text || "");
42 + let hash = 2.16614e+09;
43 + for (let i = 0; i < value.length; i++) {
44 + hash ^= value.charCodeAt(i);
45 + hash = Math.imul(hash, 1.67776e+07);
46 + }
47 + return (hash >>> 0).toString(16);
48 + }
50 + function firstLine(text) {
51 + return String(text || "").split(/\r?\n/)[0].trim();
52 + }
54 + function rowTitle(text) {
55 + if (isTempImagePath(text))
56 + return "Image";
58 + const line = firstLine(text);
59 + if (line.length === 0)
60 + return "Clipboard";
62 + return line.length > 64 ? `${line.slice(0, 61)}…` : line;
63 + }
35 65 function displayTitle(row) {
36 66 if (isTempImagePath(row.title) || isTempImagePath(row.body))
37 67 return "Image";
47 77 return raw;
80 + function persistedRow(row) {
81 + return {
82 + "id": String(row.id || ""),
83 + "title": String(row.title || "Clipboard"),
84 + "body": String(row.body || ""),
85 + "pinned": !!row.pinned,
86 + "createdAt": Number(row.createdAt || Date.now())
87 + };
88 + }
50 90 function cloneRow(row) {
51 91 return {
52 92 "id": row.id,
102 + function rawRowById(id) {
103 + const needle = String(id);
104 + for (let i = 0; i < rows.length; i++) if (rows[i].id === needle) {
105 + return rows[i];
107 + return null;
110 + function captureClipboard(text) {
111 + const body = String(text || "");
112 + if (privateMode || !isReadableText(body))
113 + return ;
115 + const id = `clip-${hashText(body)}`;
116 + const next = [];
117 + let existingPin = false;
118 + for (let i = 0; i < rows.length; i++) {
119 + if (rows[i].id === id) {
120 + existingPin = !!rows[i].pinned;
121 + continue;
123 + next.push(rows[i]);
125 + next.unshift({
126 + "id": id,
127 + "title": rowTitle(body),
128 + "body": body,
129 + "pinned": existingPin,
130 + "createdAt": Date.now()
131 + });
132 + rows = next.slice(0, maxRows);
133 + saveHistory();
62 136 function filteredRows(query) {
63 137 const q = normalize(query);
64 138 const result = [];
84 158 function clipboardPanelContract() {
85 159 return {
86 - "source": "Nuguland ClipWrapper.qml plus Nuguland Cliphist.qml ScrollEdgeFade.qml",
160 + "source": "wl-paste --watch service backend plus Nuguland ClipWrapper.qml ScrollEdgeFade.qml",
87 161 "ownedBy": "PopoutHost.qml inline ClipboardPanel",
88 162 "clipboardHistoryPanel": true,
89 163 "privateModeChip": true,
93 167 "launcherRowParity": true,
94 168 "serviceActionsOnly": true,
95 169 "actionRows": ["copy", "paste", "pin", "delete"],
170 + "realClipboardSource": "wl-paste --watch",
96 171 "noExternalClipboardHelpersInWidget": true
129 204 "launcherProvider": true,
130 205 "privateMode": privateMode,
131 206 "privateRole": privateMode ? "warning" : "ui.accent",
132 - "helperProcesses": [],
207 + "helperProcesses": ["wl-paste --watch", "wl-copy", "wtype"],
208 + "durablePersistence": true,
209 + "historyPath": historyPath,
210 + "persistenceReady": persistenceReady,
211 + "fakeRows": false,
133 212 "cleanupProof": true,
134 213 "lastAction": lastAction,
135 214 "clipboardPanelContract": clipboardPanelContract(),
172 251 next.push(row);
174 253 rows = next;
254 + saveHistory();
177 257 function togglePin(id) {
188 268 function copy(id) {
269 + const row = rawRowById(id);
270 + if (row)
271 + Quickshell.execDetached(["wl-copy", String(row.body || "")]);
189 273 lastAction = {
190 274 "kind": "copy",
191 - "id": String(id)
275 + "id": String(id),
276 + "accepted": !!row
193 278 return stateJson();
196 281 function paste(id) {
282 + const row = rawRowById(id);
283 + if (row)
284 + Quickshell.execDetached(["/usr/bin/wtype", "--", String(row.body || "")]);
197 286 lastAction = {
198 287 "kind": "paste",
199 - "id": String(id)
288 + "id": String(id),
289 + "accepted": !!row,
290 + "route": "clipboard-target-typing",
291 + "pasteInputRoute": "wtype"
201 293 return stateJson();
212 304 rows = next;
305 + saveHistory();
213 306 lastAction = {
214 307 "kind": "delete",
215 308 "id": target
217 310 return stateJson();
313 + function loadHistoryText(text) {
314 + try {
315 + const parsed = JSON.parse(String(text || "{}"));
316 + const loadedRows = Array.isArray(parsed.rows) ? parsed.rows : [];
317 + rows = loadedRows.map((row) => {
318 + return persistedRow(row);
319 + }).filter((row) => {
320 + return row.id.length > 0 && isReadableText(row.body);
321 + }).slice(0, maxRows);
322 + } catch (error) {
323 + rows = [];
325 + persistenceReady = true;
326 + saveHistory();
329 + function saveHistory() {
330 + if (!persistenceReady)
331 + return ;
333 + const payload = {
334 + "version": 1,
335 + "rows": rows.map((row) => {
336 + return persistedRow(row);
337 + }).slice(0, maxRows)
338 + };
339 + clipboardHistoryFile.setText(JSON.stringify(payload, null, 2));
220 342 function setPrivateMode(enabled) {
221 343 privateMode = enabled;
222 344 lastAction = {
226 348 return stateJson();
351 + FileView {
352 + id: clipboardHistoryFile
354 + path: root.historyPath
355 + blockWrites: true
356 + atomicWrites: true
357 + printErrors: false
358 + onLoaded: root.loadHistoryText(clipboardHistoryFile.text())
359 + onLoadFailed: {
360 + root.persistenceReady = true;
361 + root.saveHistory();
365 + Process {
366 + id: clipboardWatcher
368 + command: ["wl-paste", "--type", "text/plain", "--watch", "sh", "-c", "cat; printf '\\036'"]
369 + running: true
371 + stdout: SplitParser {
372 + splitMarker: "\u001e"
373 + onRead: (data) => {
374 + return root.captureClipboard(data);

quickshell/nuguland/Launcher.qml

Modified
1 1 import QtQuick
2 +import Quickshell
3 +import Quickshell.Io
3 5 Item {
4 6 id: root
6 8 property QtObject niriService
7 9 property QtObject clipboardService
8 10 property var wheelTrace: []
11 + property var launchRecords: []
9 12 property var lastInteraction: ({
11 14 readonly property var actions: [{
28 31 "title": "Pick color",
29 32 "subtitle": "Use native niri color picker",
30 33 "route": "service"
31 - }, {
32 - "id": "diagnostics",
33 - "title": "Diagnostics",
34 - "subtitle": "Open Nuguland diagnostics",
35 - "route": "service"
36 - }]
37 - readonly property var apps: [{
38 - "id": "firefox",
39 - "title": "Firefox",
40 - "subtitle": "Browser",
41 - "desktopId": "firefox.desktop"
42 - }, {
43 - "id": "terminal",
44 - "title": "Terminal",
45 - "subtitle": "Shell",
46 - "desktopId": "org.wezfurlong.wezterm.desktop"
47 - }, {
48 - "id": "files",
49 - "title": "Files",
50 - "subtitle": "File manager",
51 - "desktopId": "org.gnome.Nautilus.desktop"
35 + property var apps: []
36 + property bool appScanDone: false
37 + property string appScanError: ""
54 39 function normalize(text) {
55 40 return String(text || "").trim().toLowerCase();
200 185 return stateJson();
188 + function providerCounts() {
189 + return {
190 + "app": apps.length,
191 + "action": actions.length,
192 + "clipboard": clipboardProviderRows("").length,
193 + "window": niriService ? (niriService.windows || []).length : 0,
194 + "calculator": 1
195 + };
203 198 function stateJson() {
204 199 return JSON.stringify({
205 200 "backend": "Launcher.qml",
206 201 "wheelTrace": wheelTrace,
202 + "launchRecords": launchRecords,
207 203 "lastInteraction": lastInteraction,
208 204 "realWheelSelection": lastInteraction.kind === "wheel-select" && lastInteraction.before !== lastInteraction.after,
209 - "launcherPanelContract": launcherPanelContract()
205 + "launcherPanelContract": launcherPanelContract(),
206 + "appCount": apps.length,
207 + "appScanDone": appScanDone,
208 + "appScanError": appScanError,
209 + "desktopEntrySource": "xdg-data-dirs",
210 + "fakeApps": false,
211 + "providerCounts": providerCounts()
215 + function rememberActivation(record, executed) {
216 + const entry = {
217 + "kind": "activate",
218 + "record": record,
219 + "executed": !!executed
220 + };
221 + const rows = launchRecords.slice(Math.max(0, launchRecords.length - 19));
222 + rows.push(record);
223 + launchRecords = rows;
224 + lastInteraction = entry;
225 + return stateJson();
228 + function rowFromJson(rowJson) {
229 + if (typeof rowJson === "string") {
230 + try {
231 + return JSON.parse(rowJson);
232 + } catch (error) {
233 + return {
234 + "id": "invalid",
235 + "title": "Invalid launcher row",
236 + "provider": "error",
237 + "error": String(error)
238 + };
241 + return rowJson || ({
242 + });
245 + function sliceForRow(row) {
246 + if (row.provider === "app")
247 + return row.terminal ? "work.slice" : "app-graphical.slice";
249 + return "session-graphical.slice";
252 + function launchRecord(rowJson) {
253 + const row = rowFromJson(rowJson);
254 + const provider = String(row.provider || row.route || "item");
255 + const title = String(row.title || row.id || provider);
256 + const id = String(row.id || row.desktopId || title);
257 + const argv = provider === "calculator" ? ["wl-copy", String(row.value || row.title || "")] : (provider === "app" ? (row.execArgv || []) : (provider === "clipboard" ? ["wl-copy", String(row.body || row.title || "")] : (provider === "action" ? ["nuguland-action", id] : (provider === "window" ? ["niri", "msg", "action", "focus-window", "--id", String(row.windowId || row.id)] : []))));
258 + return JSON.stringify({
259 + "id": id,
260 + "label": title,
261 + "kind": provider === "app" ? "app" : provider,
262 + "provider": provider,
263 + "desktopId": row.desktopId || "",
264 + "desktopPath": row.desktopPath || "",
265 + "argv": argv,
266 + "workingDirectory": "",
267 + "environment": {
268 + },
269 + "slice": sliceForRow(row),
270 + "startupNotify": provider === "app",
271 + "windowMatching": {
272 + "desktopId": row.desktopId || "",
273 + "title": title,
274 + "appId": row.desktopId ? String(row.desktopId).replace(/\.desktop$/, "") : ""
275 + },
276 + "osdFeedback": `${provider}:${title}`,
277 + "route": row.route || provider,
278 + "terminal": !!row.terminal
279 + });
282 + function runAction(id) {
283 + const name = String(id);
284 + if (name === "overview" && niriService)
285 + niriService.action(["toggle-overview"]);
287 + if (name === "screenshot" && niriService)
288 + niriService.screenshot(Quickshell.env("XDG_RUNTIME_DIR") + "/nuguland-launcher-screenshot.png");
290 + if (name === "color" && niriService)
291 + niriService.pickColor();
293 + return name === "overview" || name === "screenshot" || name === "color";
296 + function activate(rowJson) {
297 + const row = rowFromJson(rowJson);
298 + const record = JSON.parse(launchRecord(row));
299 + if (record.kind === "calculator" || record.kind === "clipboard") {
300 + Quickshell.execDetached(record.argv);
301 + return rememberActivation(record, true);
303 + if (record.kind === "action")
304 + return rememberActivation(record, runAction(record.id));
306 + if (record.kind === "window" && niriService) {
307 + niriService.action(["focus-window", "--id", String(row.windowId || row.id)]);
308 + return rememberActivation(record, true);
310 + if (record.kind === "app" && record.argv.length > 0) {
311 + const selector = record.slice === "work.slice" ? "w" : "a";
312 + Quickshell.execDetached(["uwsm", "app", "-s", selector].concat(record.desktopPath ? [record.desktopPath] : record.argv));
313 + return rememberActivation(record, true);
315 + return rememberActivation(record, false);
318 + function activateFirst(query) {
319 + const result = JSON.parse(search(query));
320 + if (!result.results || result.results.length === 0) {
321 + lastInteraction = {
322 + "kind": "activate-empty",
323 + "query": String(query)
324 + };
325 + return stateJson();
327 + return activate(JSON.stringify(result.results[0]));
330 + function rowById(id) {
331 + const wanted = String(id);
332 + for (let i = 0; i < actions.length; i++) {
333 + if (actions[i].id === wanted)
334 + return shapeRow(actions[i], "action", 1500);
337 + for (let i = 0; i < apps.length; i++) {
338 + if (apps[i].id === wanted || apps[i].desktopId === wanted)
339 + return shapeRow(Object.assign({
340 + "route": "desktop-entry"
341 + }, apps[i]), "app", 1500);
344 + return null;
347 + function activateId(id) {
348 + const row = rowById(id);
349 + if (!row) {
350 + lastInteraction = {
351 + "kind": "activate-missing-id",
352 + "id": String(id)
353 + };
354 + return stateJson();
356 + return activate(JSON.stringify(row));
359 + function hotkey(id) {
360 + const name = String(id);
361 + let record = {
362 + "id": name,
363 + "label": name,
364 + "kind": "hotkey",
365 + "provider": "hotkey",
366 + "argv": ["nuguctl", "hotkey", name],
367 + "slice": "session-graphical.slice",
368 + "osdFeedback": name
369 + };
370 + if (name === "open-launcher")
371 + record.argv = ["qs", "ipc", "-c", "nuguland", "call", "nuguland", "openLauncher"];
373 + lastInteraction = {
374 + "kind": "hotkey",
375 + "record": record
376 + };
377 + return JSON.stringify(lastInteraction);
213 380 function launcherPanelContract() {
214 381 return {
215 382 "source": "Nuguland launcher Content.qml AppList.qml ActionItem.qml plus Nuguland SearchResults.qml ResultPreview plus Nuguland LaunchContent.qml",
503 + function desktopScanCode() {
504 + return `import json, os, re, shlex\n\ndef truth(value):\n return str(value or '').strip().lower() == 'true'\n\ndef clean_exec(value):\n return re.sub(r' ?%[fFuUdDnNickvm]', '', value or '').strip()\n\ndef parse_desktop(path):\n data = {}\n section = ''\n try:\n text = open(path, 'r', encoding='utf-8', errors='replace').read().splitlines()\n except OSError:\n return None\n for line in text:\n line = line.strip()\n if not line or line.startswith(('#', ';')):\n continue\n if line.startswith('[') and line.endswith(']'):\n section = line[1:-1]\n continue\n if section != 'Desktop Entry' or '=' not in line:\n continue\n key, value = line.split('=', 1)\n if '[' not in key and key not in data:\n data[key] = value\n if data.get('Type', 'Application') != 'Application':\n return None\n if truth(data.get('NoDisplay')) or truth(data.get('Hidden')):\n return None\n name = data.get('Name') or data.get('GenericName')\n if not name:\n return None\n base = os.path.basename(path)\n command = clean_exec(data.get('Exec', ''))\n try:\n argv = shlex.split(command)\n except ValueError:\n argv = []\n return {\n 'id': 'app:' + base,\n 'title': name,\n 'subtitle': data.get('Comment') or data.get('GenericName') or base,\n 'desktopId': base,\n 'desktopPath': path,\n 'exec': command,\n 'execArgv': argv,\n 'icon': data.get('Icon', ''),\n 'terminal': truth(data.get('Terminal')),\n 'route': 'desktop-entry'\n }\n\nroots = []\nhome = os.environ.get('XDG_DATA_HOME') or os.path.expanduser('~/.local/share')\nroots.append(home)\nroots.extend([p for p in os.environ.get('XDG_DATA_DIRS', '/usr/local/share:/usr/share').split(':') if p])\nseen = set()\napps = []\nfor root in roots:\n appdir = os.path.join(root, 'applications')\n if not os.path.isdir(appdir):\n continue\n for current, _, files in os.walk(appdir):\n for name in files:\n if not name.endswith('.desktop'):\n continue\n path = os.path.join(current, name)\n rel = os.path.relpath(path, appdir).replace(os.sep, '-')\n if rel in seen:\n continue\n row = parse_desktop(path)\n if not row:\n continue\n row['desktopId'] = rel\n row['id'] = 'app:' + rel\n seen.add(rel)\n apps.append(row)\napps.sort(key=lambda item: item['title'].casefold())\nprint(json.dumps(apps[:400], ensure_ascii=False))\n`;
507 + function loadDesktopEntries() {
508 + if (appScan.running)
509 + return ;
511 + appScan.exec(["python3", "-c", desktopScanCode()]);
514 + function applyDesktopEntries(text) {
515 + try {
516 + apps = JSON.parse(String(text || "[]"));
517 + appScanDone = true;
518 + appScanError = "";
519 + } catch (error) {
520 + appScanDone = true;
521 + appScanError = String(error);
522 + apps = [];
336 526 function search(raw) {
337 527 const intent = prefixIntent(raw);
338 528 const query = intent.query;
575 + Component.onCompleted: loadDesktopEntries()
577 + Process {
578 + id: appScan
580 + running: false
582 + stdout: StdioCollector {
583 + waitForEnd: true
584 + onStreamFinished: root.applyDesktopEntries(this.text)
587 + stderr: StdioCollector {
588 + waitForEnd: true
589 + onStreamFinished: root.appScanError = this.text.trim()

quickshell/nuguland/Lock.qml

Modified
1 1 import QtQuick
2 2 import Quickshell
3 +import Quickshell.Io
3 4 import Quickshell.Services.Pam
4 5 import Quickshell.Wayland
11 12 property QtObject mediaService
12 13 property QtObject notificationService
13 14 property QtObject powerService
14 - readonly property bool testHarness: Quickshell.env("NUGULAND_SMOKE") === "1"
15 - readonly property bool nativeActionRoute: !safeMode
16 - property bool safeMode: testHarness
15 + readonly property bool nativeActionRoute: true
17 16 property bool active: false
18 17 property bool logicalLocked: false
19 18 property bool unlocking: false
21 20 property bool teardownClean: true
22 21 property string failure: ""
23 22 property int inputLength: 0
23 + property string pendingSecret: ""
24 + property int failureNonce: 0
25 + property real auroraTime: 0
26 + property real angryMix: 0
27 + property bool auroraAvailable: false
24 28 property var lastAction: ({
26 - readonly property string pamConfig: "nugu-lock"
27 - readonly property var boundedActions: ["request", "type", "submit", "fail", "unlock", "cancel"]
29 - function lockSurfacePanelContract() {
30 - return {
31 - "source": "Quickshell lockscreen LockSurface.qml LockContext.qml plus Nuguland lock Content.qml PasswordInput.qml NotifGroup.qml",
32 - "ownedBy": "Lock.qml inline LockSurface",
33 - "nativeSessionLockSurface": true,
34 - "centerPasswordRail": true,
35 - "safeInfoRails": true,
36 - "secretInputField": true,
37 - "failureShakeSlot": true,
38 - "cleanTeardownState": true,
39 - "serviceFedOnly": true,
40 - "noDecorativeDistraction": true,
41 - "railParts": ["time", "secret-input", "safe-media", "notification-summary", "battery", "resources"]
42 - };
43 - }
45 - function surfaceContract() {
46 - return {
47 - "sharedSurfaceContext": true,
48 - "perScreenSurfaces": true,
49 - "activeMonitorEntryOnly": true,
50 - "source": "Quickshell lockscreen example plus Nuguland lock Content.qml",
51 - "centerRail": {
52 - "role": "password-and-clock",
53 - "passwordInput": true,
54 - "clockVisible": true,
55 - "dateVisible": true
56 - },
57 - "sideRails": {
58 - "safeMedia": "transport-only",
59 - "notificationSummary": "body-hidden",
60 - "resourcesVisible": true
61 - }
62 - };
63 - }
65 - function passwordInputContract() {
66 - return {
67 - "passwordInput": true,
68 - "echoMode": "Password",
69 - "sensitiveInputHints": true,
70 - "focusReclaim": true,
71 - "failureShake": failure.length > 0,
72 - "enterAction": "submit",
73 - "volatilePamBuffer": true,
74 - "serializedSecret": false,
75 - "widthMorphsWithBuffer": true,
76 - "iconStates": ["lock", "unlocking", "fingerprint", "fingerprint_off"]
77 - };
78 - }
30 + readonly property string pamConfig: "nuguland-lock.conf"
31 + readonly property var boundedActions: ["request", "type", "submit", "cancel"]
80 33 function stateObject() {
81 34 return {
83 36 "usesNativeSessionLock": true,
84 37 "usesPam": true,
85 38 "pamConfig": pamConfig,
86 - "safeMode": safeMode,
87 - "testHarness": testHarness,
88 39 "nativeActionRoute": nativeActionRoute,
89 40 "helperProcesses": [],
90 41 "serviceOwnedActions": true,
91 42 "boundedActions": boundedActions,
92 43 "surface": "native-session-lock-surface",
93 44 "keyboardFocus": true,
94 - "stealsFocusBack": true,
95 - "secretStored": false,
45 + "passwordOnly": true,
46 + "auroraFullscreen": true,
47 + "angryAuroraOnFailure": true,
96 48 "active": active,
97 49 "locked": logicalLocked,
98 50 "nativeLocked": sessionLock.locked,
102 54 "teardownClean": teardownClean,
103 55 "failure": failure,
104 56 "inputLength": inputLength,
105 - "safeMedia": {
106 - "enabled": true,
107 - "bodyHidden": true,
108 - "transportOnly": true
109 - },
110 - "notificationSummary": {
111 - "count": 0,
112 - "bodiesHidden": true
113 - },
114 - "lockSurfacePanelContract": lockSurfacePanelContract(),
115 - "surfaceContract": surfaceContract(),
116 - "passwordInput": passwordInputContract(),
57 + "failureNonce": failureNonce,
117 58 "lastAction": lastAction
130 71 teardownClean = false;
131 72 failure = "";
132 73 inputLength = 0;
74 + pendingSecret = "";
75 + angryMix = 0;
76 + pam.active = true;
133 77 lastAction = {
134 78 "kind": "request",
135 - "nativeActionRoute": nativeActionRoute,
136 - "testHarness": testHarness
79 + "nativeActionRoute": nativeActionRoute
138 - if (!safeMode)
139 - pam.active = true;
141 81 return stateJson();
158 98 unlocked = false;
159 99 teardownClean = false;
160 100 inputLength = 0;
161 - failure = String(message);
101 + pendingSecret = "";
102 + failure = String(message || "incorrect password").toLowerCase();
103 + failureNonce += 1;
104 + angryMix = 1;
162 105 lastAction = {
163 106 "kind": "fail",
164 107 "message": failure
174 117 teardownClean = true;
175 118 failure = "";
176 119 inputLength = 0;
177 - if (!safeMode)
178 - sessionLock.unlock();
120 + pendingSecret = "";
121 + angryMix = 0;
180 122 lastAction = action;
183 125 function submit(secret) {
184 - const length = String(secret).length;
185 - unlocking = true;
186 - if (safeMode) {
187 - finishUnlock({
188 - "kind": "submit",
189 - "secretLength": length,
190 - "nativeActionRoute": nativeActionRoute,
191 - "testHarness": testHarness
192 - });
193 - } else {
194 - pam.start();
195 - pam.respond(String(secret));
196 - lastAction = {
197 - "kind": "submit",
198 - "secretLength": length,
199 - "nativeActionRoute": nativeActionRoute,
200 - "testHarness": testHarness
201 - };
202 - }
203 - return stateJson();
204 - }
126 + if (unlocking)
127 + return stateJson();
206 - function unlock() {
207 - finishUnlock({
208 - "kind": "unlock",
209 - "nativeActionRoute": nativeActionRoute,
210 - "testHarness": testHarness
211 - });
129 + const value = String(secret);
130 + unlocking = true;
131 + failure = "";
132 + inputLength = value.length;
133 + pendingSecret = value;
134 + pam.active = true;
135 + pam.start();
136 + lastAction = {
137 + "kind": "submit",
138 + "secretLength": value.length,
139 + "nativeActionRoute": nativeActionRoute
140 + };
212 141 return stateJson();
215 144 function cancel() {
216 - if (!safeMode)
217 - pam.abort();
145 + pam.abort();
219 146 active = false;
220 147 logicalLocked = false;
221 148 unlocking = false;
223 150 teardownClean = true;
224 151 failure = "";
225 152 inputLength = 0;
153 + pendingSecret = "";
154 + angryMix = 0;
226 155 lastAction = {
227 156 "kind": "cancel"
229 158 return stateJson();
161 + FileView {
162 + id: auroraBlob
164 + path: Qt.resolvedUrl("shaders/aurora.frag.qsb").toString().replace(/^file:\/\//, "")
165 + preload: true
166 + blockLoading: true
167 + printErrors: false
168 + onLoaded: root.auroraAvailable = true
169 + onLoadFailed: root.auroraAvailable = false
172 + Timer {
173 + interval: 67
174 + repeat: true
175 + running: root.logicalLocked
176 + onTriggered: {
177 + root.auroraTime += 0.04;
178 + root.angryMix += (0 - root.angryMix) * 0.018;
232 182 WlSessionLock {
233 183 id: sessionLock
235 - locked: !root.safeMode && root.logicalLocked
185 + locked: root.logicalLocked
237 187 WlSessionLockSurface {
238 188 color: root.theme ? root.theme.ui.backdrop : "black"
240 - LockSurface {
190 + Rectangle {
241 191 anchors.fill: parent
242 - theme: root.theme
243 - lockService: root
244 - timeService: root.timeService
245 - mediaService: root.mediaService
246 - notificationService: root.notificationService
247 - powerService: root.powerService
192 + color: root.theme ? root.theme.ui.backdrop : "black"
195 + Loader {
196 + anchors.fill: parent
197 + active: root.auroraAvailable
199 + sourceComponent: ShaderEffect {
200 + property real iTime: root.auroraTime
201 + property vector2d iResolution: Qt.vector2d(width, height)
202 + property vector2d iMouse: Qt.vector2d(0.5 + root.angryMix * 0.18, 0.48 - root.angryMix * 0.1)
203 + property real iFirestormMix: root.angryMix
205 + anchors.fill: parent
206 + blending: true
207 + fragmentShader: Qt.resolvedUrl("shaders/aurora.frag.qsb")
212 + Item {
213 + id: lockUi
215 + property real shakeOffset: 0
217 + width: 280
218 + height: 58
219 + x: (parent.width - width) / 2 + shakeOffset
220 + y: (parent.height - height) / 2
222 + Rectangle {
223 + anchors.fill: parent
224 + radius: 16
225 + color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.54) : "#66000000"
226 + border.width: 2
227 + border.color: root.theme ? root.theme.withAlpha(root.angryMix > 0.08 ? root.theme.error : root.theme.ui.accent, 0.92) : "white"
230 + TextInput {
231 + id: secretInput
233 + anchors.fill: parent
234 + anchors.leftMargin: 22
235 + anchors.rightMargin: 22
236 + echoMode: TextInput.Password
237 + passwordCharacter: "•"
238 + color: root.theme ? root.theme.content.normal : "white"
239 + selectedTextColor: root.theme ? root.theme.content.backdrop : "black"
240 + selectionColor: root.theme ? root.theme.ui.accent : "white"
241 + font.family: "IBM Plex Sans"
242 + font.pixelSize: 24
243 + horizontalAlignment: TextInput.AlignHCenter
244 + verticalAlignment: TextInput.AlignVCenter
245 + focus: root.logicalLocked
246 + activeFocusOnTab: true
247 + inputMethodHints: Qt.ImhSensitiveData | Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
248 + onTextChanged: {
249 + if (root.logicalLocked)
250 + root.typeSecret(text);
253 + Keys.onReturnPressed: (event) => {
254 + event.accepted = true;
255 + root.submit(secretInput.text);
256 + secretInput.text = "";
258 + Keys.onEnterPressed: (event) => {
259 + event.accepted = true;
260 + root.submit(secretInput.text);
261 + secretInput.text = "";
263 + Component.onCompleted: forceActiveFocus()
266 + MouseArea {
267 + anchors.fill: parent
268 + acceptedButtons: Qt.LeftButton
269 + onClicked: secretInput.forceActiveFocus()
272 + Connections {
273 + function onLogicalLockedChanged() {
274 + if (root.logicalLocked)
275 + Qt.callLater(secretInput.forceActiveFocus);
279 + function onFailureNonceChanged() {
280 + secretInput.text = "";
281 + Qt.callLater(secretInput.forceActiveFocus);
282 + shakeAnimation.restart();
285 + target: root
288 + SequentialAnimation {
289 + id: shakeAnimation
291 + NumberAnimation {
292 + target: lockUi
293 + property: "shakeOffset"
294 + to: -18
295 + duration: 36
296 + easing.type: Easing.OutCubic
299 + NumberAnimation {
300 + target: lockUi
301 + property: "shakeOffset"
302 + to: 16
303 + duration: 54
304 + easing.type: Easing.InOutCubic
307 + NumberAnimation {
308 + target: lockUi
309 + property: "shakeOffset"
310 + to: -10
311 + duration: 48
312 + easing.type: Easing.InOutCubic
315 + NumberAnimation {
316 + target: lockUi
317 + property: "shakeOffset"
318 + to: 0
319 + duration: 70
320 + easing.type: Easing.OutCubic
257 334 configDirectory: Qt.resolvedUrl("pam")
258 335 config: root.pamConfig
259 336 onPamMessage: {
260 - if (this.responseRequired)
261 - this.respond("");
337 + if (pam.responseRequired) {
338 + pam.respond(root.pendingSecret);
339 + root.pendingSecret = "";
264 342 onCompleted: (result) => {
265 343 if (result === PamResult.Success)
267 345 "kind": "pam-unlock"
270 - root.fail("Incorrect password");
348 + root.fail("incorrect password");
272 350 onError: (error) => {
273 - return root.fail(PamError.toString(error));
351 + root.fail(PamError.toString(error));
277 - component NuguText: Text {
278 - required property QtObject theme
279 - property string variant: "body"
280 - property bool selected: false
282 - color: !theme ? "transparent" : (selected ? theme.content.backdrop : (variant === "title" ? theme.ui.important_global : (variant === "meta" ? theme.ui.normal : theme.content.normal)))
283 - font.family: variant === "mono" ? "IBM Plex Mono" : "IBM Plex Sans"
284 - font.pixelSize: variant === "title" ? 15 : (variant === "meta" ? 13 : 14)
285 - font.bold: variant === "title"
286 - elide: Text.ElideRight
287 - }
289 - component FailureShake: Item {
290 - id: shakeRoot
292 - default property alias content: contentItem.data
293 - property bool active: false
294 - property real boundedDistance: 12
295 - readonly property var shakeOffsets: [0, -boundedDistance, boundedDistance, -boundedDistance / 2, boundedDistance / 2, 0]
297 - implicitWidth: contentItem.implicitWidth
298 - implicitHeight: contentItem.implicitHeight
299 - onActiveChanged: {
300 - if (active)
301 - shake.restart();
303 - }
305 - Item {
306 - id: contentItem
308 - anchors.fill: parent
309 - implicitWidth: childrenRect.width
310 - implicitHeight: childrenRect.height
311 - }
313 - SequentialAnimation {
314 - id: shake
316 - running: false
317 - alwaysRunToEnd: true
319 - ScriptAction {
320 - script: translation.x = shakeRoot.shakeOffsets[0]
321 - }
323 - NumberAnimation {
324 - target: translation
325 - property: "x"
326 - to: shakeRoot.shakeOffsets[1]
327 - duration: 50
328 - easing.type: Easing.OutCubic
329 - }
331 - NumberAnimation {
332 - target: translation
333 - property: "x"
334 - to: shakeRoot.shakeOffsets[2]
335 - duration: 50
336 - easing.type: Easing.OutCubic
337 - }
339 - NumberAnimation {
340 - target: translation
341 - property: "x"
342 - to: shakeRoot.shakeOffsets[3]
343 - duration: 40
344 - easing.type: Easing.OutCubic
345 - }
347 - NumberAnimation {
348 - target: translation
349 - property: "x"
350 - to: shakeRoot.shakeOffsets[4]
351 - duration: 40
352 - easing.type: Easing.OutCubic
353 - }
355 - NumberAnimation {
356 - target: translation
357 - property: "x"
358 - to: shakeRoot.shakeOffsets[5]
359 - duration: 30
360 - easing.type: Easing.OutCubic
361 - }
363 - }
365 - transform: Translate {
366 - id: translation
368 - x: 0
369 - }
371 - }
373 - component LockSurface: Rectangle {
374 - id: root
376 - required property QtObject theme
377 - required property QtObject lockService
378 - property QtObject timeService
379 - property QtObject mediaService
380 - property QtObject notificationService
381 - property QtObject powerService
382 - property var lockState: lockService ? parseJson(lockService.stateJson(), {
383 - "lockSurfacePanelContract": {
384 - },
385 - "passwordInput": {
386 - },
387 - "safeMedia": {
388 - },
389 - "notificationSummary": {
390 - }
391 - }) : ({
392 - "lockSurfacePanelContract": {
393 - },
394 - "passwordInput": {
395 - },
396 - "safeMedia": {
397 - },
398 - "notificationSummary": {
399 - }
400 - })
401 - readonly property var panel: lockState.lockSurfacePanelContract || ({
402 - })
403 - readonly property var timeState: timeService ? parseJson(timeService.stateJson(), {
404 - "clock": {
405 - },
406 - "date": {
407 - }
408 - }) : ({
409 - "clock": {
410 - },
411 - "date": {
412 - }
413 - })
414 - readonly property var mediaState: mediaService ? parseJson(mediaService.stateJson(), {
415 - "activePlayer": {
416 - },
417 - "compact": {
418 - }
419 - }) : ({
420 - "activePlayer": {
421 - },
422 - "compact": {
423 - }
424 - })
425 - readonly property var notificationsState: notificationService ? parseJson(notificationService.stateJson(), {
426 - "activeCount": 0,
427 - "unreadCount": 0
428 - }) : ({
429 - "activeCount": 0,
430 - "unreadCount": 0
431 - })
432 - readonly property var powerState: powerService ? parseJson(powerService.stateJson(), {
433 - "displayBattery": {
434 - },
435 - "activeProfile": ""
436 - }) : ({
437 - "displayBattery": {
438 - },
439 - "activeProfile": ""
440 - })
441 - readonly property string source: "Quickshell lockscreen LockSurface.qml LockContext.qml plus Nuguland lock Content.qml PasswordInput.qml NotifGroup.qml"
442 - readonly property bool nativeSessionLockSurface: true
443 - readonly property bool centerPasswordRail: true
444 - readonly property bool safeInfoRails: true
445 - readonly property bool secretInputField: true
446 - readonly property bool failureShakeSlot: true
447 - readonly property bool cleanTeardownState: true
448 - readonly property bool serviceFedOnly: true
450 - function parseJson(text, valueWhenInvalid) {
451 - try {
452 - return JSON.parse(String(text));
453 - } catch (error) {
454 - return valueWhenInvalid;
455 - }
456 - }
458 - function refreshFrom(text) {
459 - lockState = parseJson(text, lockState);
460 - }
462 - function roleColor(role) {
463 - if (!theme)
464 - return "white";
466 - if (role === "warning")
467 - return theme.warning;
469 - if (role === "error")
470 - return theme.error;
472 - if (role === "info")
473 - return theme.info;
475 - if (role === "ui.focus")
476 - return theme.ui.focus;
478 - if (role === "ui.minor")
479 - return theme.ui.minor;
481 - return theme.ui.accent;
482 - }
484 - color: theme ? theme.ui.backdrop : "black"
486 - Rectangle {
487 - anchors.fill: parent
488 - anchors.margins: 28
489 - radius: 22
490 - color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.92) : "transparent"
491 - border.width: 1
492 - border.color: root.theme ? root.theme.ui.accent : "transparent"
493 - }
495 - Row {
496 - anchors.fill: parent
497 - anchors.margins: 48
498 - spacing: 28
500 - Column {
501 - objectName: "safeInfoRails"
502 - width: Math.max(220, Math.floor((parent.width - 360 - parent.spacing * 2) / 2))
503 - anchors.verticalCenter: parent.verticalCenter
504 - spacing: 12
506 - NuguText {
507 - theme: root.theme
508 - variant: "meta"
509 - text: "Session locked"
510 - width: parent.width
511 - wrapMode: Text.WordWrap
512 - }
514 - Rectangle {
515 - width: parent.width
516 - height: 1
517 - color: root.theme ? root.theme.ui.accent : "transparent"
518 - }
520 - NuguText {
521 - theme: root.theme
522 - variant: "title"
523 - text: root.mediaState.activePlayer ? root.mediaState.activePlayer.title || "media idle" : "media idle"
524 - width: parent.width
525 - elide: Text.ElideRight
526 - }
528 - NuguText {
529 - theme: root.theme
530 - text: root.lockState.safeMedia && root.lockState.safeMedia.transportOnly ? "transport-only media · bodies hidden" : "safe media"
531 - width: parent.width
532 - elide: Text.ElideRight
533 - }
535 - Rectangle {
536 - width: parent.width
537 - height: 52
538 - radius: 14
539 - color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.12) : "transparent"
540 - border.width: 1
541 - border.color: root.theme ? root.theme.ui.accent : "transparent"
543 - NuguText {
544 - anchors.centerIn: parent
545 - theme: root.theme
546 - variant: "meta"
547 - text: "previous · play/pause · next"
548 - }
550 - }
552 - }
554 - Column {
555 - objectName: "centerPasswordRail"
556 - width: 360
557 - anchors.verticalCenter: parent.verticalCenter
558 - spacing: 14
560 - NuguText {
561 - theme: root.theme
562 - variant: "title"
563 - text: root.timeState.clock ? root.timeState.clock.display || "--:--" : "--:--"
564 - width: parent.width
565 - horizontalAlignment: Text.AlignHCenter
566 - }
568 - NuguText {
569 - theme: root.theme
570 - text: root.timeState.date ? root.timeState.date.line || "locked" : "locked"
571 - width: parent.width
572 - horizontalAlignment: Text.AlignHCenter
573 - }
575 - FailureShake {
576 - objectName: "failureShakeSlot"
577 - active: root.lockState.failure && root.lockState.failure.length > 0
578 - width: parent.width
579 - height: inputCard.height
581 - Rectangle {
582 - id: inputCard
584 - objectName: "secretInputField"
585 - width: parent.width
586 - height: 46
587 - radius: 23
588 - color: root.theme ? root.theme.withAlpha(root.lockState.failure ? root.theme.error : root.theme.ui.focus, root.lockState.failure ? 0.18 : 0.14) : "transparent"
589 - border.width: 1
590 - border.color: root.theme ? (root.lockState.failure ? root.theme.error : root.theme.ui.focus) : "transparent"
592 - NuguText {
593 - anchors.left: parent.left
594 - anchors.leftMargin: 14
595 - anchors.verticalCenter: parent.verticalCenter
596 - theme: root.theme
597 - variant: "meta"
598 - text: root.lockState.unlocking ? "unlocking" : "lock"
599 - opacity: 0.72
600 - }
602 - TextInput {
603 - id: secretInput
605 - anchors.left: parent.left
606 - anchors.leftMargin: 90
607 - anchors.right: submitButton.left
608 - anchors.rightMargin: 10
609 - anchors.verticalCenter: parent.verticalCenter
610 - color: root.theme ? root.theme.content.normal : "white"
611 - selectionColor: root.theme ? root.theme.ui.focus : "white"
612 - selectedTextColor: root.theme ? root.theme.content.backdrop : "black"
613 - font.family: "IBM Plex Mono"
614 - echoMode: TextInput.Password
615 - inputMethodHints: Qt.ImhSensitiveData
616 - enabled: !root.lockState.unlocking
617 - focus: root.lockState.active
618 - onActiveFocusChanged: {
619 - if (!activeFocus && root.lockState.active)
620 - forceActiveFocus();
622 - }
623 - onTextChanged: {
624 - if (root.lockService)
625 - root.refreshFrom(root.lockService.typeSecret(text));
627 - }
628 - Keys.onReturnPressed: (event) => {
629 - event.accepted = true;
630 - if (root.lockService) {
631 - root.refreshFrom(root.lockService.submit(text));
632 - text = "";
633 - }
634 - }
635 - Keys.onEnterPressed: (event) => {
636 - event.accepted = true;
637 - if (root.lockService) {
638 - root.refreshFrom(root.lockService.submit(text));
639 - text = "";
640 - }
641 - }
642 - }
644 - Rectangle {
645 - id: submitButton
647 - anchors.right: parent.right
648 - anchors.rightMargin: 6
649 - anchors.verticalCenter: parent.verticalCenter
650 - width: 34
651 - height: 34
652 - radius: 17
653 - color: root.theme ? root.theme.ui.accent : "white"
654 - opacity: secretInput.text.length > 0 ? 1 : 0.46
656 - NuguText {
657 - anchors.centerIn: parent
658 - theme: root.theme
659 - variant: "meta"
660 - selected: true
661 - text: "→"
662 - }
664 - MouseArea {
665 - anchors.fill: parent
666 - enabled: secretInput.text.length > 0
667 - onClicked: {
668 - root.refreshFrom(root.lockService.submit(secretInput.text));
669 - secretInput.text = "";
670 - }
671 - }
673 - }
675 - }
677 - }
679 - NuguText {
680 - theme: root.theme
681 - variant: "meta"
682 - text: root.lockState.failure || (root.lockState.teardownClean ? "cleanTeardownState" : "session locked")
683 - width: parent.width
684 - horizontalAlignment: Text.AlignHCenter
685 - color: root.lockState.failure ? root.roleColor("error") : (root.theme ? root.theme.content.normal : "white")
686 - }
688 - }
690 - Column {
691 - width: Math.max(220, Math.floor((parent.width - 360 - parent.spacing * 2) / 2))
692 - anchors.verticalCenter: parent.verticalCenter
693 - spacing: 12
695 - NuguText {
696 - theme: root.theme
697 - variant: "title"
698 - text: "private"
699 - width: parent.width
700 - elide: Text.ElideRight
701 - }
703 - NuguText {
704 - theme: root.theme
705 - text: `${root.notificationsState.unreadCount || 0} unread · bodies hidden`
706 - width: parent.width
707 - elide: Text.ElideRight
708 - }
710 - Rectangle {
711 - width: parent.width
712 - height: 52
713 - radius: 14
714 - color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.1) : "transparent"
715 - border.width: 1
716 - border.color: root.theme ? root.theme.ui.minor : "transparent"
718 - NuguText {
719 - anchors.centerIn: parent
720 - theme: root.theme
721 - variant: "meta"
722 - text: root.powerState.displayBattery ? `battery ${root.powerState.displayBattery.percent || 0}%` : "battery"
723 - }
725 - }
727 - NuguText {
728 - theme: root.theme
729 - variant: "meta"
730 - text: "no notification bodies · no secrets serialized"
731 - width: parent.width
732 - wrapMode: Text.WordWrap
733 - }
735 - }
737 - }
739 - }

quickshell/nuguland/Media.qml

Modified
148 148 return activePlayer().playbackState === "playing" ? 1 : 0;
151 - function mediaAvailableValue() {
152 - return servicePlayers().length > 0 ? 1 : 0;
153 - }
155 151 function mediaEnergyValue() {
156 152 // Amplitude VU removed (no audio capture). Energy now reflects playback state only.
157 153 return mediaPlayingValue();

quickshell/nuguland/Network.qml

Modified
1 1 import QtQuick
2 2 import Quickshell
3 -import Quickshell.Networking
5 4 Item {
6 5 id: root
8 - readonly property bool testHarness: Quickshell.env("NUGULAND_SMOKE") === "1"
9 - property bool testWifiEnabled: true
10 - property bool testScanning: false
7 + readonly property string hostStack: "iwd + systemd-networkd + systemd-resolved"
11 8 property string error: ""
12 9 property var lastAction: ({
14 - property var testNetworks: [{
15 - "id": "nugu-lan",
16 - "ssid": "nugu-lan",
17 - "state": "connected",
18 - "signal": 84,
19 - "security": "wpa3",
20 - "known": true
21 - }, {
22 - "id": "nugu-lab",
23 - "ssid": "nugu-lab",
24 - "state": "available",
25 - "signal": 71,
26 - "security": "wpa3",
27 - "known": true
28 - }, {
29 - "id": "guest",
30 - "ssid": "guest",
31 - "state": "available",
32 - "signal": 46,
33 - "security": "open",
34 - "known": false
35 - }]
36 - readonly property string nativeApi: "native networking singleton NetworkBackendType NetworkConnectivity"
11 + readonly property string nativeApi: "host stack: iwd + systemd-networkd + systemd-resolved"
37 12 readonly property var boundedActions: ["scan", "select", "forget", "toggle-wifi", "check-connectivity"]
38 - readonly property bool nativeActionRoute: !testHarness
40 - function nativeWifiDevice() {
41 - if (testHarness)
42 - return null;
44 - return Networking.devices.values.find((device) => {
45 - return device.type === DeviceType.Wifi;
46 - }) ?? null;
47 - }
49 - function nativeWiredDevice() {
50 - if (testHarness)
51 - return null;
53 - return Networking.devices.values.find((device) => {
54 - return device.type === DeviceType.Wired;
55 - }) ?? null;
56 - }
13 + readonly property bool nativeActionRoute: false
58 15 function networkId(network) {
59 16 return String(network.id || network.name || network.ssid || "network");
73 - function nativeNetworks() {
74 - const wifiDevice = nativeWifiDevice();
75 - if (!wifiDevice)
76 - return [];
78 - return wifiDevice.networks.values.map((network) => {
79 - return ({
80 - "id": network.name,
81 - "ssid": network.name,
82 - "state": ConnectionState.toString(network.state),
83 - "signal": Math.round(Number(network.signalStrength || 0) * 100),
84 - "security": WifiSecurityType.toString(network.security),
85 - "known": !!network.known,
86 - "nativeObject": network
87 - });
88 - });
30 + function hostNetworks() {
31 + return [];
91 34 function sortedNetworks(rows) {
107 50 function networks() {
108 - return sortedNetworks(testHarness ? testNetworks : nativeNetworks());
51 + return sortedNetworks(hostNetworks());
111 54 function connectivityPanelContract() {
120 63 "batteryBadges": true,
121 64 "serviceActionsOnly": true,
122 65 "rowKinds": ["wifi-network", "bluetooth-device"],
123 - "nativeServices": ["Network.qml", "Bluetooth.qml"],
66 + "nativeServices": ["Network.qml host stack", "Bluetooth.qml"],
67 + "hostStack": hostStack,
124 68 "noShellHelpers": true
134 78 return list[i];
136 80 return {
137 - "id": "",
138 - "ssid": "",
139 - "state": "disconnected",
81 + "id": "host-network",
82 + "ssid": "host-network",
83 + "state": "host-managed",
140 84 "signal": 0,
141 - "security": "unknown",
85 + "security": "systemd-networkd",
142 86 "known": false
154 98 function wifiOn() {
155 - return testHarness ? testWifiEnabled : !!Networking.wifiEnabled;
99 + return true;
158 102 function scanning() {
159 - const wifiDevice = nativeWifiDevice();
160 - return testHarness ? testScanning : !!(wifiDevice && wifiDevice.scannerEnabled);
103 + return false;
163 106 function role() {
171 114 if (active.state === "connecting" || active.state === "Connecting")
172 115 return "warning";
174 - return active.state === "connected" || active.state === "Connected" ? "ui.accent" : "ui.minor";
117 + return active.state === "connected" || active.state === "Connected" || active.state === "host-managed" ? "ui.accent" : "ui.minor";
177 120 function stateObject() {
178 121 const active = cloneNetwork(activeNetworkObject());
179 122 return {
180 123 "backend": "Network.qml",
181 - "usesNativeQuickshellNetworking": true,
124 + "usesNativeQuickshellNetworking": false,
125 + "usesHostStack": true,
126 + "hostStack": hostStack,
182 127 "nativeApi": nativeApi,
183 - "nativeBackend": testHarness ? "smoke-isolated" : NetworkBackendType.toString(Networking.backend),
184 - "nativeWifiEnabled": testHarness ? false : !!Networking.wifiEnabled,
185 - "nativeWifiHardwareEnabled": testHarness ? false : !!Networking.wifiHardwareEnabled,
186 - "nativeCanCheckConnectivity": testHarness ? false : !!Networking.canCheckConnectivity,
187 - "nativeConnectivity": testHarness ? "smoke-isolated" : NetworkConnectivity.toString(Networking.connectivity),
128 + "nativeBackend": "iwd-systemd-networkd-resolved",
129 + "nativeWifiEnabled": wifiOn(),
130 + "nativeWifiHardwareEnabled": wifiOn(),
131 + "nativeCanCheckConnectivity": false,
132 + "nativeConnectivity": "host-managed",
188 133 "nativeActionRoute": nativeActionRoute,
189 - "testHarness": testHarness,
190 134 "helperProcesses": [],
191 135 "serviceOwnedActions": true,
192 136 "boundedActions": boundedActions,
195 139 "error": error,
196 140 "wifi": {
197 141 "enabled": wifiOn(),
198 - "hardwareEnabled": testHarness ? true : !!Networking.wifiHardwareEnabled
142 + "hardwareEnabled": wifiOn()
200 144 "active": active,
201 145 "knownNetworks": networks().map((network) => {
204 148 "knownNetworksById": knownNetworksById(),
205 149 "compact": {
206 - "label": wifiOn() ? (active.ssid.length > 0 ? active.ssid : "wifi") : "wifi off",
150 + "label": "Network",
207 151 "role": role(),
208 152 "signal": wifiOn() ? active.signal : 0
154 + "shader": {
155 + "kind": "network-mini-graph",
156 + "clipped": true,
157 + "source": "shaders/network-mini-graph.frag.qsb",
158 + "priorArt": "Shadertoy smoothstep distance-to-line graph primitives plus matrix-rain inspired packet rain",
159 + "rateSource": "Resources.qml",
160 + "colors": ["ui.accent", "ui.focus", "ui.minor", "ui.backdrop", "warning", "error"]
161 + },
210 162 "lastAction": lastAction
218 170 function scan() {
219 - error = "";
220 - if (testHarness)
221 - testScanning = true;
222 - else if (nativeWifiDevice())
223 - nativeWifiDevice().scannerEnabled = true;
171 + error = "scan-owned-by-iwd";
224 172 lastAction = {
225 173 "kind": "scan",
226 - "nativeActionRoute": nativeActionRoute
174 + "nativeActionRoute": nativeActionRoute,
175 + "hostStack": hostStack
228 177 return stateJson();
240 189 lastAction = {
241 190 "kind": "select",
242 191 "id": networkIdValue,
243 - "nativeActionRoute": nativeActionRoute
192 + "nativeActionRoute": nativeActionRoute,
193 + "hostStack": hostStack
245 195 return stateJson();
247 - if (testHarness) {
248 - testWifiEnabled = true;
249 - testScanning = false;
250 - testNetworks = testNetworks.map((network) => {
251 - return network.id === networkIdValue ? Object.assign({
252 - }, network, {
253 - "state": "connecting"
254 - }) : Object.assign({
255 - }, network, {
256 - "state": "available"
257 - });
258 - });
259 - } else if (selected.nativeObject) {
260 - selected.nativeObject.connect();
261 - }
262 - error = "";
197 + error = "select-owned-by-iwd";
263 198 lastAction = {
264 199 "kind": "select",
265 200 "id": networkIdValue,
266 - "nativeActionRoute": nativeActionRoute
201 + "nativeActionRoute": nativeActionRoute,
202 + "hostStack": hostStack
268 204 return stateJson();
271 207 function toggleWifi(enabled) {
272 - if (testHarness) {
273 - testWifiEnabled = !!enabled;
274 - testScanning = false;
275 - } else {
276 - Networking.wifiEnabled = !!enabled;
277 - }
278 - error = "";
208 + error = "wifi-toggle-owned-by-iwd";
279 209 lastAction = {
280 210 "kind": "toggle-wifi",
281 211 "enabled": wifiOn(),
282 - "nativeActionRoute": nativeActionRoute
212 + "nativeActionRoute": nativeActionRoute,
213 + "hostStack": hostStack
284 215 return stateJson();
287 218 function forget(id) {
288 219 const networkIdValue = String(id);
289 - if (testHarness) {
290 - testNetworks = testNetworks.filter((network) => {
291 - return network.id !== networkIdValue;
292 - });
293 - } else {
294 - const list = networks();
295 - for (let i = 0; i < list.length; i++) if (networkId(list[i]) === networkIdValue && list[i].nativeObject) {
296 - list[i].nativeObject.forget();
297 - }
298 - }
299 220 lastAction = {
300 221 "kind": "forget",
301 222 "id": networkIdValue,
302 - "nativeActionRoute": nativeActionRoute
223 + "nativeActionRoute": nativeActionRoute,
224 + "hostStack": hostStack
304 226 return stateJson();
307 229 function checkConnectivity() {
308 - if (!testHarness && Networking.canCheckConnectivity)
309 - Networking.checkConnectivity();
311 230 lastAction = {
312 231 "kind": "check-connectivity",
313 - "nativeActionRoute": nativeActionRoute
232 + "nativeActionRoute": nativeActionRoute,
233 + "hostStack": hostStack
315 235 return stateJson();

quickshell/nuguland/Niri.qml

Modified
9 9 property bool ready: false
10 10 property string lastError: ""
11 11 property var workspaces: []
12 + readonly property var visibleWorkspaces: displayWorkspaces(workspaces)
12 13 property var windows: []
13 14 property var outputs: []
14 15 property var focusedWindow: null
15 - property var focusedOutput: null
16 16 property string overviewState: "unknown"
17 + property string lastPickedColor: ""
17 18 property var lastWindowAction: ({
19 20 readonly property var focusedWindowRecord: windowById(focusedWindow)
27 28 query.exec(["niri", "msg", "--json", "event-stream"]);
31 + function loadSnapshot() {
32 + if (!available || snapshot.running)
33 + return ;
35 + snapshot.exec(["sh", "-c", "printf '{\"windows\":'; niri msg --json windows; printf ',\"workspaces\":'; niri msg --json workspaces; printf ',\"outputs\":'; niri msg --json outputs; printf ',\"focused\":'; niri msg --json focused-window || printf 'null'; printf ',\"overview\":'; niri msg --json overview-state || printf '{\"is_open\":false}'; printf '}\\n'"]);
36 + }
38 + function applySnapshot(text) {
39 + let data;
40 + try {
41 + data = JSON.parse(String(text || "{}"));
42 + } catch (error) {
43 + lastError = String(error);
44 + return ;
45 + }
46 + windows = data.windows || [];
47 + workspaces = data.workspaces || [];
48 + outputs = data.outputs || [];
49 + focusedWindow = data.focused && data.focused.id !== undefined ? data.focused.id : null;
50 + overviewState = data.overview && data.overview.is_open ? "open" : "closed";
51 + ready = true;
52 + }
30 54 function action(args) {
31 55 const list = Array.isArray(args) ? args : [String(args)];
32 56 actionProc.exec(["niri", "msg", "action"].concat(list.map(String)));
35 59 function screenshot(path) {
36 - action(["screenshot", "--path", path, "--write-to-disk", "true"]);
60 + action(["screenshot", "--path", path]);
39 63 function screenshotScreen(path) {
47 71 function pickColor() {
72 + lastPickedColor = "";
48 73 colorProc.exec(["niri", "msg", "pick-color"]);
76 + function focusWorkspace(ref) {
77 + action(["focus-workspace", String(ref)]);
78 + }
80 + function displayWorkspaces(items) {
81 + return (items || []).filter((workspace) => {
82 + return workspace.name || workspace.is_focused || workspace.is_active || workspace.is_urgent || workspace.active_window_id !== null && workspace.active_window_id !== undefined;
83 + });
84 + }
86 + function parsePickedColor(text) {
87 + const value = String(text || "");
88 + const match = value.match(/#[0-9a-fA-F]{6}/);
89 + lastPickedColor = match ? match[0].toLowerCase() : "";
90 + lastError = value.trim();
91 + }
51 93 function windowById(id) {
52 94 if (id === null || id === undefined)
53 95 return null;
63 105 function windowActions(id) {
64 106 return [{
65 107 "id": "focus",
66 - "label": "Focus",
108 + "label": "focus",
67 109 "route": "Niri.qml",
68 110 "niriAction": "focus-window",
69 111 "destructive": false,
70 112 "keyboard": "Enter"
72 114 "id": "toggle-fullscreen",
73 - "label": "Fullscreen",
115 + "label": "fullscreen",
74 116 "route": "Niri.qml",
75 117 "niriAction": "toggle-fullscreen",
76 118 "destructive": false,
77 119 "keyboard": "F"
79 121 "id": "move-workspace",
80 - "label": "Move workspace",
122 + "label": "move workspace",
81 123 "route": "Niri.qml",
82 124 "niriAction": "move-window-to-workspace",
83 125 "destructive": false,
84 126 "keyboard": "M"
86 128 "id": "close-window",
87 - "label": "Close",
129 + "label": "close",
88 130 "route": "Niri.qml",
89 131 "niriAction": "close-window",
90 132 "destructive": true,
109 151 "workspaceMoveAffordance": true,
110 152 "serviceActionsOnly": true,
111 153 "route": "Niri.qml",
154 + "realNiriWindowState": true,
112 155 "cardParts": ["preview-slot", "details", "rule-hints", "actions", "workspace-move"],
113 156 "noCompositorOverviewClone": true
209 252 "ready": ready,
210 253 "workspaceCount": workspaces.length,
211 254 "windowCount": windows.length,
212 - "outputCount": outputs.length,
255 + "windows": windows,
256 + "outputCount": Array.isArray(outputs) ? outputs.length : Object.keys(outputs || {
257 + }).length,
258 + "outputs": outputs,
259 + "workspaces": workspaces,
213 260 "overviewState": overviewState,
214 261 "focusedWindow": focusedWindow,
215 262 "focusedAppId": focusedAppId,
246 - Component.onCompleted: refresh()
293 + Component.onCompleted: {
294 + loadSnapshot();
295 + refresh();
298 + Process {
299 + id: snapshot
301 + running: false
303 + stdout: StdioCollector {
304 + waitForEnd: true
305 + onStreamFinished: root.applySnapshot(this.text)
308 + stderr: StdioCollector {
309 + waitForEnd: true
310 + onStreamFinished: {
311 + if (this.text.trim().length > 0)
312 + root.lastError = this.text.trim();
248 319 Process {
249 320 id: query
280 351 id: colorProc
282 353 stdout: StdioCollector {
283 - onStreamFinished: root.lastError = this.text.trim()
354 + onStreamFinished: root.parsePickedColor(this.text)
286 357 stderr: StdioCollector {

quickshell/nuguland/Notifications.qml

Modified
16 16 property var pointerTrace: []
17 17 property var lastAction: ({
19 - readonly property bool testHarness: Quickshell.env("NUGULAND_SMOKE") === "1"
20 - readonly property bool nativeActionRoute: !testHarness
19 + readonly property bool nativeActionRoute: true
21 20 readonly property bool usesNativeNotificationServer: true
22 21 readonly property bool groupedByAppLatestFirst: true
23 22 readonly property bool horizontalActionRows: true
147 146 lastAction = {
148 147 "kind": "native-notification",
149 148 "id": id,
150 - "nativeActionRoute": nativeActionRoute,
151 - "testHarness": testHarness
149 + "nativeActionRoute": nativeActionRoute
241 239 "actionRailKinds": ["close", "server-action", "copy-body"],
242 240 "pointerParity": ["left-toggle-expand", "middle-close", "horizontal-drag-dismiss"],
243 241 "keyboardParity": ["Return", "Space", "Escape"],
244 - "dismissThresholdRatio": dismissThresholdRatio
242 + "dismissThresholdRatio": dismissThresholdRatio,
243 + "realNotificationServer": true,
244 + "noSyntheticNotifications": true
288 288 return {
289 289 "backend": "Notifications.qml",
290 290 "usesNativeNotificationServer": usesNativeNotificationServer,
291 - "testHarness": testHarness,
292 291 "nativeActionRoute": nativeActionRoute,
293 - "trackedNativeCount": notificationServer.trackedNotifications ? notificationServer.trackedNotifications.values.length : 0,
292 + "syntheticNotifications": false,
293 + "trackedNativeCount": Object.keys(nativeNotifications).length,
294 294 "groupedByAppLatestFirst": groupedByAppLatestFirst,
295 295 "horizontalActionRows": horizontalActionRows,
296 296 "expandedGroups": expandedGroups.slice(0),
300 300 "notificationPanelContract": notificationPanelContract(),
301 301 "dnd": dnd,
302 302 "popupInhibition": dnd || popupInhibition,
303 + "toastAnchor": {
304 + "barId": "notifications",
305 + "edge": "top",
306 + "source": "NotificationServer",
307 + "suppressedWhenDnd": true,
308 + "popupVisible": !(dnd || popupInhibition) && active.length > 0
309 + },
303 310 "unreadCount": unreadCount,
304 311 "activeCount": active.length,
305 312 "groups": grouped,
317 324 return JSON.stringify(stateObject());
320 - function seed() {
321 - dnd = false;
322 - popupInhibition = false;
323 - expandedGroups = [];
324 - pointerTrace = [];
325 - notifications = [normalize({
326 - "id": "chat-1",
327 - "appName": "Chat",
328 - "summary": "older ping",
329 - "body": "older body",
330 - "time": 1000,
331 - "urgency": "normal",
332 - "actions": [{
333 - "id": "reply",
334 - "label": "Reply"
335 - }]
336 - }), normalize({
337 - "id": "build-1",
338 - "appName": "Build",
339 - "summary": "compile failed",
340 - "body": "error body",
341 - "time": 3000,
342 - "urgency": "critical",
343 - "actions": [{
344 - "id": "open-log",
345 - "label": "Open log"
346 - }]
347 - }), normalize({
348 - "id": "chat-2",
349 - "appName": "Chat",
350 - "summary": "new ping",
351 - "body": "new body",
352 - "time": 5000,
353 - "urgency": "normal",
354 - "actions": [{
355 - "id": "reply",
356 - "label": "Reply"
357 - }, {
358 - "id": "mark-read",
359 - "label": "Mark read"
360 - }]
361 - })];
362 - unreadCount = notifications.length;
363 - lastAction = {
364 - "kind": "seed",
365 - "count": notifications.length
366 - };
367 - return stateJson();
368 - }
370 327 function toggleDnd() {
371 328 dnd = !dnd;
372 329 lastAction = {
403 360 "kind": "close",
404 361 "id": id,
405 362 "route": "Notifications.qml",
406 - "nativeActionRoute": nativeActionRoute,
407 - "testHarness": testHarness
363 + "nativeActionRoute": nativeActionRoute
409 365 } else if (action === "copy-body") {
366 + if (n.body.length > 0)
367 + Quickshell.execDetached(["wl-copy", n.body]);
410 369 lastAction = {
411 370 "kind": "copy-body",
412 371 "id": id,
413 372 "bodyCopied": n.body.length > 0,
414 - "route": "Notifications.qml"
373 + "route": "Notifications.qml",
374 + "clipboardRoute": "wl-copy"
416 376 } else {
417 377 let invoked = false;
431 391 "actionId": action,
432 392 "invoked": invoked,
433 393 "route": "Notifications.qml",
434 - "nativeActionRoute": nativeActionRoute,
435 - "testHarness": testHarness
394 + "nativeActionRoute": nativeActionRoute
438 397 notifications = notifications.slice(0);
512 471 return stateJson();
515 - NotificationServer {
516 - id: notificationServer
474 + Loader {
475 + active: true
518 - keepOnReload: false
519 - persistenceSupported: true
520 - bodySupported: true
521 - bodyMarkupSupported: true
522 - bodyHyperlinksSupported: true
523 - bodyImagesSupported: true
524 - actionsSupported: true
525 - actionIconsSupported: true
526 - imageSupported: true
527 - inlineReplySupported: false
528 - onNotification: (notification) => {
529 - return root.acceptNativeNotification(notification);
477 + sourceComponent: NotificationServer {
478 + keepOnReload: false
479 + persistenceSupported: true
480 + bodySupported: true
481 + bodyMarkupSupported: true
482 + bodyHyperlinksSupported: true
483 + bodyImagesSupported: true
484 + actionsSupported: true
485 + actionIconsSupported: true
486 + imageSupported: true
487 + inlineReplySupported: false
488 + onNotification: (notification) => {
489 + return root.acceptNativeNotification(notification);

quickshell/nuguland/PopoutHost.qml

Modified
1 1 import QtQuick
2 2 import Quickshell
3 +import Quickshell.Wayland
4 +import "Util.js" as Util
4 -PopupWindow {
6 +PanelWindow {
5 7 id: root
7 9 required property QtObject theme
15 17 required property QtObject clipboardService
16 18 required property QtObject launcherService
17 19 required property QtObject audioService
20 + required property QtObject brightnessService
18 21 required property QtObject networkService
19 22 required property QtObject bluetoothService
20 23 required property QtObject powerService
21 - required property QtObject screenshotsService
22 24 required property QtObject idleService
23 25 required property QtObject lockService
24 - required property QtObject diagnosticsService
25 26 required property var barWindow
26 27 readonly property var contentSize: surfaces ? surfaces.popoutContentSize(surfaces.popoutName) : ({
27 28 "width": 320,
45 46 readonly property var currentRect: cardFrame.currentRect
46 47 readonly property string activeName: surfaces ? surfaces.popoutName : ""
47 48 readonly property string removingName: surfaces ? surfaces.removingLoaderName : ""
48 - readonly property bool testHarness: Quickshell.env("NUGULAND_SMOKE") === "1" && Quickshell.env("NUGULAND_REAL_INPUT") !== "1"
50 - function parseJson(text, valueWhenInvalid) {
51 - try {
52 - return JSON.parse(String(text));
53 - } catch (error) {
54 - return valueWhenInvalid;
55 - }
56 - }
49 + readonly property int surfaceWidth: surfaces && surfaces.screenWidth > 0 ? surfaces.screenWidth : contentSize.width
50 + readonly property int surfaceHeight: surfaces && surfaces.screenHeight > 0 ? Math.max(1, surfaces.screenHeight - surfaces.barHeight) : contentSize.height
58 52 function contentComponent(name) {
59 53 switch (String(name)) {
60 54 case "clock":
61 55 return clockContent;
62 - case "cpu":
63 - return cpuContent;
56 + case "system":
57 + return systemContent;
64 58 case "notifications":
65 59 return notificationsContent;
66 60 case "tray":
67 61 return trayContent;
68 - case "window":
69 - return windowContent;
70 62 case "media":
71 63 return mediaContent;
72 64 case "clipboard":
75 67 return launcherContent;
76 68 case "audio":
77 69 return audioContent;
70 + case "brightness":
71 + return brightnessContent;
78 72 case "connectivity":
79 73 return connectivityContent;
80 74 case "power":
81 75 return powerContent;
82 - case "screenshots":
83 - return screenshotsContent;
84 76 case "idle":
85 77 return idleContent;
86 - case "diagnostics":
87 - return diagnosticsContent;
88 78 default:
89 79 return helpContent;
93 83 visible: surfaces && (surfaces.popoutOpen || surfaces.popoutClosing)
94 - grabFocus: !testHarness
95 - width: contentSize.width
96 - height: contentSize.height
97 - implicitWidth: width
98 - implicitHeight: height
84 + screen: root.barWindow ? root.barWindow.screen : null
85 + implicitWidth: root.surfaceWidth
86 + implicitHeight: root.surfaceHeight
99 87 color: "transparent"
88 + exclusionMode: ExclusionMode.Ignore
89 + WlrLayershell.layer: WlrLayer.Overlay
90 + WlrLayershell.namespace: "nuguland-popout"
91 + WlrLayershell.keyboardFocus: root.visible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
100 92 onVisibleChanged: {
101 93 if (!visible && root.surfaces && root.surfaces.popoutOpen && !root.surfaces.popoutClosing)
102 94 root.surfaces.closePopout("focus-grab-outside");
111 - anchor {
112 - window: root.barWindow
113 - rect.x: Math.round(root.popupAnchorRect.x)
114 - rect.y: Math.round(root.popupAnchorRect.y)
115 - rect.width: Math.round(root.popupAnchorRect.width)
116 - rect.height: Math.round(root.popupAnchorRect.height)
117 - adjustment: PopupAdjustment.None
118 - gravity: Edges.Bottom
119 - edges: Edges.Top
103 + anchors {
104 + top: true
105 + left: true
106 + right: true
107 + bottom: true
110 + Shortcut {
111 + sequence: "Escape"
112 + context: Qt.WindowShortcut
113 + onActivated: {
114 + if (root.surfaces)
115 + root.surfaces.closePopout("escape-key");
120 + Item {
121 + id: popoutInputRegion
123 + x: 0
124 + y: root.surfaces ? root.surfaces.barHeight : 0
125 + width: parent.width
126 + height: Math.max(1, parent.height - y)
129 + MouseArea {
130 + id: outsideDismissLayer
132 + x: popoutInputRegion.x
133 + y: popoutInputRegion.y
134 + width: popoutInputRegion.width
135 + height: popoutInputRegion.height
136 + acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
137 + onPressed: (mouse) => {
138 + const rootY = mouse.y + outsideDismissLayer.y;
139 + const inside = mouse.x >= card.x && mouse.x <= card.x + card.width && rootY >= card.y && rootY <= card.y + card.height;
140 + if (!inside && root.surfaces) {
141 + mouse.accepted = true;
142 + root.surfaces.closePopout("outside");
122 147 Rectangle {
128 153 height: Math.round(root.currentRect.height)
129 154 clip: true
130 155 color: root.theme ? root.theme.ui.backdrop : "transparent"
131 - border.width: 1
156 + border.width: 0
132 157 border.color: root.theme ? root.theme.ui.accent : "transparent"
133 158 radius: 14
134 159 opacity: root.cardFrame.opacity
151 176 anchors.margins: 16
152 177 spacing: 10
154 - Row {
155 - width: parent.width
156 - spacing: 8
158 - NuguText {
159 - theme: root.theme
160 - variant: "title"
161 - text: root.activeName.length > 0 ? root.activeName : "popout"
166 - Rectangle {
167 - width: parent.width
168 - height: 1
169 - color: root.theme ? root.theme.ui.accent : "transparent"
172 179 Item {
173 180 id: loaderStack
187 194 Behavior on opacity {
188 195 NumberAnimation {
189 - duration: 180
196 + duration: root.theme && root.theme.lowPowerMode ? 0 : 180
190 197 easing.type: Easing.OutCubic
204 211 Behavior on opacity {
205 212 NumberAnimation {
206 - duration: 180
213 + duration: root.theme && root.theme.lowPowerMode ? 0 : 180
207 214 easing.type: Easing.OutCubic
218 225 Behavior on y {
219 226 NumberAnimation {
220 - duration: 130
227 + duration: root.theme && root.theme.lowPowerMode ? 0 : 130
221 228 easing.type: Easing.InOutCubic
226 233 Behavior on opacity {
227 234 NumberAnimation {
228 - duration: 90
235 + duration: root.theme && root.theme.lowPowerMode ? 0 : 90
229 236 easing.type: Easing.InOutCubic
237 244 id: clockContent
239 246 Column {
240 - property var state: root.timeService ? root.parseJson(root.timeService.stateJson(), {
247 + property var state: root.timeService ? Util.parseJson(root.timeService.stateJson(), {
241 248 }) : ({
243 - property var calendar: root.timeService ? root.parseJson(root.timeService.calendar(new Date().getUTCFullYear(), new Date().getUTCMonth() + 1, new Date().getUTCDate()), {
250 + property date localNow: new Date()
251 + property var calendar: root.timeService ? Util.parseJson(root.timeService.calendar(localNow.getFullYear(), localNow.getMonth() + 1, localNow.getDate()), {
244 252 "weeks": []
245 253 }) : ({
246 254 "weeks": []
275 283 height: 16
276 284 radius: 4
277 285 color: modelData.selected && root.theme ? root.theme.ui.focus : "transparent"
278 - border.width: modelData.today ? 1 : 0
286 + border.width: 0
279 287 border.color: root.theme ? root.theme.ui.accent : "transparent"
281 289 NuguText {
305 313 Component {
306 - id: cpuContent
314 + id: systemContent
308 316 Column {
309 - readonly property real usage: root.resourceService ? root.resourceService.cpuUsage : 0
310 - readonly property var proof: root.resourceService ? root.parseJson(root.resourceService.cpuWidgetState(usage), {
317 + id: systemPanel
319 + readonly property var state: root.resourceService ? Util.parseJson(root.resourceService.systemWidgetState(), {
311 320 }) : ({
312 - "percent": 0,
313 - "signal": "normal",
314 - "colorRole": "ui.accent"
315 - })
316 - readonly property var hero: root.resourceService ? root.parseJson(root.resourceService.resourceHeroCard("cpu", usage, root.resourceService.cpuHistory), {
317 - }) : ({
318 - "boundedHeroMeter": {
321 + "cpu": {
322 + "percent": 0,
323 + "usage": 0
320 - "sparklineSamples": []
325 + "memory": {
326 + "percent": 0,
327 + "usage": 0,
328 + "label": "--"
329 + },
330 + "swap": {
331 + "percent": 0,
332 + "usage": 0,
333 + "label": "off"
336 + readonly property real cpuUsage: root.resourceService ? root.resourceService.cpuUsage : 0
337 + readonly property real memoryUsage: root.resourceService ? root.resourceService.memoryUsage : 0
338 + readonly property real swapUsage: root.resourceService ? root.resourceService.swapUsage : 0
339 + readonly property string memoryLabel: root.resourceService ? `${root.resourceService.formatBytes(Math.max(0, root.resourceService.memTotal - root.resourceService.memAvailable))} / ${root.resourceService.formatBytes(root.resourceService.memTotal)}` : "--"
340 + readonly property string swapLabel: root.resourceService && root.resourceService.swapTotal > 0 ? `${root.resourceService.formatBytes(Math.max(0, root.resourceService.swapTotal - root.resourceService.swapFree))} / ${root.resourceService.formatBytes(root.resourceService.swapTotal)}` : "off"
341 + readonly property string diskLabel: root.resourceService ? `R ${root.resourceService.formatRate(root.resourceService.diskReadRate)} W ${root.resourceService.formatRate(root.resourceService.diskWriteRate)}` : "R 0 B/s W 0 B/s"
342 + readonly property string tempLabel: root.resourceService ? root.resourceService.tempLabel : "n/a"
343 + readonly property color cpuColor: root.theme ? root.theme.ui.accent : "#d86dd8"
344 + readonly property color memoryColor: root.theme ? root.theme.ui.focus : "#9aabae"
345 + readonly property color swapColor: root.theme ? root.theme.warning : "#f0ee69"
346 + readonly property color diskColor: root.theme ? root.theme.ui.minor : "#9d9d9d"
347 + readonly property color tempColor: root.theme ? root.theme.error : "#ec6376"
323 - spacing: 8
349 + spacing: 9
324 350 width: parent ? parent.width : 0
326 - NuguText {
327 - theme: root.theme
328 - variant: "title"
329 - text: `cpu ${parent.proof.percent || 0}%`
332 - NuguText {
333 - theme: root.theme
334 - text: `signal ${parent.proof.signal || "normal"} / ${parent.proof.colorRole || "ui.accent"}`
337 352 ResourceMeter {
338 353 width: parent.width
339 354 height: 72
340 - value: parent.hero.value || 0
341 - sparklineSamples: parent.hero.sparklineSamples || []
342 - meterColor: root.theme ? root.theme.ui.accent : "white"
355 + seriesSamples: root.resourceService ? root.resourceService.systemHistorySamples : []
356 + seriesColors: [parent.cpuColor, parent.memoryColor, parent.swapColor, parent.diskColor, parent.tempColor]
357 + normalizeSeries: true
343 358 trackColor: root.theme ? root.theme.ui.minor : "black"
346 - NuguText {
361 + SystemMetric {
347 362 theme: root.theme
348 - variant: "meta"
349 - text: `${parent.hero.sparkline ? parent.hero.sparkline.sampleCount : 0} samples`
363 + label: "cpu"
364 + valueText: `${Math.round(parent.cpuUsage * 100)}%`
365 + value: parent.cpuUsage
366 + barColor: parent.cpuColor
369 + SystemMetric {
370 + theme: root.theme
371 + label: "memory"
372 + valueText: `${Math.round(parent.memoryUsage * 100)}% · ${parent.memoryLabel}`
373 + value: parent.memoryUsage
374 + barColor: parent.memoryColor
377 + SystemMetric {
378 + theme: root.theme
379 + label: "swap"
380 + valueText: parent.swapLabel === "off" ? "off" : `${Math.round(parent.swapUsage * 100)}% · ${parent.swapLabel}`
381 + value: parent.swapUsage
382 + barColor: parent.swapColor
385 + Row {
386 + objectName: "systemDiskRow"
387 + width: parent.width
388 + spacing: 8
390 + NuguText {
391 + theme: root.theme
392 + text: "disk"
393 + width: 92
396 + NuguText {
397 + theme: root.theme
398 + text: systemPanel.diskLabel
399 + width: parent.width - 100
400 + elide: Text.ElideRight
405 + Row {
406 + objectName: "systemTempRow"
407 + width: parent.width
408 + spacing: 8
410 + NuguText {
411 + theme: root.theme
412 + text: "temp"
413 + width: 92
416 + NuguText {
417 + theme: root.theme
418 + text: systemPanel.tempLabel
419 + width: parent.width - 100
420 + elide: Text.ElideRight
425 + Column {
426 + objectName: "systemProcessTable"
427 + width: parent.width
428 + spacing: 4
430 + Row {
431 + width: parent.width
432 + spacing: 6
434 + NuguText {
435 + theme: root.theme
436 + variant: "meta"
437 + text: "pid"
438 + width: 52
441 + NuguText {
442 + theme: root.theme
443 + variant: "meta"
444 + text: "name"
445 + width: parent.width - 190
448 + NuguText {
449 + theme: root.theme
450 + variant: "meta"
451 + text: "cpu"
452 + width: 48
455 + NuguText {
456 + theme: root.theme
457 + variant: "meta"
458 + text: "mem"
459 + width: 48
464 + Repeater {
465 + model: root.resourceService ? root.resourceService.processes : []
467 + delegate: Row {
468 + required property var modelData
470 + width: parent.width
471 + spacing: 6
473 + NuguText {
474 + theme: root.theme
475 + variant: "meta"
476 + text: String(modelData.pid || 0)
477 + width: 52
480 + NuguText {
481 + theme: root.theme
482 + variant: "meta"
483 + text: String(modelData.name || "?")
484 + width: parent.width - 190
485 + elide: Text.ElideRight
488 + NuguText {
489 + theme: root.theme
490 + variant: "meta"
491 + text: `${Number(modelData.cpu || 0).toFixed(1)}%`
492 + width: 48
495 + NuguText {
496 + theme: root.theme
497 + variant: "meta"
498 + text: `${Number(modelData.mem || 0).toFixed(1)}%`
499 + width: 48
508 + Rectangle {
509 + width: parent.width
510 + height: 28
511 + radius: 9
512 + color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.18) : "transparent"
513 + border.width: 0
514 + border.color: root.theme ? root.theme.ui.accent : "transparent"
516 + Row {
517 + anchors.centerIn: parent
518 + spacing: 6
520 + Text {
521 + text: ""
522 + color: root.theme ? root.theme.content.normal : "white"
523 + font.family: "Symbols Nerd Font Mono"
524 + font.pixelSize: 13
527 + NuguText {
528 + theme: root.theme
529 + variant: "meta"
530 + text: "btm"
535 + MouseArea {
536 + anchors.fill: parent
537 + onClicked: {
538 + if (root.resourceService)
539 + root.resourceService.launchBtm();
378 - Component {
379 - id: windowContent
381 - WindowPanel {
382 - theme: root.theme
383 - niriService: root.niriService
384 - width: parent ? parent.width : 0
389 572 Component {
390 573 id: mediaContent
616 + Component {
617 + id: brightnessContent
619 + BrightnessPanel {
620 + theme: root.theme
621 + brightnessService: root.brightnessService
622 + width: parent ? parent.width : 0
433 627 Component {
434 628 id: connectivityContent
436 630 ConnectivityPanel {
437 631 theme: root.theme
632 + resourceService: root.resourceService
438 633 networkService: root.networkService
439 634 bluetoothService: root.bluetoothService
440 635 width: parent ? parent.width : 0
456 - Component {
457 - id: screenshotsContent
459 - ScreenshotsPanel {
460 - theme: root.theme
461 - screenshotsService: root.screenshotsService
462 - width: parent ? parent.width : 0
467 651 Component {
468 652 id: idleContent
478 - Component {
479 - id: diagnosticsContent
481 - DiagnosticsPanel {
482 - theme: root.theme
483 - diagnosticsService: root.diagnosticsService
484 - lockService: root.lockService
485 - width: parent ? parent.width : 0
490 663 Component {
491 664 id: helpContent
497 670 NuguText {
498 671 theme: root.theme
499 - variant: "title"
500 - text: "bar-owned host"
503 - NuguText {
504 - theme: root.theme
505 - text: "widgets register geometry; PopoutHost owns placement, loader lifetime, and service-backed content."
672 + text: "no popout content."
506 673 width: parent.width
507 674 wrapMode: Text.WordWrap
681 + mask: Region {
682 + item: popoutInputRegion
514 685 component NuguText: Text {
515 686 required property QtObject theme
516 687 property string variant: "body"
523 694 elide: Text.ElideRight
526 - mask: Region {
527 - item: card
530 - Behavior on width {
697 + Behavior on implicitWidth {
531 698 NumberAnimation {
532 - duration: 180
699 + duration: root.theme && root.theme.lowPowerMode ? 0 : 180
533 700 easing.type: Easing.OutCubic
538 - Behavior on height {
705 + Behavior on implicitHeight {
539 706 NumberAnimation {
540 - duration: 180
707 + duration: root.theme && root.theme.lowPowerMode ? 0 : 180
541 708 easing.type: Easing.OutCubic
546 713 component ResourceMeter: Canvas {
547 714 id: meter
549 - property real value: 0
550 - property var sparklineSamples: []
551 - property color meterColor: "#ffffff"
716 + property var seriesSamples: []
717 + property var seriesColors: []
718 + property bool normalizeSeries: false
552 719 property color trackColor: "#000000"
553 - property real fillOpacity: 0.22
554 - readonly property bool boundedHeroMeter: true
720 + property real graphBlend: 1
721 + property var previousSeriesSamples: []
722 + property var currentSeriesSamples: []
556 724 function clamp01(n) {
557 725 return Math.max(0, Math.min(1, Number(n)));
560 - onValueChanged: requestPaint()
561 - onSparklineSamplesChanged: requestPaint()
562 - onMeterColorChanged: requestPaint()
728 + function sampleValue(sample, index) {
729 + if (Array.isArray(sample))
730 + return clamp01(sample[index] || 0);
732 + return index === 0 ? clamp01(sample) : 0;
735 + function normalizedSampleValue(sample, index) {
736 + const value = sampleValue(sample, index);
737 + if (!normalizeSeries)
738 + return value;
740 + const samples = seriesSamples || [];
741 + let low = 1;
742 + let high = 0;
743 + for (let i = 0; i < samples.length; i++) {
744 + const candidate = sampleValue(samples[i], index);
745 + low = Math.min(low, candidate);
746 + high = Math.max(high, candidate);
748 + const span = high - low;
749 + return span < 0.0001 ? 0.5 : (value - low) / span;
752 + function interpolatedSampleValue(samples, sampleIndex, series) {
753 + const current = normalizedSampleValue(samples[sampleIndex], series);
754 + if (graphBlend >= 1 || previousSeriesSamples.length === 0)
755 + return current;
757 + const previousIndex = Math.max(0, previousSeriesSamples.length - samples.length + sampleIndex);
758 + const previous = normalizedSampleValue(previousSeriesSamples[previousIndex] || samples[sampleIndex], series);
759 + return previous + (current - previous) * graphBlend;
762 + onGraphBlendChanged: requestPaint()
763 + onSeriesSamplesChanged: {
764 + previousSeriesSamples = currentSeriesSamples.length > 0 ? currentSeriesSamples : seriesSamples;
765 + currentSeriesSamples = seriesSamples;
766 + graphBlend = 0;
767 + graphAnimation.restart();
768 + requestPaint();
770 + onSeriesColorsChanged: requestPaint()
771 + onNormalizeSeriesChanged: requestPaint()
563 772 onTrackColorChanged: requestPaint()
564 773 onWidthChanged: requestPaint()
565 774 onHeightChanged: requestPaint()
570 779 return ;
572 781 ctx.fillStyle = trackColor;
573 - ctx.globalAlpha = 0.35;
574 - ctx.fillRect(0, height - 4, width, 4);
782 + ctx.globalAlpha = 0.18;
783 + const seriesCount = Math.max(1, seriesColors.length || 1);
784 + for (let row = 1; row < seriesCount; row++) ctx.fillRect(0, Math.round(row * height / seriesCount), width, 1)
575 785 ctx.globalAlpha = 1;
576 - const bounded = clamp01(value);
577 - ctx.fillStyle = meterColor;
578 - ctx.fillRect(0, height - 4, width * bounded, 4);
579 - const samples = sparklineSamples || [];
786 + const samples = seriesSamples || [];
580 787 if (samples.length < 2)
581 788 return ;
583 - const dx = width / (samples.length - 1);
584 - ctx.beginPath();
585 - for (let i = 0; i < samples.length; i++) {
586 - const x = i * dx;
587 - const y = Math.round((height - 8) - clamp01(samples[i]) * (height - 14));
588 - if (i === 0)
589 - ctx.moveTo(x, y);
590 - else
591 - ctx.lineTo(x, y);
790 + const dx = width / Math.max(samples.length - 1, 1);
791 + for (let series = 0; series < seriesCount; series++) {
792 + const laneTop = 4 + series * ((height - 8) / seriesCount);
793 + const laneSpan = (height - 12) / seriesCount;
794 + ctx.beginPath();
795 + let previousX = 0;
796 + let previousY = Math.round(laneTop + laneSpan - interpolatedSampleValue(samples, 0, series) * laneSpan);
797 + ctx.moveTo(previousX, previousY);
798 + for (let i = 1; i < samples.length; i++) {
799 + const x = i * dx;
800 + const y = Math.round(laneTop + laneSpan - interpolatedSampleValue(samples, i, series) * laneSpan);
801 + const midX = (previousX + x) * 0.5;
802 + const midY = (previousY + y) * 0.5;
803 + ctx.quadraticCurveTo(previousX, previousY, midX, midY);
804 + previousX = x;
805 + previousY = y;
807 + ctx.lineTo(previousX, previousY);
808 + ctx.strokeStyle = String(seriesColors[series] || "#ffffff");
809 + ctx.lineWidth = series === 0 ? 2.4 : 1.8;
810 + ctx.stroke();
593 - ctx.strokeStyle = meterColor;
594 - ctx.lineWidth = 2;
595 - ctx.stroke();
596 - ctx.lineTo(width, height - 4);
597 - ctx.lineTo(0, height - 4);
598 - ctx.closePath();
599 - ctx.globalAlpha = fillOpacity;
600 - ctx.fillStyle = meterColor;
601 - ctx.fill();
602 - ctx.globalAlpha = 1;
814 + NumberAnimation on graphBlend {
815 + id: graphAnimation
817 + running: false
818 + from: 0
819 + to: 1
820 + duration: 320
821 + easing.type: Easing.OutCubic
826 + component SystemMetric: Column {
827 + id: metric
829 + required property QtObject theme
830 + property string label: ""
831 + property string valueText: ""
832 + property real value: 0
833 + property color barColor: theme ? theme.ui.accent : "white"
835 + width: parent ? parent.width : 0
836 + spacing: 3
838 + Row {
839 + width: parent.width
840 + spacing: 8
842 + NuguText {
843 + theme: metric.theme
844 + text: metric.label
845 + width: 92
848 + NuguText {
849 + theme: metric.theme
850 + text: metric.valueText
855 + Rectangle {
856 + width: parent.width
857 + height: 4
858 + radius: 2
859 + color: metric.theme ? metric.theme.ui.minor : "black"
861 + Rectangle {
862 + width: parent.width * Math.max(0, Math.min(1, metric.value))
863 + height: parent.height
864 + radius: parent.radius
865 + color: metric.barColor
867 + Behavior on width {
868 + NumberAnimation {
869 + duration: metric.theme && metric.theme.lowPowerMode ? 0 : 180
870 + easing.type: Easing.OutCubic
606 881 component LauncherPanel: Column {
609 884 required property QtObject theme
610 885 required property QtObject launcherService
611 886 property string query: ""
612 - property var state: launcherService ? parseJson(launcherService.search(query), {
887 + property var state: launcherService ? Util.parseJson(launcherService.search(query), {
613 888 "results": [],
614 889 "selectedIndex": -1,
615 890 "launcherPanelContract": {
637 912 readonly property var panel: state.launcherPanelContract || ({
639 - readonly property string source: "Nuguland launcher Content.qml AppList.qml ActionItem.qml plus Nuguland SearchResults.qml ResultPreview plus Nuguland LaunchContent.qml"
640 - readonly property bool fullLauncherSurface: true
641 - readonly property bool searchFieldDockedBottom: true
642 - readonly property bool singleResultList: true
643 - readonly property bool sidePreviewPanel: true
644 - readonly property bool keyboardNavigation: true
645 - readonly property bool providerChips: true
646 - readonly property bool serviceFedOnly: true
648 - function parseJson(text, valueWhenInvalid) {
649 - try {
650 - return JSON.parse(String(text));
651 - } catch (error) {
652 - return valueWhenInvalid;
656 916 function refresh() {
657 917 if (launcherService)
658 - state = parseJson(launcherService.search(query), state);
918 + state = Util.parseJson(launcherService.search(query), state);
669 929 const next = Object.assign({
670 930 }, state);
671 931 next.selectedIndex = i;
672 - next.scrollableListChrome = launcherService ? parseJson(launcherService.scrollableListChrome(results.length, i), next.scrollableListChrome || {
932 + next.scrollableListChrome = launcherService ? Util.parseJson(launcherService.scrollableListChrome(results.length, i), next.scrollableListChrome || {
673 933 }) : next.scrollableListChrome;
674 - next.launcherPreviewPanel = launcherService ? parseJson(launcherService.launcherPreviewPanel(results[i]), next.launcherPreviewPanel || {
934 + next.launcherPreviewPanel = launcherService ? Util.parseJson(launcherService.launcherPreviewPanel(results[i]), next.launcherPreviewPanel || {
675 935 }) : next.launcherPreviewPanel;
676 936 state = next;
722 - NuguText {
723 - theme: root.theme
724 - variant: "meta"
725 - text: "Search apps, windows, actions, clipboard, and calculations"
726 - width: root.width
727 - wrapMode: Text.WordWrap
731 983 width: parent.width
732 984 spacing: 10
753 1005 height: 24
754 1006 radius: 12
755 1007 color: root.theme ? root.theme.withAlpha(root.state.providerIntent === chip.modelData ? root.theme.ui.focus : root.theme.ui.minor, root.state.providerIntent === chip.modelData ? 0.18 : 0.08) : "transparent"
756 - border.width: 1
1008 + border.width: 0
757 1009 border.color: root.theme ? (root.state.providerIntent === chip.modelData ? root.theme.ui.focus : root.theme.ui.minor) : "transparent"
759 1011 NuguText {
785 1037 height: 44
786 1038 radius: 12
787 1039 color: root.theme ? root.theme.withAlpha(index === root.state.selectedIndex ? root.theme.ui.focus : root.providerColor(row.modelData.provider), index === root.state.selectedIndex ? 0.18 : 0.08) : "transparent"
788 - border.width: 1
1040 + border.width: 0
789 1041 border.color: index === root.state.selectedIndex && root.theme ? root.theme.ui.focus : root.providerColor(row.modelData.provider)
791 1043 Rectangle {
796 1048 height: 28
797 1049 radius: 9
798 1050 color: root.theme ? root.theme.withAlpha(root.providerColor(row.modelData.provider), 0.18) : "transparent"
799 - border.width: 1
1051 + border.width: 0
800 1052 border.color: root.providerColor(row.modelData.provider)
802 1054 NuguText {
856 1108 height: 266
857 1109 radius: 15
858 1110 color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.9) : "transparent"
859 - border.width: 1
1111 + border.width: 0
860 1112 border.color: root.theme ? root.theme.ui.accent : "transparent"
862 1114 Column {
869 1121 height: 58
870 1122 radius: 18
871 1123 color: root.theme ? root.theme.withAlpha(root.providerColor(root.preview.provider || root.selected.provider), 0.2) : "transparent"
872 - border.width: 1
1124 + border.width: 0
873 1125 border.color: root.providerColor(root.preview.provider || root.selected.provider)
875 1127 NuguText {
912 1164 height: 30
913 1165 radius: 9
914 1166 color: root.theme ? root.theme.withAlpha(modelData.primaryAction ? root.theme.ui.focus : root.theme.ui.minor, modelData.primaryAction ? 0.16 : 0.08) : "transparent"
915 - border.width: 1
1167 + border.width: 0
916 1168 border.color: root.theme ? (modelData.primaryAction ? root.theme.ui.focus : root.theme.ui.minor) : "transparent"
918 1170 NuguText {
943 1195 height: 42
944 1196 radius: 21
945 1197 color: root.theme ? root.theme.withAlpha(root.theme.ui.focus, 0.14) : "transparent"
946 - border.width: 1
1198 + border.width: 0
947 1199 border.color: root.theme ? root.theme.ui.focus : "transparent"
949 1201 NuguText {
994 1246 elide: Text.ElideRight
997 - MouseArea {
998 - anchors.fill: parent
999 - z: 1000
1000 - acceptedButtons: Qt.NoButton
1001 - onWheel: (wheel) => {
1002 - wheel.accepted = true;
1003 - root.wheelSelect(wheel.angleDelta.y);
1009 1251 component NotificationGroup: Column {
1012 1254 required property QtObject theme
1013 1255 required property QtObject notificationService
1014 - property var state: notificationService ? parseJson(notificationService.stateJson(), {
1256 + property var state: notificationService ? Util.parseJson(notificationService.stateJson(), {
1015 1257 "groups": [],
1016 1258 "notificationPanelContract": {
1023 1265 readonly property var groups: state.groups || []
1024 1266 readonly property var panel: state.notificationPanelContract || ({
1026 - readonly property string source: "Nuguland NotifGroup.qml NotifGroupList.qml NotifActionList.qml"
1027 - readonly property bool groupedCardPanel: true
1028 - readonly property bool appMediaSlot: true
1029 - readonly property bool expandPill: true
1030 - readonly property bool maskedHorizontalActionRail: true
1031 - readonly property bool animatedExpandHeight: true
1033 - function parseJson(text, valueWhenInvalid) {
1034 - try {
1035 - return JSON.parse(String(text));
1036 - } catch (error) {
1037 - return valueWhenInvalid;
1041 1270 function roleColor(role) {
1042 1271 if (!theme)
1054 1283 function runAction(notificationId, actionId) {
1055 1284 if (notificationService)
1056 - state = parseJson(notificationService.runAction(notificationId, actionId), state);
1285 + state = Util.parseJson(notificationService.runAction(notificationId, actionId), state);
1060 1289 function toggleGroup(appName) {
1061 1290 if (notificationService)
1062 - state = parseJson(notificationService.toggleGroup(appName), state);
1291 + state = Util.parseJson(notificationService.toggleGroup(appName), state);
1066 1295 function dragNotification(notificationId, deltaX, rowWidth) {
1067 1296 if (notificationService)
1068 - state = parseJson(notificationService.dragNotification(notificationId, deltaX, rowWidth), state);
1297 + state = Util.parseJson(notificationService.dragNotification(notificationId, deltaX, rowWidth), state);
1078 1307 spacing: 8
1079 1308 width: parent ? parent.width : 0
1081 - NuguText {
1082 - theme: root.theme
1083 - variant: "meta"
1084 - text: "Grouped notifications with direct actions"
1085 - width: root.width
1086 - wrapMode: Text.WordWrap
1089 1310 Repeater {
1090 1311 model: root.groups
1100 1321 implicitHeight: groupColumn.implicitHeight + 16
1101 1322 radius: 12
1102 1323 color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.12) : "transparent"
1103 - border.width: 1
1324 + border.width: 0
1104 1325 border.color: root.roleColor(modelData.urgency)
1105 1326 clip: true
1161 1382 height: 24
1162 1383 radius: 12
1163 1384 color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.22) : "transparent"
1164 - border.width: 1
1385 + border.width: 0
1165 1386 border.color: root.theme ? root.theme.ui.accent : "transparent"
1167 1388 NuguText {
1196 1417 radius: 10
1198 1419 color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.82) : "transparent"
1199 - border.width: 1
1420 + border.width: 0
1200 1421 border.color: root.theme ? root.theme.ui.minor : "transparent"
1201 1422 clip: true
1277 1498 width: Math.max(58, actionText.implicitWidth + 18)
1278 1499 radius: 8
1279 1500 color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.16) : "transparent"
1280 - border.width: 1
1501 + border.width: 0
1281 1502 border.color: root.theme ? root.theme.ui.accent : "transparent"
1283 1504 NuguText {
1363 1584 Behavior on implicitHeight {
1364 1585 NumberAnimation {
1365 - duration: 180
1586 + duration: root.theme && root.theme.lowPowerMode ? 0 : 180
1366 1587 easing.type: Easing.OutCubic
1419 1640 target: translation
1420 1641 property: "x"
1421 1642 to: shakeRoot.shakeOffsets[1]
1422 - duration: 50
1643 + duration: root.theme && root.theme.lowPowerMode ? 0 : 50
1423 1644 easing.type: Easing.OutCubic
1427 1648 target: translation
1428 1649 property: "x"
1429 1650 to: shakeRoot.shakeOffsets[2]
1430 - duration: 50
1651 + duration: root.theme && root.theme.lowPowerMode ? 0 : 50
1431 1652 easing.type: Easing.OutCubic
1435 1656 target: translation
1436 1657 property: "x"
1437 1658 to: shakeRoot.shakeOffsets[3]
1438 - duration: 40
1659 + duration: root.theme && root.theme.lowPowerMode ? 0 : 40
1439 1660 easing.type: Easing.OutCubic
1443 1664 target: translation
1444 1665 property: "x"
1445 1666 to: shakeRoot.shakeOffsets[4]
1446 - duration: 40
1667 + duration: root.theme && root.theme.lowPowerMode ? 0 : 40
1447 1668 easing.type: Easing.OutCubic
1451 1672 target: translation
1452 1673 property: "x"
1453 1674 to: shakeRoot.shakeOffsets[5]
1454 - duration: 30
1675 + duration: root.theme && root.theme.lowPowerMode ? 0 : 30
1455 1676 easing.type: Easing.OutCubic
1471 1692 required property QtObject theme
1472 1693 required property QtObject idleService
1473 - property var state: idleService ? parseJson(idleService.stateJson(), {
1694 + property var state: idleService ? Util.parseJson(idleService.stateJson(), {
1474 1695 "active": false,
1475 1696 "reason": "",
1476 1697 "remainingSeconds": 0,
1486 1707 readonly property var panel: state.idlePanelContract || ({
1488 - readonly property string source: "Nuguland IdleInhibit.qml plus Nuguland Privacy.qml"
1489 - readonly property bool serviceFedOnly: true
1491 - function parseJson(text, valueWhenInvalid) {
1492 - try {
1493 - return JSON.parse(String(text));
1494 - } catch (error) {
1495 - return valueWhenInvalid;
1499 1711 spacing: 8
1500 1712 width: parent ? parent.width : 0
1514 1726 elide: Text.ElideRight
1517 - NuguText {
1518 - theme: root.theme
1519 - variant: "meta"
1520 - text: "Keep-awake controls"
1521 - width: parent.width
1522 - wrapMode: Text.WordWrap
1526 1730 width: parent.width
1527 1731 spacing: 8
1536 1740 height: 34
1537 1741 radius: 10
1538 1742 color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.12) : "transparent"
1539 - border.width: 1
1743 + border.width: 0
1540 1744 border.color: root.theme ? root.theme.ui.accent : "transparent"
1542 1746 NuguText {
1550 1754 anchors.fill: parent
1551 1755 onClicked: {
1552 1756 if (root.idleService)
1553 - root.state = root.parseJson(root.idleService.toggle(parent.modelData, "manual"), root.state);
1757 + root.state = Util.parseJson(root.idleService.toggle(parent.modelData, "manual"), root.state);
1566 - component DiagnosticsPanel: Column {
1567 - id: root
1569 - required property QtObject theme
1570 - required property QtObject diagnosticsService
1571 - required property QtObject lockService
1572 - property var state: diagnosticsService ? parseJson(diagnosticsService.stateJson(), {
1573 - "serviceHealth": {
1574 - },
1575 - "referenceRuntimeContracts": {
1576 - },
1577 - "diagnosticsPanelContract": {
1578 - },
1579 - "cleanup": {
1580 - },
1581 - "processPolicy": {
1582 - },
1583 - "anchors": {
1584 - },
1585 - "surfaceState": {
1587 - }) : ({
1588 - "serviceHealth": {
1589 - },
1590 - "referenceRuntimeContracts": {
1591 - },
1592 - "diagnosticsPanelContract": {
1593 - },
1594 - "cleanup": {
1595 - },
1596 - "processPolicy": {
1597 - },
1598 - "anchors": {
1599 - },
1600 - "surfaceState": {
1602 - })
1603 - property var lockState: lockService ? parseJson(lockService.stateJson(), {
1604 - }) : ({
1605 - })
1606 - readonly property var panel: state.diagnosticsPanelContract || ({
1607 - })
1608 - readonly property var services: serviceRows(state.serviceHealth || ({
1609 - }))
1610 - readonly property var contracts: contractRows(state.referenceRuntimeContracts || ({
1611 - }))
1612 - readonly property var anchorsModel: anchorRows(state.anchors || ({
1613 - }))
1614 - readonly property string source: "Nuguland ContentPage.qml plus Nuguland NavigationRail.qml plus Nuguland SlideView.qml"
1615 - readonly property bool nativeHealthConsole: true
1616 - readonly property bool serviceStatusGrid: true
1617 - readonly property bool referenceContractRail: true
1618 - readonly property bool cleanupProcessCard: true
1619 - readonly property bool surfaceAnchorMap: true
1620 - readonly property bool failureShakeSlot: true
1622 - function parseJson(text, valueWhenInvalid) {
1623 - try {
1624 - return JSON.parse(String(text));
1625 - } catch (error) {
1626 - return valueWhenInvalid;
1630 - function serviceRows(health) {
1631 - const names = Object.keys(health).sort();
1632 - return names.map((name) => {
1633 - const item = health[name] || {
1634 - };
1635 - return {
1636 - "name": name,
1637 - "component": item.component || name,
1638 - "ready": !!item.ready || !!item.available || !!item.eventStreamReady,
1639 - "status": item.available === false ? "offline" : (item.ready === false ? "missing" : "ready")
1640 - };
1641 - });
1644 - function contractRows(contracts) {
1645 - const names = Object.keys(contracts).sort();
1646 - return names.map((name) => {
1647 - return ({
1648 - "name": name,
1649 - "source": contracts[name] ? contracts[name].source || "runtime" : "runtime"
1650 - });
1651 - });
1654 - function anchorRows(anchors) {
1655 - const names = Object.keys(anchors).sort();
1656 - return names.map((name) => {
1657 - const rect = anchors[name] || {
1658 - };
1659 - return {
1660 - "name": name,
1661 - "rect": `${Math.round(rect.x || 0)},${Math.round(rect.y || 0)} ${Math.round(rect.width || 0)}×${Math.round(rect.height || 0)}`
1662 - };
1663 - });
1666 - function cardColor(ok) {
1667 - if (!theme)
1668 - return "transparent";
1670 - return theme.withAlpha(ok ? theme.ui.accent : theme.warning, ok ? 0.12 : 0.18);
1673 - function cardBorder(ok) {
1674 - if (!theme)
1675 - return "transparent";
1677 - return ok ? theme.ui.accent : theme.warning;
1680 - spacing: 10
1681 - width: parent ? parent.width : 0
1683 - NuguText {
1684 - theme: root.theme
1685 - variant: "meta"
1686 - text: "Nuguland health"
1687 - width: root.width
1688 - wrapMode: Text.WordWrap
1691 - Grid {
1692 - objectName: "serviceStatusGrid"
1693 - width: parent.width
1694 - columns: 3
1695 - columnSpacing: 6
1696 - rowSpacing: 6
1698 - Repeater {
1699 - model: root.services.slice(0, 18)
1701 - delegate: Rectangle {
1702 - id: serviceCell
1704 - required property var modelData
1706 - width: Math.floor((root.width - 12) / 3)
1707 - height: 38
1708 - radius: 10
1709 - color: root.cardColor(serviceCell.modelData.ready)
1710 - border.width: 1
1711 - border.color: root.cardBorder(serviceCell.modelData.ready)
1713 - NuguText {
1714 - anchors.left: parent.left
1715 - anchors.leftMargin: 7
1716 - anchors.right: parent.right
1717 - anchors.rightMargin: 7
1718 - anchors.top: parent.top
1719 - anchors.topMargin: 5
1720 - theme: root.theme
1721 - variant: "meta"
1722 - selected: serviceCell.modelData.ready
1723 - text: serviceCell.modelData.name
1724 - elide: Text.ElideRight
1727 - NuguText {
1728 - anchors.left: parent.left
1729 - anchors.leftMargin: 7
1730 - anchors.right: parent.right
1731 - anchors.rightMargin: 7
1732 - anchors.bottom: parent.bottom
1733 - anchors.bottomMargin: 4
1734 - theme: root.theme
1735 - variant: "meta"
1736 - text: serviceCell.modelData.status
1737 - opacity: 0.75
1738 - elide: Text.ElideRight
1747 - Row {
1748 - width: parent.width
1749 - spacing: 8
1751 - Rectangle {
1752 - objectName: "cleanupProcessCard"
1753 - width: Math.floor((root.width - 8) * 0.48)
1754 - height: 70
1755 - radius: 13
1756 - color: root.theme ? root.theme.withAlpha(root.theme.ui.focus, 0.14) : "transparent"
1757 - border.width: 1
1758 - border.color: root.theme ? root.theme.ui.focus : "transparent"
1760 - Column {
1761 - anchors.fill: parent
1762 - anchors.margins: 8
1763 - spacing: 4
1765 - NuguText {
1766 - theme: root.theme
1767 - variant: "title"
1768 - text: "cleanup"
1769 - width: parent.width
1770 - elide: Text.ElideRight
1773 - NuguText {
1774 - theme: root.theme
1775 - variant: "meta"
1776 - text: root.state.cleanup && root.state.cleanup.zeroLeftoversRequired ? "zero leftovers required" : "cleanup contract missing"
1777 - width: parent.width
1778 - elide: Text.ElideRight
1781 - NuguText {
1782 - theme: root.theme
1783 - variant: "meta"
1784 - text: root.state.processPolicy ? `widgets: ${root.state.processPolicy.widgetProcesses}` : "widgets: forbidden"
1785 - width: parent.width
1786 - elide: Text.ElideRight
1793 - Rectangle {
1794 - objectName: "surfaceAnchorMap"
1795 - width: root.width - parent.children[0].width - 8
1796 - height: 70
1797 - radius: 13
1798 - color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.12) : "transparent"
1799 - border.width: 1
1800 - border.color: root.theme ? root.theme.ui.accent : "transparent"
1802 - Column {
1803 - anchors.fill: parent
1804 - anchors.margins: 8
1805 - spacing: 4
1807 - NuguText {
1808 - theme: root.theme
1809 - variant: "title"
1810 - text: "surfaces"
1811 - width: parent.width
1812 - elide: Text.ElideRight
1815 - NuguText {
1816 - theme: root.theme
1817 - variant: "meta"
1818 - text: `${root.anchorsModel.length} anchors · ${root.state.surfaceState ? root.state.surfaceState.phase || "closed" : "closed"}`
1819 - width: parent.width
1820 - elide: Text.ElideRight
1823 - NuguText {
1824 - theme: root.theme
1825 - variant: "meta"
1826 - text: root.state.surfaceState && root.state.surfaceState.name ? root.state.surfaceState.name : "bar-owned popouts"
1827 - width: parent.width
1828 - elide: Text.ElideRight
1837 - Column {
1838 - objectName: "referenceContractRail"
1839 - width: parent.width
1840 - spacing: 5
1842 - Repeater {
1843 - model: root.contracts.slice(0, 6)
1845 - delegate: Rectangle {
1846 - id: contractRow
1848 - required property var modelData
1850 - width: root.width
1851 - height: 28
1852 - radius: 9
1853 - color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.08) : "transparent"
1854 - border.width: 1
1855 - border.color: root.theme ? root.theme.ui.minor : "transparent"
1857 - NuguText {
1858 - anchors.left: parent.left
1859 - anchors.leftMargin: 8
1860 - anchors.verticalCenter: parent.verticalCenter
1861 - theme: root.theme
1862 - variant: "meta"
1863 - selected: true
1864 - text: contractRow.modelData.name
1865 - width: 128
1866 - elide: Text.ElideRight
1869 - NuguText {
1870 - anchors.left: parent.left
1871 - anchors.leftMargin: 142
1872 - anchors.right: parent.right
1873 - anchors.rightMargin: 8
1874 - anchors.verticalCenter: parent.verticalCenter
1875 - theme: root.theme
1876 - variant: "meta"
1877 - text: contractRow.modelData.source
1878 - elide: Text.ElideRight
1887 - FailureShake {
1888 - objectName: "failureShakeSlot"
1889 - active: root.lockState.failure && root.lockState.failure.length > 0
1890 - width: parent.width
1892 - Rectangle {
1893 - width: root.width
1894 - height: 30
1895 - radius: 10
1896 - color: root.theme ? root.theme.withAlpha(root.lockState.failure ? root.theme.error : root.theme.ui.minor, root.lockState.failure ? 0.18 : 0.08) : "transparent"
1897 - border.width: 1
1898 - border.color: root.theme ? (root.lockState.failure ? root.theme.error : root.theme.ui.minor) : "transparent"
1900 - NuguText {
1901 - anchors.left: parent.left
1902 - anchors.right: parent.right
1903 - anchors.leftMargin: 8
1904 - anchors.rightMargin: 8
1905 - anchors.verticalCenter: parent.verticalCenter
1906 - theme: root.theme
1907 - variant: "meta"
1908 - text: root.lockState.failure || "failure feedback armed"
1909 - elide: Text.ElideRight
1918 1770 component ClipboardPanel: Column {
1919 1771 id: root
1921 1773 required property QtObject theme
1922 1774 required property QtObject clipboardService
1923 1775 property string query: ""
1924 - property var state: clipboardService ? parseJson(clipboardService.stateJson(), {
1776 + property var state: clipboardService ? Util.parseJson(clipboardService.stateJson(), {
1925 1777 "rows": [],
1926 1778 "clipboardPanelContract": {
1937 1789 readonly property var rows: state.rows || []
1938 1790 readonly property var panel: state.clipboardPanelContract || ({
1940 - readonly property string source: "Nuguland ClipWrapper.qml plus Nuguland Cliphist.qml ScrollEdgeFade.qml"
1941 - readonly property bool clipboardHistoryPanel: true
1942 - readonly property bool privateModeChip: true
1943 - readonly property bool searchField: true
1944 - readonly property bool pinnedFirstRows: true
1945 - readonly property bool maskedActionRail: true
1946 - readonly property bool launcherRowParity: true
1948 - function parseJson(text, valueWhenInvalid) {
1949 - try {
1950 - return JSON.parse(String(text));
1951 - } catch (error) {
1952 - return valueWhenInvalid;
1956 1794 function refreshFrom(text) {
1957 - state = parseJson(text, state);
1795 + state = Util.parseJson(text, state);
1960 1798 function search(text) {
1997 1835 spacing: 10
1998 1836 width: parent ? parent.width : 0
2000 - NuguText {
2001 - theme: root.theme
2002 - variant: "meta"
2003 - text: "Clipboard history"
2004 - width: root.width
2005 - wrapMode: Text.WordWrap
2009 1839 width: parent.width
2010 1840 spacing: 8
2015 1845 height: 30
2016 1846 radius: 10
2017 1847 color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.14) : "transparent"
2018 - border.width: 1
1848 + border.width: 0
2019 1849 border.color: root.theme ? root.theme.ui.accent : "transparent"
2021 1851 TextInput {
2053 1883 height: 30
2054 1884 radius: 10
2055 1885 color: root.theme ? root.theme.withAlpha(root.state.privateMode ? root.theme.warning : root.theme.ui.accent, 0.2) : "transparent"
2056 - border.width: 1
1886 + border.width: 0
2057 1887 border.color: root.theme ? (root.state.privateMode ? root.theme.warning : root.theme.ui.accent) : "transparent"
2059 1889 NuguText {
2080 1910 radius: 14
2081 1911 clip: true
2082 1912 color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.7) : "transparent"
2083 - border.width: 1
1913 + border.width: 0
2084 1914 border.color: root.theme ? root.theme.ui.accent : "transparent"
2086 1916 Flickable {
2110 1940 height: 50
2111 1941 radius: 11
2112 1942 color: root.theme ? root.theme.withAlpha(modelData.pinned ? root.theme.ui.focus : root.theme.ui.minor, modelData.pinned ? 0.24 : 0.1) : "transparent"
2113 - border.width: 1
1943 + border.width: 0
2114 1944 border.color: root.theme ? (modelData.pinned ? root.theme.ui.focus : root.theme.ui.accent) : "transparent"
2116 1946 Column {
2158 1988 height: 26
2159 1989 radius: 9
2160 1990 color: root.theme ? root.theme.withAlpha(actionButton.modelData === "delete" ? root.theme.error : root.theme.ui.accent, 0.16) : "transparent"
2161 - border.width: 1
1991 + border.width: 0
2162 1992 border.color: root.theme ? (actionButton.modelData === "delete" ? root.theme.error : root.theme.ui.accent) : "transparent"
2164 1994 NuguText {
2246 - NuguText {
2247 - theme: root.theme
2248 - variant: "meta"
2249 - text: `rows=${root.rows.length} pinned=${root.state.pinnedCount || 0} scrollEdgeFade=${root.state.scrollableListChrome ? root.state.scrollableListChrome.scrollEdgeFade : false}`
2250 - width: parent.width
2251 - elide: Text.ElideRight
2078 + component BrightnessPanel: Column {
2079 + id: root
2081 + required property QtObject theme
2082 + required property QtObject brightnessService
2083 + property var state: brightnessService ? Util.parseJson(brightnessService.stateJson(), {
2084 + "level": 0,
2085 + "compact": {
2086 + "label": "Bright"
2087 + },
2088 + "shader": {
2090 + }) : ({
2091 + "level": 0,
2092 + "compact": {
2093 + "label": "Bright"
2094 + },
2095 + "shader": {
2097 + })
2099 + spacing: 12
2100 + padding: 14
2102 + Rectangle {
2103 + width: Math.max(1, root.width - 28)
2104 + height: 36
2105 + radius: 10
2106 + color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.88) : "#242424"
2107 + border.width: 0
2108 + border.color: root.theme ? root.theme.ui.accent : "white"
2110 + Rectangle {
2111 + anchors.left: parent.left
2112 + anchors.top: parent.top
2113 + anchors.bottom: parent.bottom
2114 + width: parent.width * Math.max(0, Math.min(1, Number(root.state.level || 0)))
2115 + radius: parent.radius
2116 + color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.55) : "white"
2119 + Text {
2120 + anchors.centerIn: parent
2121 + text: `${Math.round(Number(root.state.level || 0) * 100)}%`
2122 + color: root.theme ? root.theme.content.normal : "white"
2123 + font.family: "IBM Plex Mono"
2124 + font.pixelSize: 14
2129 + Row {
2130 + spacing: 8
2132 + Repeater {
2133 + model: [0.25, 0.5, 0.75, 1]
2135 + delegate: Rectangle {
2136 + width: 88
2137 + height: 30
2138 + radius: 8
2139 + color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.18) : "#333333"
2140 + border.width: 0
2141 + border.color: root.theme ? root.theme.ui.focus : "white"
2143 + Text {
2144 + anchors.centerIn: parent
2145 + text: `${Math.round(modelData * 100)}%`
2146 + color: root.theme ? root.theme.content.normal : "white"
2147 + font.family: "IBM Plex Sans"
2148 + font.pixelSize: 13
2151 + MouseArea {
2152 + anchors.fill: parent
2153 + onClicked: root.brightnessService.setLevel(modelData)
2257 2165 id: root
2259 2167 required property QtObject theme
2168 + required property QtObject resourceService
2260 2169 required property QtObject networkService
2261 2170 required property QtObject bluetoothService
2262 - property var networkState: networkService ? parseJson(networkService.stateJson(), {
2171 + property var networkState: networkService ? Util.parseJson(networkService.stateJson(), {
2263 2172 "knownNetworks": [],
2264 2173 "connectivityPanelContract": {
2272 2181 "wifi": {
2275 - property var bluetoothState: bluetoothService ? parseJson(bluetoothService.stateJson(), {
2184 + property var bluetoothState: bluetoothService ? Util.parseJson(bluetoothService.stateJson(), {
2276 2185 "devices": [],
2277 2186 "adapter": {
2284 2193 readonly property var panel: networkState.connectivityPanelContract || ({
2286 - readonly property string source: "Nuguland bar popouts Network.qml plus Nuguland connections Network.qml Bluetooth.qml"
2287 - readonly property bool combinedConnectivityPanel: true
2288 - readonly property bool wifiToggleScanList: true
2289 - readonly property bool bluetoothToggleScanList: true
2290 - readonly property bool sortedNetworkRows: true
2291 - readonly property bool sortedDeviceRows: true
2292 - readonly property bool batteryBadges: true
2293 - readonly property bool serviceActionsOnly: true
2295 - function parseJson(text, valueWhenInvalid) {
2296 - try {
2297 - return JSON.parse(String(text));
2298 - } catch (error) {
2299 - return valueWhenInvalid;
2303 2197 function refreshNetwork(text) {
2304 - networkState = parseJson(text, networkState);
2198 + networkState = Util.parseJson(text, networkState);
2307 2201 function refreshBluetooth(text) {
2308 - bluetoothState = parseJson(text, bluetoothState);
2202 + bluetoothState = Util.parseJson(text, bluetoothState);
2311 2205 function toggleWifi() {
2369 2263 spacing: 10
2370 2264 width: parent ? parent.width : 0
2372 - NuguText {
2373 - theme: root.theme
2374 - variant: "meta"
2375 - text: "Network and Bluetooth"
2376 - width: root.width
2377 - wrapMode: Text.WordWrap
2266 + Row {
2267 + objectName: "networkRateRow"
2268 + width: parent.width
2269 + spacing: 8
2271 + NuguText {
2272 + theme: root.theme
2273 + text: root.resourceService ? `↓ ${root.resourceService.formatRate(root.resourceService.networkRxRate)}` : "↓ 0 B/s"
2274 + color: root.theme ? root.theme.ui.accent : "white"
2277 + NuguText {
2278 + theme: root.theme
2279 + text: root.resourceService ? `↑ ${root.resourceService.formatRate(root.resourceService.networkTxRate)}` : "↑ 0 B/s"
2280 + color: root.theme ? root.theme.ui.focus : "white"
2380 2285 Column {
2398 2303 height: 26
2399 2304 radius: 9
2400 2305 color: root.theme ? root.theme.withAlpha(root.networkState.wifi && root.networkState.wifi.enabled ? root.theme.ui.focus : root.theme.ui.minor, 0.22) : "transparent"
2401 - border.width: 1
2306 + border.width: 0
2402 2307 border.color: root.roleColor(root.networkState.compact ? root.networkState.compact.role : "ui.minor")
2404 2309 NuguText {
2420 2325 height: 26
2421 2326 radius: 9
2422 2327 color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, root.networkState.scanning ? 0.32 : 0.16) : "transparent"
2423 - border.width: 1
2328 + border.width: 0
2424 2329 border.color: root.theme ? root.theme.ui.accent : "transparent"
2426 2331 NuguText {
2452 2357 height: 34
2453 2358 radius: 10
2454 2359 color: root.theme ? root.theme.withAlpha(active ? root.theme.ui.focus : root.theme.ui.minor, active ? 0.24 : 0.1) : "transparent"
2455 - border.width: 1
2360 + border.width: 0
2456 2361 border.color: root.roleColor(active ? "ui.accent" : modelData.state === "connecting" ? "warning" : "ui.minor")
2458 2363 NuguText {
2518 2423 height: 26
2519 2424 radius: 9
2520 2425 color: root.theme ? root.theme.withAlpha(root.bluetoothState.adapter && root.bluetoothState.adapter.state === "powered" ? root.theme.ui.focus : root.theme.ui.minor, 0.22) : "transparent"
2521 - border.width: 1
2426 + border.width: 0
2522 2427 border.color: root.roleColor(root.bluetoothState.compact ? root.bluetoothState.compact.role : "ui.minor")
2524 2429 NuguText {
2540 2445 height: 26
2541 2446 radius: 9
2542 2447 color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, root.bluetoothState.adapter && root.bluetoothState.adapter.discovering ? 0.32 : 0.16) : "transparent"
2543 - border.width: 1
2448 + border.width: 0
2544 2449 border.color: root.theme ? root.theme.ui.accent : "transparent"
2546 2451 NuguText {
2571 2476 height: 36
2572 2477 radius: 10
2573 2478 color: root.theme ? root.theme.withAlpha(modelData.connected ? root.theme.ui.focus : root.theme.ui.minor, modelData.connected ? 0.24 : 0.1) : "transparent"
2574 - border.width: 1
2479 + border.width: 0
2575 2480 border.color: root.roleColor(modelData.blocked ? "error" : modelData.connected ? "ui.accent" : "ui.minor")
2577 2482 NuguText {
2621 2526 required property QtObject theme
2622 2527 required property QtObject trayService
2623 - property var state: trayService ? parseJson(trayService.stateJson(), {
2624 - "rows": [],
2625 - "trayPanelContract": {
2528 + property var state: trayService ? Util.parseJson(trayService.stateJson(), {
2529 + "items": []
2627 2530 }) : ({
2628 - "rows": [],
2629 - "trayPanelContract": {
2531 + "items": []
2632 - readonly property var rows: state.rows || []
2633 - readonly property var panel: state.trayPanelContract || ({
2634 - })
2635 - readonly property string source: "Nuguland TrayItem.qml plus Nuguland SysTray.qml MenuView.qml plus Nuguland TrayOverflowMenu.qml"
2636 - readonly property bool nativeTrayMenuPanel: true
2637 - readonly property bool trayItemGrid: true
2638 - readonly property bool dbusMenuRows: true
2639 - readonly property bool submenuCollapsePolicy: true
2640 - readonly property bool menuClosePropagation: true
2641 - readonly property bool attentionStatus: true
2643 - function parseJson(text, valueWhenInvalid) {
2644 - try {
2645 - return JSON.parse(String(text));
2646 - } catch (error) {
2647 - return valueWhenInvalid;
2533 + readonly property var items: state.items || []
2534 + readonly property bool hasItems: items.length > 0
2651 2536 function refreshFrom(text) {
2652 - state = parseJson(text, state);
2537 + state = Util.parseJson(text, state);
2655 - function expandSubmenu(id) {
2656 - if (trayService)
2657 - refreshFrom(trayService.expandSubmenu(id));
2661 - function activateRow(id) {
2540 + function activate(id) {
2662 2541 if (trayService)
2663 2542 refreshFrom(trayService.activateRow(id));
2667 - function closeMenu(reason) {
2668 - if (trayService)
2669 - refreshFrom(trayService.closeMenu(reason));
2673 - function rowMark(row) {
2674 - if (row.kind === "submenu")
2675 - return row.expanded ? "⌄" : "›";
2677 - if (row.kind === "check")
2678 - return row.checked ? "✓" : "□";
2680 - if (row.kind === "radio")
2681 - return row.checked ? "●" : "○";
2683 - if (row.kind === "disabled")
2684 - return "×";
2686 - return "";
2689 - function rowRole(row) {
2690 - if (row.kind === "disabled")
2691 - return "ui.minor";
2693 - if (row.kind === "submenu" && row.expanded)
2694 - return "ui.focus";
2696 - if (row.kind === "check" || row.kind === "radio")
2697 - return "info";
2699 - return "ui.accent";
2702 - function roleColor(role) {
2703 - if (!theme)
2704 - return "white";
2706 - if (role === "warning")
2707 - return theme.warning;
2709 - if (role === "error")
2710 - return theme.error;
2712 - if (role === "info")
2713 - return theme.info;
2715 - if (role === "ui.minor")
2716 - return theme.ui.minor;
2718 - if (role === "ui.focus")
2719 - return theme.ui.focus;
2721 - return theme.ui.accent;
2724 2546 spacing: 10
2725 2547 width: parent ? parent.width : 0
2727 - NuguText {
2728 - theme: root.theme
2729 - variant: "meta"
2730 - text: "System tray"
2731 - width: root.width
2732 - wrapMode: Text.WordWrap
2735 - Row {
2736 - objectName: "attentionStatus"
2549 + Flow {
2550 + objectName: "trayItems"
2551 + visible: root.hasItems
2737 2552 width: parent.width
2738 2553 spacing: 8
2740 - Rectangle {
2741 - width: 74
2742 - height: 30
2743 - radius: 10
2744 - color: root.theme ? root.theme.withAlpha(root.state.closeRequested ? root.theme.info : root.theme.ui.accent, 0.16) : "transparent"
2745 - border.width: 1
2746 - border.color: root.theme ? (root.state.closeRequested ? root.theme.info : root.theme.ui.accent) : "transparent"
2748 - NuguText {
2749 - anchors.centerIn: parent
2750 - theme: root.theme
2751 - variant: "meta"
2752 - text: root.state.closeRequested ? "closing" : "open"
2757 - Rectangle {
2758 - width: root.width - 82
2759 - height: 30
2760 - radius: 10
2761 - color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.1) : "transparent"
2762 - border.width: 1
2763 - border.color: root.theme ? root.theme.ui.minor : "transparent"
2765 - NuguText {
2766 - anchors.left: parent.left
2767 - anchors.leftMargin: 8
2768 - anchors.right: parent.right
2769 - anchors.rightMargin: 8
2770 - anchors.verticalCenter: parent.verticalCenter
2771 - theme: root.theme
2772 - variant: "meta"
2773 - text: root.state.expandedSubmenu ? `submenu ${root.state.expandedSubmenu}` : "native tray menu host"
2774 - elide: Text.ElideRight
2781 - Grid {
2782 - objectName: "trayItemGrid"
2783 - width: parent.width
2784 - columns: 4
2785 - columnSpacing: 6
2786 - rowSpacing: 6
2788 2555 Repeater {
2789 - model: ["activate", "secondary", "scroll", "menu"]
2556 + model: root.items
2791 2558 delegate: Rectangle {
2792 - id: itemButton
2559 + id: itemCell
2794 - required property string modelData
2561 + required property var modelData
2562 + readonly property bool attention: modelData.status === "NeedsAttention"
2796 - width: Math.floor((root.width - 18) / 4)
2797 - height: 34
2798 - radius: 10
2799 - color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.13) : "transparent"
2800 - border.width: 1
2801 - border.color: root.theme ? root.theme.ui.accent : "transparent"
2564 + width: 168
2565 + height: 46
2566 + radius: 12
2567 + color: root.theme ? root.theme.withAlpha(attention ? root.theme.info : root.theme.ui.accent, attention ? 0.2 : 0.12) : "transparent"
2568 + border.width: 0
2569 + border.color: root.theme ? (attention ? root.theme.info : root.theme.ui.accent) : "transparent"
2571 + Row {
2572 + anchors.fill: parent
2573 + anchors.leftMargin: 11
2574 + anchors.rightMargin: 11
2575 + spacing: 10
2577 + Image {
2578 + anchors.verticalCenter: parent.verticalCenter
2579 + width: 24
2580 + height: 24
2581 + sourceSize.width: 24
2582 + sourceSize.height: 24
2583 + fillMode: Image.PreserveAspectFit
2584 + source: itemCell.modelData.icon || ""
2585 + visible: status === Image.Ready
2588 + NuguText {
2589 + anchors.verticalCenter: parent.verticalCenter
2590 + theme: root.theme
2591 + variant: "meta"
2592 + selected: itemCell.attention
2593 + text: itemCell.modelData.title
2594 + width: parent.width - 34
2595 + elide: Text.ElideRight
2803 - NuguText {
2804 - anchors.centerIn: parent
2805 - theme: root.theme
2806 - variant: "meta"
2807 - text: itemButton.modelData
2810 2600 MouseArea {
2811 2601 anchors.fill: parent
2812 - onClicked: {
2813 - if (itemButton.modelData === "menu")
2814 - root.expandSubmenu("network");
2815 - else if (itemButton.modelData === "activate")
2816 - root.activateRow("open");
2602 + onClicked: root.activate(itemCell.modelData.id)
2826 - Column {
2827 - objectName: "dbusMenuRows"
2611 + Item {
2612 + objectName: "trayEmptyState"
2613 + visible: !root.hasItems
2828 2614 width: parent.width
2829 - spacing: 5
2615 + height: 300
2831 - Repeater {
2832 - model: root.rows
2617 + Column {
2618 + anchors.centerIn: parent
2619 + spacing: 12
2834 - delegate: Item {
2835 - id: rowShell
2837 - required property var modelData
2839 - width: root.width
2840 - height: modelData.kind === "separator" ? 9 : 32
2842 - Rectangle {
2843 - visible: rowShell.modelData.kind === "separator"
2844 - anchors.left: parent.left
2845 - anchors.right: parent.right
2846 - anchors.verticalCenter: parent.verticalCenter
2847 - height: 1
2848 - color: root.theme ? root.theme.ui.accent : "transparent"
2849 - opacity: 0.5
2852 - Rectangle {
2853 - visible: rowShell.modelData.kind !== "separator"
2854 - anchors.fill: parent
2855 - radius: 10
2856 - color: root.theme ? root.theme.withAlpha(root.roleColor(root.rowRole(rowShell.modelData)), rowShell.modelData.expanded ? 0.22 : 0.1) : "transparent"
2857 - border.width: 1
2858 - border.color: root.roleColor(root.rowRole(rowShell.modelData))
2860 - NuguText {
2861 - anchors.left: parent.left
2862 - anchors.leftMargin: 8
2863 - anchors.verticalCenter: parent.verticalCenter
2864 - theme: root.theme
2865 - variant: "meta"
2866 - selected: rowShell.modelData.expanded
2867 - text: root.rowMark(rowShell.modelData)
2868 - width: 22
2871 - NuguText {
2872 - anchors.left: parent.left
2873 - anchors.leftMargin: 34
2874 - anchors.right: parent.right
2875 - anchors.rightMargin: 8
2876 - anchors.verticalCenter: parent.verticalCenter
2877 - theme: root.theme
2878 - text: rowShell.modelData.label
2879 - opacity: rowShell.modelData.enabled ? 1 : 0.48
2880 - elide: Text.ElideRight
2883 - MouseArea {
2884 - anchors.fill: parent
2885 - enabled: rowShell.modelData.enabled || rowShell.modelData.kind === "disabled"
2886 - onClicked: {
2887 - if (rowShell.modelData.kind === "submenu")
2888 - root.expandSubmenu(rowShell.modelData.id);
2889 - else
2890 - root.activateRow(rowShell.modelData.id);
2896 - Column {
2897 - objectName: "submenuCollapsePolicy"
2898 - visible: rowShell.modelData.kind === "submenu" && rowShell.modelData.expanded
2899 - anchors.left: parent.left
2900 - anchors.leftMargin: 34
2901 - anchors.right: parent.right
2902 - anchors.top: parent.bottom
2903 - spacing: 3
2905 - Repeater {
2906 - model: rowShell.modelData.children || []
2908 - delegate: Rectangle {
2909 - required property string modelData
2911 - width: parent.width
2912 - height: 0
2913 - visible: false
2621 + Rectangle {
2622 + anchors.horizontalCenter: parent.horizontalCenter
2623 + width: 68
2624 + height: 68
2625 + radius: 34
2626 + color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.16) : "transparent"
2628 + NuguText {
2629 + anchors.centerIn: parent
2630 + theme: root.theme
2631 + variant: "title"
2632 + selected: true
2633 + text: "⌁"
2926 - Rectangle {
2927 - objectName: "menuClosePropagation"
2928 - width: parent.width
2929 - height: 30
2930 - radius: 10
2931 - color: root.theme ? root.theme.withAlpha(root.state.closePropagation && root.state.closePropagation.requested ? root.theme.info : root.theme.ui.minor, 0.12) : "transparent"
2932 - border.width: 1
2933 - border.color: root.theme ? (root.state.closePropagation && root.state.closePropagation.requested ? root.theme.info : root.theme.ui.minor) : "transparent"
2935 - NuguText {
2936 - anchors.left: parent.left
2937 - anchors.leftMargin: 8
2938 - anchors.right: closeButton.left
2939 - anchors.verticalCenter: parent.verticalCenter
2940 - theme: root.theme
2941 - variant: "meta"
2942 - text: root.state.closePropagation ? `${root.state.closePropagation.reason || "no-close"} from ${root.state.closePropagation.source || "menu"}` : "no close request"
2943 - elide: Text.ElideRight
2946 - Rectangle {
2947 - id: closeButton
2949 - anchors.right: parent.right
2950 - anchors.rightMargin: 6
2951 - anchors.verticalCenter: parent.verticalCenter
2952 - width: 58
2953 - height: 22
2954 - radius: 8
2955 - color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.14) : "transparent"
2956 - border.width: 1
2957 - border.color: root.theme ? root.theme.ui.accent : "transparent"
2959 2638 NuguText {
2960 - anchors.centerIn: parent
2639 + anchors.horizontalCenter: parent.horizontalCenter
2961 2640 theme: root.theme
2962 - variant: "meta"
2963 - text: "close"
2641 + variant: "title"
2642 + text: "No tray icons"
2966 - MouseArea {
2967 - anchors.fill: parent
2968 - onClicked: root.closeMenu("panel-close")
2645 + NuguText {
2646 + anchors.horizontalCenter: parent.horizontalCenter
2647 + theme: root.theme
2648 + variant: "meta"
2649 + text: "Background apps show up here"
2980 2661 required property QtObject theme
2981 2662 required property QtObject powerService
2982 - property var state: powerService ? parseJson(powerService.stateJson(), {
2663 + property var state: powerService ? Util.parseJson(powerService.stateJson(), {
2983 2664 "battery": {
2985 2666 "externalDevices": [],
3001 2682 readonly property var devices: state.externalDevices || []
3002 2683 readonly property var panel: state.powerPanelContract || ({
3004 - readonly property string source: "Nuguland session Content.qml plus Nuguland SessionScreen.qml plus Nuguland Power.qml"
3005 - readonly property bool upowerSessionPanel: true
3006 - readonly property bool batteryHero: true
3007 - readonly property bool externalDeviceBatteryRows: true
3008 - readonly property bool powerProfileSelector: true
3009 - readonly property bool keyboardActionGrid: true
3010 - readonly property bool confirmationStrip: true
3011 - readonly property bool destructiveTwoStep: true
3012 2685 readonly property var sessionActions: ["lock", "suspend", "monitor-off", "monitor-on", "logout", "reboot", "poweroff"]
3013 2686 readonly property var profileRows: ["power-saver", "balanced", "performance"]
3015 - function parseJson(text, valueWhenInvalid) {
3016 - try {
3017 - return JSON.parse(String(text));
3018 - } catch (error) {
3019 - return valueWhenInvalid;
3023 2689 function refreshFrom(text) {
3024 - state = parseJson(text, state);
2690 + state = Util.parseJson(text, state);
3027 2693 function setProfile(profile) {
3084 2750 Keys.onReturnPressed: root.state.pendingConfirmation ? root.confirm(root.state.pendingConfirmation) : root.runSession("lock")
3085 2751 Keys.onEnterPressed: root.state.pendingConfirmation ? root.confirm(root.state.pendingConfirmation) : root.runSession("lock")
3087 - NuguText {
3088 - theme: root.theme
3089 - variant: "meta"
3090 - text: "Power and session"
3091 - width: root.width
3092 - wrapMode: Text.WordWrap
3095 2753 Rectangle {
3096 2754 objectName: "batteryHero"
3097 2755 width: parent.width
3098 2756 height: 78
3099 2757 radius: 15
3100 2758 color: root.theme ? root.theme.withAlpha(root.roleColor(root.battery.role || "ui.accent"), 0.16) : "transparent"
3101 - border.width: 1
2759 + border.width: 0
3102 2760 border.color: root.roleColor(root.battery.role || "ui.accent")
3104 2762 Column {
3113 2771 NuguText {
3114 2772 theme: root.theme
3115 2773 variant: "title"
3116 - text: `battery ${root.battery.percent || 0}%`
2774 + text: `${root.battery.percent || 0}%`
3117 2775 width: parent.width - 118
3158 2816 NuguText {
3159 2817 theme: root.theme
3160 2818 variant: "meta"
2819 + visible: root.battery.health >= 0
3161 2820 text: `health ${root.battery.health}%`
3162 2821 width: 88
3163 2822 horizontalAlignment: Text.AlignRight
3187 2846 height: 30
3188 2847 radius: 10
3189 2848 color: root.theme ? root.theme.withAlpha(active ? root.theme.ui.focus : root.theme.ui.minor, active ? 0.28 : 0.12) : "transparent"
3190 - border.width: 1
2849 + border.width: 0
3191 2850 border.color: root.theme ? (active ? root.theme.ui.focus : root.theme.ui.accent) : "transparent"
3193 2852 NuguText {
3227 2886 height: 32
3228 2887 radius: 10
3229 2888 color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.1) : "transparent"
3230 - border.width: 1
2889 + border.width: 0
3231 2890 border.color: root.theme ? root.theme.ui.accent : "transparent"
3233 2892 NuguText {
3277 2936 height: 38
3278 2937 radius: pending ? 14 : 11
3279 2938 color: root.theme ? root.theme.withAlpha(pending ? root.theme.warning : destructive ? root.theme.error : root.theme.ui.accent, pending ? 0.28 : 0.14) : "transparent"
3280 - border.width: 1
2939 + border.width: 0
3281 2940 border.color: root.theme ? (pending ? root.theme.warning : destructive ? root.theme.error : root.theme.ui.accent) : "transparent"
3283 2942 NuguText {
3305 2964 height: root.state.pendingConfirmation ? 36 : 26
3306 2965 radius: 11
3307 2966 color: root.theme ? root.theme.withAlpha(root.state.pendingConfirmation ? root.theme.warning : root.theme.ui.minor, root.state.pendingConfirmation ? 0.2 : 0.1) : "transparent"
3308 - border.width: 1
2967 + border.width: 0
3309 2968 border.color: root.theme ? (root.state.pendingConfirmation ? root.theme.warning : root.theme.ui.minor) : "transparent"
3311 2970 NuguText {
3314 2973 anchors.verticalCenter: parent.verticalCenter
3315 2974 theme: root.theme
3316 2975 variant: "meta"
3317 - text: root.state.pendingConfirmation ? `confirm ${root.state.pendingConfirmation}` : "lock is safe default · Escape cancels"
2976 + text: root.state.pendingConfirmation ? `Confirm ${root.state.pendingConfirmation}? · Enter` : "Enter locks · Esc closes"
3318 2977 width: parent.width - (root.state.pendingConfirmation ? 128 : 16)
3319 2978 elide: Text.ElideRight
3331 2990 height: 24
3332 2991 radius: 8
3333 2992 color: root.theme ? root.theme.withAlpha(root.theme.warning, 0.18) : "transparent"
3334 - border.width: 1
2993 + border.width: 0
3335 2994 border.color: root.theme ? root.theme.warning : "transparent"
3337 2996 NuguText {
3353 3012 height: 24
3354 3013 radius: 8
3355 3014 color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.14) : "transparent"
3356 - border.width: 1
3015 + border.width: 0
3357 3016 border.color: root.theme ? root.theme.ui.minor : "transparent"
3359 3018 NuguText {
3382 3041 required property QtObject theme
3383 3042 required property QtObject audioService
3384 - property var state: audioService ? parseJson(audioService.stateJson(), {
3043 + property var state: audioService ? Util.parseJson(audioService.stateJson(), {
3385 3044 "sinks": [],
3386 3045 "sources": [],
3387 3046 "streams": [],
3403 3062 readonly property var streams: state.streams || []
3404 3063 readonly property var panel: state.audioPanelContract || ({
3406 - readonly property string source: "Nuguland bar popouts Audio.qml plus Nuguland Mixer.qml MixerEntry.qml"
3407 - readonly property bool pipewireMixerPanel: true
3408 - readonly property bool outputSelector: true
3409 - readonly property bool inputSelector: true
3410 - readonly property bool deviceVolumeSliders: true
3411 - readonly property bool perStreamRows: true
3412 - readonly property bool streamTargetReassignment: true
3413 - readonly property bool noExternalMixer: true
3065 + readonly property bool pipewireMixerPanel: !!panel.pipewireMixerPanel
3066 + readonly property bool outputSelector: !!panel.outputSelector
3067 + readonly property bool inputSelector: !!panel.inputSelector
3068 + readonly property bool deviceVolumeSliders: !!panel.deviceVolumeSliders
3069 + readonly property bool perStreamRows: !!panel.perStreamRows
3070 + readonly property bool streamTargetReassignment: !!panel.nativeStreamMove
3071 + readonly property bool noExternalMixer: !!panel.noExternalMixer
3415 - function parseJson(text, valueWhenInvalid) {
3416 - try {
3417 - return JSON.parse(String(text));
3418 - } catch (error) {
3419 - return valueWhenInvalid;
3423 3074 function refreshFrom(text) {
3424 - state = parseJson(text, state);
3075 + state = Util.parseJson(text, state);
3427 3078 function setVolume(id, ratio) {
3451 - function moveStream(id, target) {
3452 - if (audioService)
3453 - refreshFrom(audioService.moveStream(id, target));
3457 3102 function roleColor(role) {
3458 3103 if (!theme)
3459 3104 return "white";
3470 3115 return theme.ui.accent;
3473 - function nextSinkId(current) {
3474 - if (sinks.length === 0)
3475 - return current;
3477 - for (let i = 0; i < sinks.length; i++) {
3478 - if (sinks[i].id === current)
3479 - return sinks[(i + 1) % sinks.length].id;
3482 - return sinks[0].id;
3485 3118 spacing: 10
3486 3119 width: parent ? parent.width : 0
3488 - NuguText {
3489 - theme: root.theme
3490 - variant: "meta"
3491 - text: "Audio mixer"
3492 - width: root.width
3493 - wrapMode: Text.WordWrap
3496 3121 Column {
3497 3122 objectName: "outputSelector"
3498 3123 width: parent.width
3517 3142 implicitHeight: sinkContent.implicitHeight + 12
3518 3143 radius: 10
3519 3144 color: root.theme ? root.theme.withAlpha(active ? root.theme.ui.focus : root.theme.ui.minor, active ? 0.28 : 0.12) : "transparent"
3520 - border.width: 1
3145 + border.width: 0
3521 3146 border.color: root.theme ? (active ? root.theme.ui.focus : root.theme.ui.accent) : "transparent"
3523 3148 Column {
3617 3242 height: 34
3618 3243 radius: 10
3619 3244 color: root.theme ? root.theme.withAlpha(active ? root.theme.ui.focus : root.theme.ui.minor, active ? 0.25 : 0.12) : "transparent"
3620 - border.width: 1
3245 + border.width: 0
3621 3246 border.color: root.roleColor(modelData.muted ? "ui.minor" : modelData.active ? "warning" : "ui.accent")
3623 3248 NuguText {
3679 3304 height: 42
3680 3305 radius: 10
3681 3306 color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.1) : "transparent"
3682 - border.width: 1
3307 + border.width: 0
3683 3308 border.color: root.theme ? root.theme.ui.accent : "transparent"
3685 3310 Column {
3686 3311 anchors.left: parent.left
3687 - anchors.right: targetButton.left
3312 + anchors.right: parent.right
3688 3313 anchors.verticalCenter: parent.verticalCenter
3689 3314 anchors.leftMargin: 8
3315 + anchors.rightMargin: 8
3690 3316 spacing: 1
3692 3318 NuguText {
3709 - Rectangle {
3710 - id: targetButton
3712 - objectName: "streamTargetReassignment"
3713 - anchors.right: parent.right
3714 - anchors.rightMargin: 6
3715 - anchors.verticalCenter: parent.verticalCenter
3716 - width: 64
3717 - height: 26
3718 - radius: 9
3719 - color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.18) : "transparent"
3720 - border.width: 1
3721 - border.color: root.theme ? root.theme.ui.accent : "transparent"
3723 - NuguText {
3724 - anchors.centerIn: parent
3725 - theme: root.theme
3726 - variant: "meta"
3727 - text: "move"
3730 - MouseArea {
3731 - anchors.fill: parent
3732 - onClicked: root.moveStream(streamRow.modelData.id, root.nextSinkId(streamRow.modelData.target))
3748 3346 required property QtObject theme
3749 3347 required property QtObject mediaService
3750 - property var state: mediaService ? parseJson(mediaService.stateJson(), {
3348 + property var state: mediaService ? Util.parseJson(mediaService.stateJson(), {
3751 3349 "activePlayer": {
3753 3351 "players": [],
3763 3361 readonly property var player: state.activePlayer || ({
3765 3363 readonly property var players: state.players || []
3364 + readonly property bool hasMedia: players.length > 0
3766 3365 readonly property var panel: state.mediaPanelContract || ({
3768 - readonly property string source: "Nuguland media Details.qml plus Nuguland MprisController.qml"
3769 - readonly property bool coverDetailsProgressTransport: true
3770 - readonly property bool playerSelectorRail: true
3771 - readonly property bool noExternalVisualizer: true
3772 3367 readonly property var transportActions: ["shuffle", "previous", "playPause", "next", "repeat"]
3773 - readonly property string seekPreviewBinding: "positionLabel follows slider while dragging"
3774 - readonly property var trackDirectionAnimation: ["previous", "next"]
3776 - function parseJson(text, valueWhenInvalid) {
3777 - try {
3778 - return JSON.parse(String(text));
3779 - } catch (error) {
3780 - return valueWhenInvalid;
3784 3370 function mmss(seconds) {
3785 3371 const total = Math.max(0, Math.round(Number(seconds || 0)));
3791 3377 function refreshFrom(text) {
3792 - state = parseJson(text, state);
3378 + state = Util.parseJson(text, state);
3795 3381 function runAction(kind) {
3818 3404 width: parent.width
3819 3405 spacing: 12
3406 + visible: root.hasMedia
3821 3408 Rectangle {
3822 3409 id: coverCard
3826 3413 height: 96
3827 3414 radius: 18
3828 3415 color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.24) : "transparent"
3829 - border.width: 1
3416 + border.width: 0
3830 3417 border.color: root.theme ? root.theme.ui.accent : "transparent"
3831 3418 clip: true
3856 3443 NuguText {
3857 3444 theme: root.theme
3858 3445 variant: "title"
3859 - text: root.player.title || "media controls"
3446 + text: root.player.title || root.player.identity || "Untitled"
3860 3447 width: parent.width
3861 3448 elide: Text.ElideRight
3864 3451 NuguText {
3865 3452 theme: root.theme
3866 - text: root.player.artist || "unknown artist"
3453 + text: root.player.artist || ""
3454 + visible: text.length > 0
3867 3455 width: parent.width
3868 3456 elide: Text.ElideRight
3871 3459 NuguText {
3872 3460 theme: root.theme
3873 3461 variant: "meta"
3874 - text: root.player.album || "unknown album"
3462 + text: root.player.album || ""
3463 + visible: text.length > 0
3875 3464 width: parent.width
3876 3465 elide: Text.ElideRight
3895 3484 height: 10
3896 3485 radius: 5
3897 3486 color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.28) : "transparent"
3898 - border.width: 1
3487 + border.width: 0
3899 3488 border.color: root.theme ? root.theme.ui.minor : "transparent"
3901 3490 Rectangle {
3942 3531 height: 28
3943 3532 radius: 10
3944 3533 color: root.theme ? root.theme.withAlpha(modelData === "playPause" ? root.theme.ui.focus : root.theme.ui.accent, 0.2) : "transparent"
3945 - border.width: 1
3534 + border.width: 0
3946 3535 border.color: root.theme ? root.theme.ui.accent : "transparent"
3948 3537 NuguText {
3972 3561 objectName: "playerSelectorRail"
3973 3562 width: parent.width
3974 3563 spacing: 6
3564 + visible: root.players.length > 1
3976 3566 Repeater {
3977 3567 model: root.players
3986 3576 width: Math.max(76, playerName.implicitWidth + 18)
3987 3577 radius: 10
3988 3578 color: root.theme ? root.theme.withAlpha(active ? root.theme.ui.focus : root.theme.ui.minor, active ? 0.3 : 0.14) : "transparent"
3989 - border.width: 1
3579 + border.width: 0
3990 3580 border.color: root.theme ? (active ? root.theme.ui.focus : root.theme.ui.accent) : "transparent"
3992 3582 NuguText {
4013 - NuguText {
4014 - theme: root.theme
4015 - variant: "meta"
4016 - text: "Media"
3603 + Item {
3604 + objectName: "mediaEmptyState"
3605 + visible: !root.hasMedia
4017 3606 width: parent.width
4018 - wrapMode: Text.WordWrap
4023 - component ScreenshotsPanel: Column {
4024 - id: root
4026 - required property QtObject theme
4027 - required property QtObject screenshotsService
4028 - property var state: screenshotsService ? parseJson(screenshotsService.stateJson(), {
4029 - "selection": {
4030 - },
4031 - "selectionVisuals": {
4032 - },
4033 - "recent": [],
4034 - "screenshotsPanelContract": {
4036 - }) : ({
4037 - "selection": {
4038 - },
4039 - "selectionVisuals": {
4040 - },
4041 - "recent": [],
4042 - "screenshotsPanelContract": {
4044 - })
4045 - readonly property var selection: state.selection || ({
4046 - })
4047 - readonly property var visuals: state.selectionVisuals || ({
4048 - })
4049 - readonly property var selectionRect: selection.rect || ({
4050 - "x": 0,
4051 - "y": 0,
4052 - "width": 0,
4053 - "height": 0
4054 - })
4055 - readonly property var recentRows: state.recent || []
4056 - readonly property var panel: state.screenshotsPanelContract || ({
4057 - })
4058 - readonly property string source: "Nuguland AreaPicker.qml plus Nuguland RegionSelector.qml WRegionSelectionPanel.qml"
4059 - readonly property bool niriCapturePanel: true
4060 - readonly property bool captureActionGrid: true
4061 - readonly property bool regionSelectionPreview: true
4062 - readonly property bool recentCaptureRows: true
4063 - readonly property bool colorPickSwatch: true
4064 - readonly property bool toolbarActionRail: true
4065 - readonly property bool boundedCornerAccents: true
4067 - function parseJson(text, valueWhenInvalid) {
4068 - try {
4069 - return JSON.parse(String(text));
4070 - } catch (error) {
4071 - return valueWhenInvalid;
4075 - function refreshFrom(text) {
4076 - state = parseJson(text, state);
4079 - function runCapture(kind) {
4080 - if (screenshotsService)
4081 - refreshFrom(screenshotsService.capture(kind, `/tmp/nuguland-${kind}.png`));
4085 - function pickColor() {
4086 - if (screenshotsService)
4087 - refreshFrom(screenshotsService.pickColor());
4091 - function beginRegion() {
4092 - if (screenshotsService)
4093 - refreshFrom(screenshotsService.beginSelection(96, 64));
4097 - function demoRegion() {
4098 - if (!screenshotsService)
4099 - return ;
4101 - refreshFrom(screenshotsService.beginSelection(120, 80));
4102 - refreshFrom(screenshotsService.updateSelection(40, 200));
4105 - function completeRegion() {
4106 - if (screenshotsService)
4107 - refreshFrom(screenshotsService.completeSelection("/tmp/nuguland-region.png"));
4111 - function cancelRegion() {
4112 - if (screenshotsService)
4113 - refreshFrom(screenshotsService.cancelSelection());
4117 - function clearRecent() {
4118 - if (screenshotsService)
4119 - refreshFrom(screenshotsService.clear());
4123 - function recordAction(kind, id) {
4124 - if (screenshotsService)
4125 - refreshFrom(screenshotsService.recordAction(kind, id));
4129 - spacing: 10
4130 - width: parent ? parent.width : 0
4132 - NuguText {
4133 - theme: root.theme
4134 - variant: "meta"
4135 - text: "Screenshots and color picker"
4136 - width: root.width
4137 - wrapMode: Text.WordWrap
4140 - Grid {
4141 - objectName: "captureActionGrid"
4142 - width: parent.width
4143 - columns: 2
4144 - columnSpacing: 6
4145 - rowSpacing: 6
4147 - Repeater {
4148 - model: [{
4149 - "id": "focused-screen",
4150 - "label": "screen"
4151 - }, {
4152 - "id": "focused-window",
4153 - "label": "window"
4154 - }, {
4155 - "id": "select-region",
4156 - "label": "region"
4157 - }, {
4158 - "id": "pick-color",
4159 - "label": "color"
4160 - }]
4162 - delegate: Rectangle {
4163 - id: captureButton
4165 - required property var modelData
4167 - width: Math.floor((root.width - 6) / 2)
4168 - height: 34
4169 - radius: 11
4170 - color: root.theme ? root.theme.withAlpha(modelData.id === "pick-color" ? root.theme.info : root.theme.ui.accent, 0.16) : "transparent"
4171 - border.width: 1
4172 - border.color: root.theme ? (modelData.id === "pick-color" ? root.theme.info : root.theme.ui.accent) : "transparent"
4174 - NuguText {
4175 - anchors.centerIn: parent
4176 - theme: root.theme
4177 - variant: "meta"
4178 - text: captureButton.modelData.label
4181 - MouseArea {
4182 - anchors.fill: parent
4183 - onClicked: {
4184 - if (captureButton.modelData.id === "select-region")
4185 - root.demoRegion();
4186 - else if (captureButton.modelData.id === "pick-color")
4187 - root.pickColor();
4188 - else
4189 - root.runCapture(captureButton.modelData.id);
4199 - Rectangle {
4200 - id: preview
4202 - objectName: "regionSelectionPreview"
4203 - width: parent.width
4204 - height: 112
4205 - radius: 14
4206 - clip: true
4207 - color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.72) : "transparent"
4208 - border.width: 1
4209 - border.color: root.theme ? root.theme.ui.accent : "transparent"
4211 - Rectangle {
4212 - anchors.fill: parent
4213 - color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, root.visuals.dimmedMask && root.visuals.dimmedMask.visible ? 0.42 : 0.18) : "transparent"
4216 - Rectangle {
4217 - id: cutout
4219 - readonly property real sx: preview.width / 240
4220 - readonly property real sy: preview.height / 240
4222 - objectName: "clear-cutout"
4223 - x: Math.max(8, Math.min(preview.width - width - 8, root.selectionRect.x * sx))
4224 - y: Math.max(8, Math.min(preview.height - height - 8, root.selectionRect.y * sy))
4225 - width: Math.max(24, Math.min(preview.width - 16, root.selectionRect.width * sx))
4226 - height: Math.max(18, Math.min(preview.height - 16, root.selectionRect.height * sy))
4227 - radius: 6
4228 - color: root.theme ? root.theme.withAlpha(root.theme.content.backdrop, 0.1) : "transparent"
4229 - border.width: 1
4230 - border.color: root.theme ? root.theme.ui.accent : "transparent"
4232 - Repeater {
4233 - objectName: "boundedCornerAccents"
4234 - model: [{
4235 - "x": -3,
4236 - "y": -3
4237 - }, {
4238 - "x": cutout.width - 7,
4239 - "y": -3
4240 - }, {
4241 - "x": -3,
4242 - "y": cutout.height - 7
4243 - }, {
4244 - "x": cutout.width - 7,
4245 - "y": cutout.height - 7
4246 - }]
4248 - delegate: Rectangle {
4249 - required property var modelData
4251 - x: modelData.x
4252 - y: modelData.y
4253 - width: 10
4254 - height: 10
4255 - radius: 5
4256 - color: root.theme ? root.theme.ui.accent : "white"
4261 - NuguText {
4262 - anchors.centerIn: parent
4263 - theme: root.theme
4264 - variant: "mono"
4265 - selected: true
4266 - text: root.visuals.dimensions ? root.visuals.dimensions.text : "0×0"
4273 - Row {
4274 - objectName: "toolbarActionRail"
4275 - width: parent.width
4276 - spacing: 6
4278 - Repeater {
4279 - model: ["copy", "save", "cancel", "color"]
4281 - delegate: Rectangle {
4282 - id: toolButton
4284 - required property string modelData
4286 - width: Math.floor((root.width - 18) / 4)
4287 - height: 30
4288 - radius: 10
4289 - color: root.theme ? root.theme.withAlpha(modelData === "cancel" ? root.theme.error : root.theme.ui.accent, 0.14) : "transparent"
4290 - border.width: 1
4291 - border.color: root.theme ? (modelData === "cancel" ? root.theme.error : root.theme.ui.accent) : "transparent"
4293 - NuguText {
4294 - anchors.centerIn: parent
4295 - theme: root.theme
4296 - variant: "meta"
4297 - text: toolButton.modelData
4300 - MouseArea {
4301 - anchors.fill: parent
4302 - onClicked: {
4303 - if (toolButton.modelData === "cancel")
4304 - root.cancelRegion();
4305 - else if (toolButton.modelData === "color")
4306 - root.pickColor();
4307 - else if (toolButton.modelData === "save")
4308 - root.completeRegion();
4309 - else
4310 - root.recordAction("copy", root.recentRows.length > 0 ? root.recentRows[0].id : "selection");
4320 - Row {
4321 - width: parent.width
4322 - spacing: 8
4324 - Rectangle {
4325 - objectName: "colorPickSwatch"
4326 - width: 68
4327 - height: 30
4328 - radius: 10
4329 - color: root.state.lastColor && root.state.lastColor.length > 0 ? root.state.lastColor : (root.theme ? root.theme.withAlpha(root.theme.info, 0.18) : "transparent")
4330 - border.width: 1
4331 - border.color: root.theme ? root.theme.info : "transparent"
4334 - NuguText {
4335 - theme: root.theme
4336 - variant: "meta"
4337 - text: root.state.lastColor && root.state.lastColor.length > 0 ? root.state.lastColor : "pick color"
4338 - width: parent.width - 76
4339 - verticalAlignment: Text.AlignVCenter
4344 - Column {
4345 - objectName: "recentCaptureRows"
4346 - width: parent.width
4347 - spacing: 5
4349 - Repeater {
4350 - model: root.recentRows.slice(0, 3)
4352 - delegate: Rectangle {
4353 - id: recentRow
4355 - required property var modelData
4357 - width: root.width
4358 - height: 30
4359 - radius: 10
4360 - color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.1) : "transparent"
4361 - border.width: 1
4362 - border.color: root.theme ? root.theme.ui.accent : "transparent"
4364 - NuguText {
4365 - anchors.left: parent.left
4366 - anchors.leftMargin: 8
4367 - anchors.verticalCenter: parent.verticalCenter
4368 - theme: root.theme
4369 - text: `${recentRow.modelData.kind}`
4370 - width: parent.width - 108
4371 - elide: Text.ElideRight
4374 - NuguText {
4375 - anchors.right: parent.right
4376 - anchors.rightMargin: 8
4377 - anchors.verticalCenter: parent.verticalCenter
4378 - theme: root.theme
4379 - variant: "meta"
4380 - text: "open/save"
4387 - Rectangle {
4388 - width: root.width
4389 - height: root.recentRows.length === 0 ? 28 : 0
4390 - visible: height > 0
4391 - radius: 10
4392 - color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.08) : "transparent"
4393 - border.width: 1
4394 - border.color: root.theme ? root.theme.ui.minor : "transparent"
4396 - NuguText {
4397 - anchors.centerIn: parent
4398 - theme: root.theme
4399 - variant: "meta"
4400 - text: "no captures yet"
4409 - component WindowPanel: Column {
4410 - id: root
4412 - required property QtObject theme
4413 - required property QtObject niriService
4414 - property var card: niriService ? parseJson(niriService.windowRuleMetadata(), {
4415 - "previewSlot": {
4416 - },
4417 - "actionRow": {
4418 - },
4419 - "actions": [],
4420 - "detailsRows": [],
4421 - "ruleHints": [],
4422 - "windowPanelContract": {
4424 - }) : ({
4425 - "previewSlot": {
4426 - },
4427 - "actionRow": {
4428 - },
4429 - "actions": [],
4430 - "detailsRows": [],
4431 - "ruleHints": [],
4432 - "windowPanelContract": {
4434 - })
4435 - readonly property var panel: card.windowPanelContract || ({
4436 - })
4437 - readonly property var preview: card.previewSlot || ({
4438 - })
4439 - readonly property var actions: card.actions || []
4440 - readonly property var details: card.detailsRows || []
4441 - readonly property var hints: card.ruleHints || []
4442 - readonly property string source: "Nuguland WindowInfo.qml Details.qml Buttons.qml plus Nuguland TaskViewContent.qml"
4443 - readonly property bool niriWindowCardPanel: true
4444 - readonly property bool previewSlotCard: true
4445 - readonly property bool detailsRows: true
4446 - readonly property bool ruleHintRows: true
4447 - readonly property bool windowActionRail: true
4448 - readonly property bool workspaceMoveAffordance: true
4450 - function parseJson(text, valueWhenInvalid) {
4451 - try {
4452 - return JSON.parse(String(text));
4453 - } catch (error) {
4454 - return valueWhenInvalid;
4458 - function refreshFrom(text) {
4459 - card = parseJson(text, card);
4462 - function runAction(kind) {
4463 - if (niriService)
4464 - refreshFrom(niriService.windowCardAction(kind));
4468 - function roleColor(role) {
4469 - if (!theme)
4470 - return "white";
4472 - if (role === "warning")
4473 - return theme.warning;
4475 - if (role === "error")
4476 - return theme.error;
4478 - if (role === "ui.minor")
4479 - return theme.ui.minor;
4481 - return theme.ui.accent;
4484 - spacing: 10
4485 - width: parent ? parent.width : 0
4487 - NuguText {
4488 - theme: root.theme
4489 - variant: "meta"
4490 - text: "Focused window"
4491 - width: root.width
4492 - wrapMode: Text.WordWrap
4495 - Rectangle {
4496 - objectName: "previewSlotCard"
4497 - width: parent.width
4498 - height: 78
4499 - radius: 15
4500 - color: root.theme ? root.theme.withAlpha(root.preview.available ? root.theme.ui.focus : root.theme.ui.minor, root.preview.available ? 0.2 : 0.1) : "transparent"
4501 - border.width: 1
4502 - border.color: root.theme ? (root.preview.available ? root.theme.ui.focus : root.theme.ui.minor) : "transparent"
3607 + height: 300
4504 3609 Column {
4505 - anchors.fill: parent
4506 - anchors.margins: 10
4507 - spacing: 4
4509 - NuguText {
4510 - theme: root.theme
4511 - variant: "title"
4512 - text: root.card.title || "no focused window"
4513 - width: parent.width
4514 - elide: Text.ElideRight
4517 - NuguText {
4518 - theme: root.theme
4519 - text: root.card.appId || "niri toplevel"
4520 - width: parent.width
4521 - elide: Text.ElideRight
3610 + anchors.centerIn: parent
3611 + spacing: 12
4524 3613 Rectangle {
4525 - width: parent.width
4526 - height: 8
4527 - radius: 4
4528 - color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.22) : "transparent"
4530 - Rectangle {
4531 - anchors.left: parent.left
4532 - anchors.top: parent.top
4533 - anchors.bottom: parent.bottom
4534 - width: parent.width * (root.preview.available ? 0.72 : 0.24)
4535 - radius: parent.radius
4536 - color: root.theme ? root.theme.ui.accent : "white"
4545 - Column {
4546 - objectName: "detailsRows"
4547 - width: parent.width
4548 - spacing: 5
4550 - Repeater {
4551 - model: root.details
4553 - delegate: Rectangle {
4554 - id: detailRow
4556 - required property var modelData
4558 - width: root.width
4559 - height: 28
4560 - radius: 9
4561 - color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.08) : "transparent"
4562 - border.width: 1
4563 - border.color: root.roleColor(detailRow.modelData.role || "ui.minor")
4565 - NuguText {
4566 - anchors.left: parent.left
4567 - anchors.leftMargin: 8
4568 - anchors.verticalCenter: parent.verticalCenter
4569 - theme: root.theme
4570 - variant: "meta"
4571 - text: detailRow.modelData.label
4572 - width: 82
4573 - elide: Text.ElideRight
4576 - NuguText {
4577 - anchors.left: parent.left
4578 - anchors.leftMargin: 96
4579 - anchors.right: parent.right
4580 - anchors.rightMargin: 8
4581 - anchors.verticalCenter: parent.verticalCenter
4582 - theme: root.theme
4583 - text: detailRow.modelData.value || ""
4584 - elide: Text.ElideRight
4593 - Column {
4594 - objectName: "ruleHintRows"
4595 - width: parent.width
4596 - spacing: 5
4598 - NuguText {
4599 - theme: root.theme
4600 - variant: "meta"
4601 - text: "rule hints"
4602 - visible: root.hints.length > 0
4605 - Repeater {
4606 - model: root.hints
4608 - delegate: Rectangle {
4609 - id: hintRow
4611 - required property string modelData
4613 - width: root.width
4614 - height: 26
4615 - radius: 9
4616 - color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.1) : "transparent"
4617 - border.width: 1
4618 - border.color: root.theme ? root.theme.ui.accent : "transparent"
4620 - NuguText {
4621 - anchors.left: parent.left
4622 - anchors.right: parent.right
4623 - anchors.leftMargin: 8
4624 - anchors.rightMargin: 8
4625 - anchors.verticalCenter: parent.verticalCenter
4626 - theme: root.theme
4627 - variant: "meta"
4628 - text: hintRow.modelData
4629 - elide: Text.ElideRight
4636 - Rectangle {
4637 - width: root.width
4638 - height: root.hints.length === 0 ? 26 : 0
4639 - visible: height > 0
4640 - radius: 9
4641 - color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.08) : "transparent"
4642 - border.width: 1
4643 - border.color: root.theme ? root.theme.ui.minor : "transparent"
4645 - NuguText {
4646 - anchors.centerIn: parent
4647 - theme: root.theme
4648 - variant: "meta"
4649 - text: "no rule hint until a window is focused"
4656 - Rectangle {
4657 - objectName: "workspaceMoveAffordance"
4658 - width: parent.width
4659 - height: 30
4660 - radius: 10
4661 - color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.12) : "transparent"
4662 - border.width: 1
4663 - border.color: root.theme ? root.theme.ui.accent : "transparent"
4665 - NuguText {
4666 - anchors.left: parent.left
4667 - anchors.leftMargin: 8
4668 - anchors.verticalCenter: parent.verticalCenter
4669 - theme: root.theme
4670 - variant: "meta"
4671 - text: `workspace move route: ${root.card.actionRow ? root.card.actionRow.route : "Niri.qml"}`
4672 - width: parent.width - 16
4673 - elide: Text.ElideRight
4678 - Row {
4679 - objectName: "windowActionRail"
4680 - width: parent.width
4681 - spacing: 6
4683 - Repeater {
4684 - model: root.actions
4686 - delegate: Rectangle {
4687 - id: actionButton
4689 - required property var modelData
4691 - width: Math.floor((root.width - 18) / 4)
4692 - height: 32
4693 - radius: 10
4694 - color: root.theme ? root.theme.withAlpha(modelData.destructive ? root.theme.error : root.theme.ui.accent, 0.14) : "transparent"
4695 - border.width: 1
4696 - border.color: root.theme ? (modelData.destructive ? root.theme.error : root.theme.ui.accent) : "transparent"
3614 + anchors.horizontalCenter: parent.horizontalCenter
3615 + width: 68
3616 + height: 68
3617 + radius: 34
3618 + color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.16) : "transparent"
4698 3620 NuguText {
4699 3621 anchors.centerIn: parent
4700 3622 theme: root.theme
4701 - variant: "meta"
4702 - text: actionButton.modelData.id === "toggle-fullscreen" ? "full" : actionButton.modelData.id === "move-workspace" ? "move" : actionButton.modelData.label
4703 - elide: Text.ElideRight
4706 - MouseArea {
4707 - anchors.fill: parent
4708 - onClicked: root.runAction(actionButton.modelData.id)
3623 + variant: "title"
3624 + selected: true
3625 + text: "♪"
3630 + NuguText {
3631 + anchors.horizontalCenter: parent.horizontalCenter
3632 + theme: root.theme
3633 + variant: "title"
3634 + text: "Nothing playing"
3637 + NuguText {
3638 + anchors.horizontalCenter: parent.horizontalCenter
3639 + theme: root.theme
3640 + variant: "meta"
3641 + text: "Start a track — controls appear here"
4717 - NuguText {
4718 - theme: root.theme
4719 - variant: "meta"
4720 - text: root.card.lastWindowAction && root.card.lastWindowAction.kind ? `last: ${root.card.lastWindowAction.kind} → ${root.card.lastWindowAction.niriAction}` : "Enter focuses · Delete closes"
4721 - width: parent.width
4722 - elide: Text.ElideRight

quickshell/nuguland/Power.qml

Modified
8 8 property QtObject lockService
9 9 property QtObject niriService
10 - property string smokeProfile: "balanced"
10 + property string selectedProfile: "balanced"
11 11 property string pendingConfirmation: ""
12 + property var powerHistorySamples: []
12 13 property var lastAction: ({
14 - property var smokeDisplayBattery: ({
15 - "id": "BAT0",
16 - "percent": 73,
17 - "state": "discharging",
18 - "timeEstimate": "3h 12m",
19 - "health": 91,
20 - "profile": "balanced"
21 - })
22 - property var smokeExternalDevices: [{
23 - "id": "mouse",
24 - "name": "Nugu Mouse",
25 - "type": "pointer",
26 - "percent": 62,
27 - "state": "discharging"
28 - }, {
29 - "id": "headphones",
30 - "name": "Nugu Headphones",
31 - "type": "audio",
32 - "percent": 87,
33 - "state": "discharging"
34 - }]
35 - readonly property bool testHarness: Quickshell.env("NUGULAND_SMOKE") === "1"
36 - readonly property bool nativeActionRoute: !testHarness
15 + readonly property bool nativeActionRoute: true
37 16 readonly property bool usesUPower: true
17 + readonly property bool powerProfilesAvailable: false
38 18 readonly property var boundedActions: ["lock", "logout", "suspend", "reboot", "poweroff", "monitor-off", "monitor-on", "set-profile", "confirm", "cancel"]
39 19 readonly property var destructiveActions: ["logout", "reboot", "poweroff"]
52 32 function currentProfile() {
53 - return testHarness ? smokeProfile : normalizeProfile(PowerProfile.toString(PowerProfiles.profile));
33 + return selectedProfile;
34 + }
36 + function normalizePercent(value) {
37 + const n = Number(value || 0);
38 + if (n > 0 && n <= 1)
39 + return Math.round(n * 100);
41 + return Math.round(n);
56 44 function deviceState(device) {
57 - return String(UPowerDeviceState.toString(device.state || UPowerDeviceState.Unknown)).toLowerCase().replace("fullycharged", "full");
45 + return String(UPowerDeviceState.toString(device.state || UPowerDeviceState.Unknown)).toLowerCase().replace(/\s+/g, "").replace("fullycharged", "full");
60 48 function minutesToLabel(seconds) {
76 64 function nativeBatteryObject() {
77 65 const device = UPower.displayDevice;
78 66 if (!device || !device.ready)
79 - return smokeDisplayBattery;
67 + return {
68 + "id": "display",
69 + "percent": 0,
70 + "state": "unknown",
71 + "timeEstimate": "unknown",
72 + "health": -1,
73 + "profile": currentProfile()
74 + };
81 76 const state = deviceState(device);
82 77 const timeEstimate = state === "charging" ? minutesToLabel(device.timeToFull) : minutesToLabel(device.timeToEmpty);
83 78 return {
84 79 "id": String(device.nativePath || "display"),
85 - "percent": Math.round(Number(device.percentage || 0)),
80 + "percent": normalizePercent(device.percentage),
86 81 "state": state,
87 82 "timeEstimate": timeEstimate,
88 83 "health": device.healthSupported ? Math.round(Number(device.healthPercentage || 0)) : -1,
93 88 function displayBattery() {
94 - return testHarness ? Object.assign({
95 - }, smokeDisplayBattery, {
96 - "profile": smokeProfile
97 - }) : nativeBatteryObject();
89 + return nativeBatteryObject();
100 92 function nativeExternalDevices() {
109 101 "id": String(device.nativePath || device.model || `device-${i}`),
110 102 "name": String(device.model || UPowerDeviceType.toString(device.type)),
111 103 "type": String(UPowerDeviceType.toString(device.type)).toLowerCase(),
112 - "percent": Math.round(Number(device.percentage || 0)),
104 + "percent": normalizePercent(device.percentage),
113 105 "state": deviceState(device)
119 111 function externalDevices() {
120 - return testHarness ? smokeExternalDevices : nativeExternalDevices();
112 + return nativeExternalDevices();
123 115 function externalDevicesById() {
147 139 return "ui.accent";
142 + function batteryFraction() {
143 + return Math.max(0, Math.min(1, Number(displayBattery().percent || 0) / 100));
146 + function appendPowerHistorySample() {
147 + const next = powerHistorySamples.slice(Math.max(0, powerHistorySamples.length - 3599));
148 + next.push([batteryFraction(), chargingValue(), profileValue(), healthFraction(), 0]);
149 + powerHistorySamples = next;
152 + function chargingValue() {
153 + return displayBattery().state === "charging" ? 1 : 0;
156 + function profileValue() {
157 + const profile = currentProfile();
158 + if (profile === "performance")
159 + return 1;
161 + if (profile === "power-saver")
162 + return 0;
164 + return 0.5;
167 + function healthFraction() {
168 + const health = Number(displayBattery().health || 0);
169 + return health > 0 ? Math.max(0, Math.min(1, health / 100)) : 1;
172 + function lowPowerMode() {
173 + const state = String(displayBattery().state || "").toLowerCase();
174 + return state.indexOf("discharging") >= 0 || state.indexOf("pendingdischarge") >= 0;
150 177 function batteryObject() {
151 178 const battery = displayBattery();
152 179 return {
184 211 return {
185 212 "backend": "Power.qml",
186 213 "usesUPower": usesUPower,
187 - "testHarness": testHarness,
188 214 "nativeActionRoute": nativeActionRoute,
189 215 "helperProcesses": [],
190 216 "serviceOwnedActions": true,
191 217 "boundedActions": boundedActions,
192 218 "powerPanelContract": powerPanelContract(),
193 219 "profile": currentProfile(),
220 + "powerProfilesAvailable": powerProfilesAvailable,
221 + "lowPowerMode": lowPowerMode(),
222 + "lowPowerPolicy": {
223 + "trigger": "battery-discharge",
224 + "shaders": false,
225 + "animations": false
226 + },
194 227 "battery": battery,
195 228 "externalDevices": devices.map((device) => {
196 229 return ({
215 248 "compact": {
216 - "label": `${battery.percent}%`,
249 + "label": "Power",
217 250 "role": battery.role,
218 251 "charging": battery.state === "charging"
253 + "shader": {
254 + "kind": "power-gradient",
255 + "clipped": true,
256 + "source": "shaders/power-gradient.frag.qsb",
257 + "priorArt": "Made by Evan fwidth/smoothstep antialiased line ideas adapted to a foreground-only battery history sparkline",
258 + "values": [batteryFraction(), chargingValue(), profileValue(), healthFraction()],
259 + "colors": ["ui.accent", "ui.focus", "ui.minor", "ui.backdrop", "warning", "error"]
260 + },
220 261 "pendingConfirmation": pendingConfirmation,
221 262 "lastAction": lastAction
229 270 function setProfile(name) {
230 271 const selected = normalizeProfile(name);
231 - if (testHarness) {
232 - smokeProfile = selected;
233 - smokeDisplayBattery = Object.assign({
234 - }, smokeDisplayBattery, {
235 - "profile": smokeProfile
236 - });
237 - } else {
238 - if (selected === "performance")
239 - PowerProfiles.profile = PowerProfile.Performance;
240 - else if (selected === "power-saver")
241 - PowerProfiles.profile = PowerProfile.PowerSaver;
242 - else
243 - PowerProfiles.profile = PowerProfile.Balanced;
244 - }
272 + selectedProfile = selected;
245 273 pendingConfirmation = "";
246 274 lastAction = {
247 275 "kind": "set-profile",
248 276 "profile": selected,
249 - "nativeActionRoute": nativeActionRoute,
250 - "testHarness": testHarness
277 + "nativeActionRoute": nativeActionRoute
252 279 return stateJson();
259 286 function executeSessionAction(actionName) {
260 - if (testHarness)
261 - return ;
263 287 if (actionName === "lock" && lockService)
264 288 lockService.request();
265 289 else if (actionName === "monitor-off" && niriService)
275 299 lastAction = {
276 300 "kind": actionName,
277 301 "nativeActionRoute": nativeActionRoute,
278 - "testHarness": testHarness,
279 302 "confirmed": false
281 304 } else {
284 307 lastAction = {
285 308 "kind": actionName,
286 309 "nativeActionRoute": nativeActionRoute,
287 - "testHarness": testHarness,
288 310 "confirmed": true
301 323 lastAction = {
302 324 "kind": actionName,
303 325 "nativeActionRoute": nativeActionRoute,
304 - "testHarness": testHarness,
305 326 "confirmed": confirmed
307 328 return stateJson();
315 336 return stateJson();
339 + Component.onCompleted: appendPowerHistorySample()
341 + Timer {
342 + interval: 2000
343 + repeat: true
344 + running: true
345 + onTriggered: root.appendPowerHistorySample()

quickshell/nuguland/Privilege.qml

Modified
15 15 property var lastAction: ({
17 - readonly property bool testHarness: Quickshell.env("NUGULAND_SMOKE") === "1"
18 - readonly property bool nativeActionRoute: !testHarness
19 - readonly property var boundedActions: ["begin-test-request", "submit", "deny", "cancel", "fail", "clear"]
17 + readonly property bool nativeActionRoute: true
18 + readonly property var boundedActions: ["submit", "deny", "cancel", "fail", "clear"]
20 19 readonly property var buttons: ["deny", "cancel", "confirm"]
20 + readonly property var polkitAgent: polkitAgentLoader.item
22 22 function privilegeSurfacePanelContract() {
23 23 return {
40 40 return {
41 41 "backend": "Privilege.qml",
42 42 "usesNativePolkitAgent": true,
43 - "testHarness": testHarness,
44 43 "nativeActionRoute": nativeActionRoute,
45 - "agentPath": polkitAgent.path,
46 - "agentRegistered": !!polkitAgent.isRegistered,
47 - "agentActive": !!polkitAgent.isActive,
44 + "agentPath": "/org/nuguland/PolkitAgent",
45 + "agentRegistered": !!(polkitAgent && polkitAgent.isRegistered),
46 + "agentActive": !!(polkitAgent && polkitAgent.isActive),
48 47 "helperProcesses": [],
49 48 "serviceOwnedActions": true,
50 49 "boundedActions": boundedActions,
68 67 return JSON.stringify(stateObject());
71 - function beginTestRequest(app, actionId, message) {
72 - if (!testHarness) {
73 - error = "test-request-disabled";
74 - lastAction = {
75 - "kind": "begin-test-request",
76 - "accepted": false,
77 - "nativeActionRoute": nativeActionRoute
78 - };
79 - return stateJson();
80 - }
81 - active = true;
82 - completed = false;
83 - authorized = false;
84 - cancelled = false;
85 - error = "";
86 - request = {
87 - "app": String(app),
88 - "actionId": String(actionId),
89 - "message": String(message),
90 - "prompt": "Password",
91 - "responseVisible": false
92 - };
93 - lastAction = {
94 - "kind": "begin-test-request",
95 - "app": request.app,
96 - "actionId": request.actionId,
97 - "nativeActionRoute": false,
98 - "testHarness": true
99 - };
100 - return stateJson();
101 - }
103 70 function finish(granted) {
104 71 active = false;
105 72 completed = true;
111 78 function submit(secret) {
112 79 const length = String(secret).length;
113 - const flow = polkitAgent.flow;
114 - if (testHarness)
115 - finish(true);
116 - else if (flow && flow.isResponseRequired)
80 + const flow = polkitAgent ? polkitAgent.flow : null;
81 + if (flow && flow.isResponseRequired)
117 82 flow.submit(String(secret));
119 84 error = "no-active-polkit-flow";
120 85 lastAction = {
121 86 "kind": "submit",
122 87 "secretLength": length,
123 - "nativeActionRoute": nativeActionRoute,
124 - "testHarness": testHarness
88 + "nativeActionRoute": nativeActionRoute
126 90 return stateJson();
129 93 function deny() {
130 - const flow = polkitAgent.flow;
131 - if (!testHarness && flow)
94 + const flow = polkitAgent ? polkitAgent.flow : null;
95 + if (flow)
132 96 flow.cancelAuthenticationRequest();
134 98 active = false;
138 102 error = "";
139 103 lastAction = {
140 104 "kind": "deny",
141 - "nativeActionRoute": nativeActionRoute,
142 - "testHarness": testHarness
105 + "nativeActionRoute": nativeActionRoute
144 107 return stateJson();
147 110 function cancel() {
148 - const flow = polkitAgent.flow;
149 - if (!testHarness && flow)
111 + const flow = polkitAgent ? polkitAgent.flow : null;
112 + if (flow)
150 113 flow.cancelAuthenticationRequest();
152 115 active = false;
156 119 error = "";
157 120 lastAction = {
158 121 "kind": "cancel",
159 - "nativeActionRoute": nativeActionRoute,
160 - "testHarness": testHarness
122 + "nativeActionRoute": nativeActionRoute
162 124 return stateJson();
189 151 return stateJson();
192 - PolkitAgent {
193 - id: polkitAgent
154 + Loader {
155 + id: polkitAgentLoader
157 + active: true
159 + sourceComponent: PolkitAgent {
160 + path: "/org/nuguland/PolkitAgent"
195 - path: "/org/nuguland/PolkitAgent"
198 165 Connections {
199 166 function onAuthenticationRequestStarted() {
200 - const flow = polkitAgent.flow;
167 + const flow = polkitAgent ? polkitAgent.flow : null;
201 168 root.active = true;
202 169 root.completed = false;
203 170 root.authorized = false;
233 200 root.cancel();
236 - target: polkitAgent.flow
203 + target: !polkitAgent ? null : polkitAgent.flow

quickshell/nuguland/Resources.qml

Modified
7 7 property real cpuUsage: 0
8 8 property real previousIdle: 0
9 9 property real previousTotal: 0
10 + readonly property int sampleIntervalMs: 2000
11 + readonly property int historyWindowSeconds: 7200
12 + readonly property int historySampleLimit: 3600
10 13 property var cpuHistory: [0.12, 0.24, 0.38, 0.72]
14 + property var systemHistorySamples: []
15 + property var networkHistorySamples: []
16 + property real memoryUsage: 0
17 + property real swapUsage: 0
18 + property real memTotal: 0
19 + property real memAvailable: 0
20 + property real swapTotal: 0
21 + property real swapFree: 0
22 + property real networkRxRate: 0
23 + property real networkTxRate: 0
24 + property real diskReadRate: 0
25 + property real diskWriteRate: 0
26 + property real previousNetworkRx: 0
27 + property real previousNetworkTx: 0
28 + property real previousDiskRead: 0
29 + property real previousDiskWrite: 0
30 + property real previousRateTime: 0
31 + property string tempLabel: "n/a"
32 + property real cpuTemperatureC: 0
33 + property var temperatureHistorySamples: []
34 + readonly property int hotHoldSeconds: 10
35 + readonly property int coolHoldSeconds: 10
36 + readonly property real cpuTempSensorHighC: 87
37 + property int firestormHotSeconds: 0
38 + property int firestormCoolSeconds: 0
39 + property real firestormTarget: 0
40 + property var processes: []
41 + property var lastBtmAction: ({
42 + })
12 - function cpuSignal(value) {
44 + function clamp01(value) {
45 + return Math.max(0, Math.min(1, Number(value)));
46 + }
48 + function signalFor(value) {
13 49 if (value >= 0.9)
14 50 return "error";
19 55 return "normal";
22 - function cpuColorRole(value) {
23 - const signal = cpuSignal(value);
58 + function colorRoleFor(value) {
59 + const signal = signalFor(value);
24 60 if (signal === "error")
25 61 return "error";
30 66 return "ui.accent";
33 - function cpuWidgetState(value) {
34 - const clamped = Math.max(0, Math.min(1, Number(value)));
69 + function formatBytes(value) {
70 + const bytes = Math.max(0, Number(value));
71 + if (bytes >= 1.07374e+09)
72 + return `${(bytes / 1073741824).toFixed(1)} GiB`;
74 + if (bytes >= 1.04858e+06)
75 + return `${(bytes / 1048576).toFixed(1)} MiB`;
77 + if (bytes >= 1024)
78 + return `${(bytes / 1024).toFixed(1)} KiB`;
80 + return `${Math.round(bytes)} B`;
81 + }
83 + function formatRate(value) {
84 + return `${formatBytes(value)}/s`;
85 + }
87 + function networkRxLevel() {
88 + return clamp01(networkRxRate / 262144);
89 + }
91 + function networkTxLevel() {
92 + return clamp01(networkTxRate / 262144);
93 + }
95 + function diskLevel() {
96 + return clamp01((diskReadRate + diskWriteRate) / 8.38861e+06);
97 + }
99 + function temperatureLevel() {
100 + return clamp01(cpuTemperatureC / Math.max(temperatureHighThresholdC(), 1));
103 + function systemLoad() {
104 + return Math.max(cpuUsage, memoryUsage, swapUsage);
107 + function systemSignal(value) {
108 + return signalFor(value);
111 + function systemColorRole(value) {
112 + return colorRoleFor(value);
115 + function appendHistorySample(history, sample) {
116 + const next = history.slice(Math.max(0, history.length - historySampleLimit + 1));
117 + next.push(sample.map((value) => {
118 + return clamp01(value);
119 + }));
120 + return next;
123 + function appendNumericHistorySample(history, value) {
124 + const next = history.slice(Math.max(0, history.length - historySampleLimit + 1));
125 + const numeric = Number(value);
126 + if (Number.isFinite(numeric) && numeric > 0)
127 + next.push(numeric);
129 + return next;
132 + function percentile(values, ratio) {
133 + const sorted = (values || []).filter((value) => {
134 + return Number.isFinite(Number(value)) && Number(value) > 0;
135 + }).map(Number).sort((a, b) => {
136 + return a - b;
137 + });
138 + if (sorted.length === 0)
139 + return 61;
141 + const index = Math.max(0, Math.min(sorted.length - 1, Math.ceil((sorted.length - 1) * ratio)));
142 + return sorted[index];
145 + function temperatureHighThresholdC() {
146 + return Math.max(72, Math.min(87, percentile(temperatureHistorySamples, 0.95) + 8));
149 + function temperatureCoolThresholdC() {
150 + return temperatureHighThresholdC() - 5;
153 + function updateFirestormState() {
154 + const temp = Number(cpuTemperatureC);
155 + if (!Number.isFinite(temp) || temp <= 0)
156 + return ;
158 + const high = temperatureHighThresholdC();
159 + const cool = temperatureCoolThresholdC();
160 + if (temp >= high) {
161 + firestormHotSeconds = Math.min(hotHoldSeconds, firestormHotSeconds + sampleIntervalMs / 1000);
162 + firestormCoolSeconds = 0;
163 + } else if (temp <= cool) {
164 + firestormCoolSeconds = Math.min(coolHoldSeconds, firestormCoolSeconds + sampleIntervalMs / 1000);
165 + firestormHotSeconds = 0;
167 + if (firestormHotSeconds >= hotHoldSeconds)
168 + firestormTarget = 1;
170 + if (firestormCoolSeconds >= coolHoldSeconds)
171 + firestormTarget = 0;
175 + function systemHistorySample() {
176 + return [cpuUsage, memoryUsage, swapUsage, diskLevel(), temperatureLevel()];
179 + function networkHistorySample() {
180 + return [networkRxLevel(), networkTxLevel(), 0, 0];
183 + function refreshHistories() {
184 + systemHistorySamples = appendHistorySample(systemHistorySamples, systemHistorySample());
185 + networkHistorySamples = appendHistorySample(networkHistorySamples, networkHistorySample());
188 + function shaderHistoryObject(samples) {
189 + return {
190 + "windowSeconds": historyWindowSeconds,
191 + "sampleIntervalMs": sampleIntervalMs,
192 + "sampleLimit": historySampleLimit,
193 + "sampleCount": samples.length
194 + };
197 + function systemWidgetState() {
198 + const load = systemLoad();
35 199 return JSON.stringify({
36 - "usage": clamped,
37 - "percent": Math.round(clamped * 100),
38 - "signal": cpuSignal(clamped),
39 - "colorRole": cpuColorRole(clamped)
200 + "kind": "system",
201 + "title": "system",
202 + "load": load,
203 + "percent": Math.round(load * 100),
204 + "signal": systemSignal(load),
205 + "colorRole": systemColorRole(load),
206 + "barLabel": "system",
207 + "shader": {
208 + "kind": "system-mini-graph",
209 + "clipped": true,
210 + "source": "shaders/system-mini-graph.frag.qsb",
211 + "priorArt": "Shadertoy smoothstep and distance-to-segment line drawing primitives plus heat haze sine/noise thermal shimmer",
212 + "values": [cpuUsage, memoryUsage, swapUsage, diskLevel()],
213 + "history": shaderHistoryObject(systemHistorySamples),
214 + "colors": ["ui.accent", "ui.focus", "warning", "ui.minor", "error"]
215 + },
216 + "cpu": {
217 + "usage": cpuUsage,
218 + "percent": Math.round(cpuUsage * 100)
219 + },
220 + "memory": {
221 + "usage": memoryUsage,
222 + "percent": Math.round(memoryUsage * 100),
223 + "used": Math.max(0, memTotal - memAvailable),
224 + "total": memTotal,
225 + "label": `${formatBytes(Math.max(0, memTotal - memAvailable))} / ${formatBytes(memTotal)}`
226 + },
227 + "swap": {
228 + "usage": swapUsage,
229 + "percent": Math.round(swapUsage * 100),
230 + "used": Math.max(0, swapTotal - swapFree),
231 + "total": swapTotal,
232 + "label": swapTotal > 0 ? `${formatBytes(Math.max(0, swapTotal - swapFree))} / ${formatBytes(swapTotal)}` : "off"
233 + },
234 + "network": {
235 + "rxRate": networkRxRate,
236 + "txRate": networkTxRate,
237 + "label": `↓ ${formatRate(networkRxRate)} ↑ ${formatRate(networkTxRate)}`
238 + },
239 + "disk": {
240 + "readRate": diskReadRate,
241 + "writeRate": diskWriteRate,
242 + "level": diskLevel(),
243 + "label": `R ${formatRate(diskReadRate)} W ${formatRate(diskWriteRate)}`
244 + },
245 + "temperature": {
246 + "label": tempLabel,
247 + "celsius": cpuTemperatureC,
248 + "level": temperatureLevel(),
249 + "highThresholdC": temperatureHighThresholdC(),
250 + "coolThresholdC": temperatureCoolThresholdC(),
251 + "firestormTarget": firestormTarget
252 + },
253 + "processes": processes,
254 + "btmAction": lastBtmAction
43 258 function resourceHeroCard(kind, value, samples) {
44 - const clamped = Math.max(0, Math.min(1, Number(value)));
259 + const name = String(kind || "system");
260 + const clamped = clamp01(value);
45 261 const boundedSamples = (samples || []).map((sample) => {
46 - return Math.max(0, Math.min(1, Number(sample)));
262 + return clamp01(sample);
47 263 }).slice(-24);
48 264 return JSON.stringify({
49 - "source": "Nuguland performance HeroCard.qml plus Nuguland Graph.qml",
50 - "kind": String(kind || "cpu"),
51 - "title": String(kind || "cpu").toUpperCase(),
265 + "kind": name,
266 + "title": name === "system" ? "System" : name.toUpperCase(),
52 267 "value": clamped,
53 268 "percent": Math.round(clamped * 100),
54 - "signal": cpuSignal(clamped),
55 - "role": cpuColorRole(clamped),
269 + "signal": signalFor(clamped),
270 + "role": colorRoleFor(clamped),
56 271 "boundedHeroMeter": {
57 - "source": "Nuguland performance HeroCard.qml",
58 272 "value": clamped,
59 273 "min": 0,
60 274 "max": 1,
61 275 "shape": clamped >= 0.8 ? "burst" : (clamped >= 0.4 ? "sunny" : "plain"),
62 - "role": cpuColorRole(clamped)
276 + "role": colorRoleFor(clamped)
64 278 "sparkline": {
65 - "source": "Nuguland Graph.qml",
66 279 "fillOpacity": 0.22,
67 280 "sampleCount": boundedSamples.length,
68 281 "alignment": "right"
91 304 previousTotal = total;
92 305 previousIdle = idle;
93 306 if (totalDelta > 0) {
94 - cpuUsage = Math.max(0, Math.min(1, 1 - idleDelta / totalDelta));
307 + cpuUsage = clamp01(1 - idleDelta / totalDelta);
95 308 const nextHistory = cpuHistory.slice(-23);
96 309 nextHistory.push(cpuUsage);
97 310 cpuHistory = nextHistory;
314 + function refreshMemory() {
315 + meminfoFile.reload();
316 + const values = ({
317 + });
318 + const lines = meminfoFile.text().split("\n");
319 + for (let i = 0; i < lines.length; i++) {
320 + const match = lines[i].match(/^([A-Za-z_()]+):\s+(\d+)/);
321 + if (match)
322 + values[match[1]] = Number(match[2]) * 1024;
325 + memTotal = Number(values.MemTotal || 0);
326 + memAvailable = Number(values.MemAvailable || values.MemFree || 0);
327 + swapTotal = Number(values.SwapTotal || 0);
328 + swapFree = Number(values.SwapFree || 0);
329 + memoryUsage = memTotal > 0 ? clamp01((memTotal - memAvailable) / memTotal) : 0;
330 + swapUsage = swapTotal > 0 ? clamp01((swapTotal - swapFree) / swapTotal) : 0;
333 + function applyProcessSnapshot(text) {
334 + const rows = [];
335 + const lines = String(text || "").trim().split("\n");
336 + for (let i = 0; i < lines.length; i++) {
337 + const parts = lines[i].trim().split(/\s+/);
338 + if (parts.length < 4)
339 + continue;
341 + rows.push({
342 + "pid": Number(parts[0]),
343 + "name": parts[1],
344 + "cpu": Number(parts[2]) || 0,
345 + "mem": Number(parts[3]) || 0
346 + });
348 + processes = rows;
351 + function applyTemperature(text) {
352 + tempLabel = String(text || "n/a").trim() || "n/a";
353 + const match = tempLabel.match(/([0-9]+(?:\.[0-9]+)?)/);
354 + cpuTemperatureC = match ? Number(match[1]) : 0;
355 + temperatureHistorySamples = appendNumericHistorySample(temperatureHistorySamples, cpuTemperatureC);
356 + updateFirestormState();
359 + function firestormState() {
360 + return JSON.stringify({
361 + "temperatureC": cpuTemperatureC,
362 + "label": tempLabel,
363 + "historySamples": temperatureHistorySamples.length,
364 + "historyP95C": percentile(temperatureHistorySamples, 0.95),
365 + "highThresholdC": temperatureHighThresholdC(),
366 + "coolThresholdC": temperatureCoolThresholdC(),
367 + "hotHoldSeconds": hotHoldSeconds,
368 + "coolHoldSeconds": coolHoldSeconds,
369 + "hotSeconds": firestormHotSeconds,
370 + "coolSeconds": firestormCoolSeconds,
371 + "firestormTarget": firestormTarget,
372 + "sensorFacts": {
373 + "currentObservedC": 61,
374 + "coretempHighC": cpuTempSensorHighC,
375 + "coretempCritC": 105
377 + });
380 + function refreshDetails() {
381 + if (!processScan.running)
382 + processScan.exec(["sh", "-c", "ps -eo pid=,comm=,pcpu=,pmem= --sort=-pcpu | head -n 5"]);
384 + if (!tempScan.running)
385 + tempScan.exec(["sh", "-c", "for f in /sys/class/thermal/thermal_zone*/temp /sys/class/hwmon/hwmon*/temp*_input; do [ -r \"$f\" ] || continue; v=$(cat \"$f\"); case \"$v\" in ''|*[!0-9]*) continue;; esac; awk -v v=\"$v\" 'BEGIN{printf \"%.0f°C\\n\", v/1000}'; exit; done; printf 'n/a\\n'"]);
389 + function launchBtm() {
390 + lastBtmAction = {
391 + "kind": "btm",
392 + "terminal": "wezterm",
393 + "argv": ["wezterm", "start", "--", "btm"]
394 + };
395 + btmLaunch.exec(["wezterm", "start", "--", "btm"]);
396 + return JSON.stringify(lastBtmAction);
399 + function refreshRates() {
400 + netFile.reload();
401 + diskFile.reload();
402 + let rx = 0;
403 + let tx = 0;
404 + const netLines = netFile.text().split("\n");
405 + for (let i = 0; i < netLines.length; i++) {
406 + const line = netLines[i];
407 + if (line.indexOf(":") < 0)
408 + continue;
410 + const pieces = line.split(":");
411 + const name = pieces[0].trim();
412 + if (name === "lo")
413 + continue;
415 + const fields = pieces[1].trim().split(/\s+/).map(Number);
416 + if (fields.length >= 16) {
417 + rx += fields[0];
418 + tx += fields[8];
421 + let readBytes = 0;
422 + let writeBytes = 0;
423 + const diskLines = diskFile.text().split("\n");
424 + for (let j = 0; j < diskLines.length; j++) {
425 + const fields = diskLines[j].trim().split(/\s+/);
426 + if (fields.length < 10)
427 + continue;
429 + const name = fields[2] || "";
430 + if (name.indexOf("loop") === 0 || name.indexOf("ram") === 0)
431 + continue;
433 + const readSectors = Number(fields[5]);
434 + const writeSectors = Number(fields[9]);
435 + if (Number.isFinite(readSectors))
436 + readBytes += readSectors * 512;
438 + if (Number.isFinite(writeSectors))
439 + writeBytes += writeSectors * 512;
442 + const now = Date.now();
443 + const seconds = previousRateTime > 0 ? Math.max(0.2, (now - previousRateTime) / 1000) : 0;
444 + if (seconds > 0) {
445 + networkRxRate = Math.max(0, (rx - previousNetworkRx) / seconds);
446 + networkTxRate = Math.max(0, (tx - previousNetworkTx) / seconds);
447 + diskReadRate = Math.max(0, (readBytes - previousDiskRead) / seconds);
448 + diskWriteRate = Math.max(0, (writeBytes - previousDiskWrite) / seconds);
450 + previousNetworkRx = rx;
451 + previousNetworkTx = tx;
452 + previousDiskRead = readBytes;
453 + previousDiskWrite = writeBytes;
454 + previousRateTime = now;
457 + function refreshSystem() {
458 + refreshCpu();
459 + refreshMemory();
460 + refreshRates();
461 + refreshHistories();
462 + refreshDetails();
101 465 FileView {
102 466 id: statFile
106 470 printErrors: false
473 + FileView {
474 + id: meminfoFile
476 + path: "/proc/meminfo"
477 + blockLoading: true
478 + printErrors: false
481 + FileView {
482 + id: netFile
484 + path: "/proc/net/dev"
485 + blockLoading: true
486 + printErrors: false
489 + FileView {
490 + id: diskFile
492 + path: "/proc/diskstats"
493 + blockLoading: true
494 + printErrors: false
497 + Process {
498 + id: processScan
500 + running: false
502 + stdout: StdioCollector {
503 + waitForEnd: true
504 + onStreamFinished: root.applyProcessSnapshot(this.text)
509 + Process {
510 + id: tempScan
512 + running: false
514 + stdout: StdioCollector {
515 + waitForEnd: true
516 + onStreamFinished: root.applyTemperature(this.text)
521 + Process {
522 + id: btmLaunch
524 + running: false
109 527 Timer {
110 528 interval: 2000
111 529 repeat: true
112 530 running: true
113 531 triggeredOnStart: true
114 - onTriggered: root.refreshCpu()
532 + onTriggered: root.refreshSystem()

quickshell/nuguland/Screenshots.qml

Modified
33 33 property var lastOsd: ({
35 - readonly property bool testHarness: Quickshell.env("NUGULAND_SMOKE") === "1"
36 - readonly property bool nativeActionRoute: !testHarness && !!niriService && !!niriService.available
35 + readonly property bool nativeActionRoute: !!niriService && !!niriService.available
37 36 readonly property var nativeActions: ["screenshot-screen", "screenshot-window", "screenshot", "pick-color"]
38 37 readonly property var boundedActions: ["focused-screen", "focused-window", "interactive", "select-region", "pick-color", "copy", "save", "open-record", "clear"]
39 38 readonly property var toolbarActions: ["copy", "save", "cancel", "color"]
54 53 "id": id,
55 54 "kind": kind,
56 55 "path": path,
57 - "source": testHarness ? "smoke-isolated" : "niri-native",
56 + "source": "niri-native",
58 57 "saved": true
60 59 for (let i = 0; i < recent.length; i++) {
168 167 "usesNiriNative": true,
169 168 "nativeActions": nativeActions,
170 169 "nativeActionRoute": nativeActionRoute,
171 - "testHarness": testHarness,
172 170 "helperProcesses": [],
173 171 "serviceOwnedActions": true,
174 172 "boundedActions": boundedActions,
253 251 "kind": "select-region",
254 252 "nativeAction": nativeAction,
255 253 "path": target,
256 - "nativeActionRoute": nativeActionRoute,
257 - "testHarness": testHarness
254 + "nativeActionRoute": nativeActionRoute
259 256 record("capture-select-region", "select-region", target);
260 257 return stateJson();
301 298 "nativeAction": nativeAction,
302 299 "path": target,
303 300 "nativeActionRoute": nativeActionRoute,
304 - "testHarness": testHarness
301 + "interactive": actionKind === "interactive"
306 303 record(id, actionKind, target);
307 304 return stateJson();
310 - function pickColor() {
311 - if (testHarness) {
312 - lastColor = "#d86dd8";
313 - } else {
314 - lastColor = "";
315 - if (nativeActionRoute)
316 - niriService.pickColor();
307 + function acceptPickedColor(color) {
308 + const value = String(color || "").toLowerCase();
309 + if (!/^#[0-9a-f]{6}$/.test(value))
310 + return ;
318 - }
319 - lastAction = {
320 - "kind": "pick-color",
321 - "nativeAction": "pick-color",
312 + lastColor = value;
313 + lastAction = Object.assign({
314 + }, lastAction, {
322 315 "color": lastColor,
323 - "nativeActionRoute": nativeActionRoute,
324 - "testHarness": testHarness
325 - };
316 + "completed": true
317 + });
326 318 if (osdService) {
328 - lastOsd = JSON.parse(osdService.trigger("color", testHarness ? lastColor : "picked"));
320 + lastOsd = JSON.parse(osdService.trigger("color", lastColor));
329 321 } catch (error) {
330 322 lastOsd = {
331 323 "event": "color",
338 330 "value": lastColor
335 + function pickColor() {
336 + lastColor = "";
337 + if (nativeActionRoute)
338 + niriService.pickColor();
340 + lastAction = {
341 + "kind": "pick-color",
342 + "nativeAction": "pick-color",
343 + "color": lastColor,
344 + "nativeActionRoute": nativeActionRoute,
345 + "interactive": true,
346 + "completed": false
347 + };
348 + lastOsd = {
349 + "event": "color",
350 + "value": "picking"
351 + };
341 352 return stateJson();
345 356 lastAction = {
346 357 "kind": String(kind),
347 358 "id": String(id),
348 - "nativeActionRoute": false,
349 - "testHarness": testHarness
359 + "nativeActionRoute": false
351 361 return stateJson();
359 369 return stateJson();
372 + Connections {
373 + function onLastPickedColorChanged() {
374 + root.acceptPickedColor(root.niriService.lastPickedColor);
377 + target: root.niriService

quickshell/nuguland/SurfaceManager.qml

Modified
21 21 property int barHeight: 34
22 22 property var anchorRegistry: ({
24 - property string gestureState: "idle"
25 - property var gestureStart: ({
26 - "x": 0,
27 - "y": 0
28 - })
29 - property var gestureCurrent: ({
30 - "x": 0,
31 - "y": 0
32 - })
33 - property var gesturePath: []
34 - property var gestureCommitRect: ({
35 - })
36 - readonly property int closeRetentionMs: 100
24 + readonly property int closeRetentionMs: 0
37 25 readonly property real goldenRatio: 1.61803
39 27 function parseRect(text) {
77 65 "width": width,
78 66 "height": heightBudget(260)
80 - case "cpu":
68 + case "system":
81 69 return {
82 70 "width": width,
83 - "height": heightBudget(300)
71 + "height": heightBudget(520)
85 73 case "notifications":
86 74 return {
92 80 "width": width,
93 81 "height": heightBudget(440)
95 - case "window":
96 - return {
97 - "width": width,
98 - "height": heightBudget(340)
99 - };
100 83 case "media":
101 84 return {
102 85 "width": width,
117 100 "width": width,
118 101 "height": heightBudget(520)
103 + case "brightness":
104 + return {
105 + "width": width,
106 + "height": heightBudget(260)
107 + };
120 108 case "connectivity":
121 109 return {
122 110 "width": width,
127 115 "width": width,
128 116 "height": heightBudget(480)
130 - case "screenshots":
131 - return {
132 - "width": width,
133 - "height": heightBudget(480)
134 - };
135 118 case "idle":
136 119 return {
137 120 "width": width,
138 121 "height": heightBudget(340)
140 - case "diagnostics":
141 - return {
142 - "width": width,
143 - "height": heightBudget(540)
144 - };
145 123 default:
146 124 return {
147 125 "width": width,
153 131 function popupWindowAnchorRect() {
154 - const contentSize = popoutContentSize(popoutName);
155 132 return {
156 - "x": Math.max(0, Math.round((screenWidth - contentSize.width) / 2)),
133 + "x": 0,
157 134 "y": Math.max(1, Math.round(barHeight)),
158 - "width": contentSize.width,
135 + "width": screenWidth > 0 ? screenWidth : popoutContentSize(popoutName).width,
159 136 "height": 1
163 140 function popupCardFrame(progress) {
164 141 const t = Math.max(0, Math.min(1, Number(progress)));
142 + const contentSize = popoutContentSize(popoutName);
143 + const surfaceWidth = screenWidth > 0 ? screenWidth : contentSize.width;
165 144 return {
166 145 "source": "simple-center-slide-fade",
167 146 "progress": t,
168 147 "currentRect": {
169 - "x": 8,
170 - "y": Math.round(-18 + 26 * t),
171 - "width": Math.max(1, Math.round(popoutContentSize(popoutName).width - 16)),
172 - "height": Math.max(1, Math.round(popoutContentSize(popoutName).height - 16))
148 + "x": Math.max(8, Math.round((surfaceWidth - contentSize.width) / 2) + 8),
149 + "y": Math.round(barHeight - 18 + 26 * t),
150 + "width": Math.max(1, Math.round(contentSize.width - 16)),
151 + "height": Math.max(1, Math.round(contentSize.height - 16))
174 153 "opacity": t
178 - function popupInputMaskFrame(progress) {
179 - return popupCardFrame(progress).currentRect;
180 - }
182 - function resetGesture() {
183 - gestureState = "idle";
184 - gestureStart = ({
185 - "x": 0,
186 - "y": 0
187 - });
188 - gestureCurrent = ({
189 - "x": 0,
190 - "y": 0
191 - });
192 - gesturePath = [];
193 - gestureCommitRect = ({
194 - });
195 - }
197 - function gesturePoint(x, y) {
198 - return {
199 - "x": Math.round(Number(x)),
200 - "y": Math.round(Number(y))
201 - };
202 - }
204 - function gesturePress(x, y) {
205 - gestureState = "armed";
206 - gestureStart = gesturePoint(x, y);
207 - gestureCurrent = gestureStart;
208 - gesturePath = ["press"];
209 - gestureCommitRect = ({
210 - });
211 - return popoutState();
212 - }
214 - function gestureDrag(x, y) {
215 - if (gestureState !== "armed" && gestureState !== "dragging")
216 - return popoutState();
218 - gestureState = "dragging";
219 - gestureCurrent = gesturePoint(x, y);
220 - if (gesturePath.indexOf("drag") < 0)
221 - gesturePath = gesturePath.concat(["drag"]);
223 - return popoutState();
224 - }
226 - function gestureCommit() {
227 - const x1 = Math.min(gestureStart.x, gestureCurrent.x);
228 - const y1 = Math.min(gestureStart.y, gestureCurrent.y);
229 - const x2 = Math.max(gestureStart.x, gestureCurrent.x);
230 - const y2 = Math.max(gestureStart.y, gestureCurrent.y);
231 - gestureState = "committed";
232 - gestureCommitRect = {
233 - "x": x1,
234 - "y": y1,
235 - "width": Math.max(0, x2 - x1),
236 - "height": Math.max(0, y2 - y1)
237 - };
238 - gesturePath = gesturePath.concat(["commit"]);
239 - return popoutState();
240 - }
242 - function gestureRelease(x, y) {
243 - if (gestureState !== "armed" && gestureState !== "dragging")
244 - return popoutState();
246 - gestureCurrent = gesturePoint(x, y);
247 - gesturePath = gesturePath.concat(["release"]);
248 - return gestureCommit();
249 - }
251 - function gestureCancel(reason) {
252 - gestureState = "cancelled";
253 - gestureCommitRect = ({
254 - });
255 - gesturePath = gesturePath.concat(["cancel"]);
256 - lastCloseReason = String(reason || "gesture-cancel");
257 - return popoutState();
258 - }
260 - function popoutGestureMachine() {
261 - return {
262 - "source": "Nuguland Interactions.qml",
263 - "ownedBy": "SurfaceManager.qml",
264 - "states": ["idle", "armed", "dragging", "committed", "cancelled"],
265 - "path": ["press", "drag", "release", "cancel", "commit"],
266 - "pointerParity": true,
267 - "keyboardParity": true,
268 - "compositorSpecific": false
269 - };
270 - }
272 157 function popoutContentCatalog() {
273 158 return JSON.stringify({
274 159 "host": "PopoutHost.qml",
280 165 "source": "Time.qml",
281 166 "visual": ["clock", "date", "calendar-grid", "agenda"]
283 - "cpu": {
284 - "component": "resource-card",
168 + "system": {
169 + "component": "system-resources",
285 170 "source": "Resources.qml",
286 - "visual": ["cpu-percent", "signal-role", "kernel-facts"]
171 + "visual": ["cpu", "memory", "swap", "disk-rate", "temperature", "process-table", "btm-launch"]
288 173 "notifications": {
289 174 "component": "notification-history",
295 180 "source": "Tray.qml",
296 181 "visual": ["items", "attention", "native-menu-host"]
298 - "window": {
299 - "component": "window-rule-card",
300 - "source": "Niri.qml",
301 - "visual": ["app-id", "title", "workspace", "rule-hints"]
302 - },
303 183 "media": {
304 184 "component": "media-controls",
305 185 "source": "Media.qml",
320 200 "source": "Audio.qml",
321 201 "visual": ["sinks", "sources", "streams", "mute"]
203 + "brightness": {
204 + "component": "brightness-control",
205 + "source": "Brightness.qml",
206 + "visual": ["level", "luminance-shader", "osd"]
207 + },
323 208 "connectivity": {
324 209 "component": "connectivity-panel",
325 210 "source": "Network.qml+Bluetooth.qml",
330 215 "source": "Power.qml",
331 216 "visual": ["battery", "profile", "session", "confirmation"]
333 - "screenshots": {
334 - "component": "screenshot-tools",
335 - "source": "Screenshots.qml",
336 - "visual": ["selection", "recent", "color", "actions"]
337 - },
338 218 "idle": {
339 219 "component": "idle-privacy",
340 220 "source": "Idle.qml",
341 221 "visual": ["inhibit", "duration", "activity", "privacy"]
342 - },
343 - "diagnostics": {
344 - "component": "diagnostics-card",
345 - "source": "Diagnostics.qml",
346 - "visual": ["services", "processes", "surfaces", "smoke"]
399 274 popoutClosing = false;
400 275 lastInteraction = "";
401 276 lastCloseReason = "";
402 - resetGesture();
403 277 popoutName = nextName;
404 278 activeLoaderName = nextName;
405 279 pendingLoaderName = "";
447 321 lastCloseReason = String(reason);
449 323 popoutOpen = false;
450 - popoutClosing = popoutName.length > 0;
324 + popoutClosing = false;
451 325 popoutProgress = 0;
452 - if (popoutClosing) {
453 - removingLoaderName = activeLoaderName || popoutName;
454 - previousContent = {
455 - "name": removingLoaderName,
456 - "size": popoutContentSize(removingLoaderName),
457 - "fade": "outgoingFade",
458 - "retentionMs": closeRetentionMs
459 - };
460 - }
461 - popoutPhase = popoutClosing ? "closing" : "closed";
462 - if (popoutClosing)
463 - unloadTimer.restart();
326 + popoutPhase = "closed";
327 + popoutName = "";
328 + activeLoaderName = "";
329 + pendingLoaderName = "";
330 + removingLoaderName = "";
331 + previousContent = ({
332 + });
465 333 return popoutState();
476 344 return popoutState();
479 - function popoutFocusPolicy() {
480 - return {
481 - "source": "Quickshell PopupWindow.grabFocus plus Nuguland Wrapper.qml Keys.onEscapePressed",
482 - "nativePopupGrabFocus": true,
483 - "compositorFocusGrab": false,
484 - "outsideCloseReason": "focus-grab-outside",
485 - "escapeCloseReason": "escape-key",
486 - "insideClicksRetain": true,
487 - "closeReasons": ["focus-grab-outside", "escape-key", "outside", "hideAll"]
488 - };
489 - }
491 - function hoverSwitchPolicy() {
492 - return {
493 - "source": "Nuguland bar.checkPopout hover switching",
494 - "event": "hover-switch",
495 - "switchesOnlyWhenOpen": true,
496 - "retainsPreviousDuringHoverSwitch": true,
497 - "anchorMorph": "none",
498 - "loaderPolicy": "single-popup-instant-content-replace"
499 - };
500 - }
502 - function loaderChoreography() {
503 - return {
504 - "policy": "single-popup-instant-content-replace",
505 - "source": "Nuguland single popup content switch",
506 - "activeLoaderName": activeLoaderName,
507 - "pendingLoaderName": pendingLoaderName,
508 - "removingLoaderName": removingLoaderName,
509 - "previousContent": previousContent,
510 - "incomingFade": {
511 - "from": 0,
512 - "to": 1,
513 - "ms": 90
514 - },
515 - "outgoingFade": {
516 - "from": 1,
517 - "to": 0,
518 - "ms": closeRetentionMs,
519 - "unloadAfter": true
520 - },
521 - "closeRetentionMs": closeRetentionMs,
522 - "sizeTween": {
523 - "width": false,
524 - "height": true,
525 - "ms": 90,
526 - "easing": "InOutCubic"
527 - },
528 - "anchorTween": {
529 - "rect": false,
530 - "origin": "center",
531 - "ms": 0,
532 - "easing": "None"
533 - },
534 - "separatorBridge": {
535 - "growsThroughBarSeparator": false,
536 - "clipsContent": true
537 - },
538 - "cachePolicy": "Loader destroys items on sourceComponent change; use persistent per-panel loaders if first-open lag remains"
539 - };
540 - }
542 347 function popoutState() {
543 348 const contentSize = popoutContentSize(popoutName);
544 349 const origin = {
558 363 "contentSize": contentSize,
559 364 "popupAnchorRect": popupWindowAnchorRect(),
560 365 "popupCardFrame": popupCardFrame(popoutProgress),
561 - "popupInputMaskFrame": popupInputMaskFrame(popoutProgress),
562 366 "activeLoaderName": activeLoaderName,
563 367 "pendingLoaderName": pendingLoaderName,
564 368 "removingLoaderName": removingLoaderName,
565 369 "previousContent": previousContent,
566 - "loaderChoreography": loaderChoreography(),
567 - "popoutFocusPolicy": popoutFocusPolicy(),
568 - "hoverSwitchPolicy": hoverSwitchPolicy(),
569 - "popoutGestureMachine": popoutGestureMachine(),
570 - "gestureState": gestureState,
571 - "gestureStart": gestureStart,
572 - "gestureCurrent": gestureCurrent,
573 - "gesturePath": gesturePath,
574 - "gestureCommitRect": gestureCommitRect,
575 370 "screen": {
576 371 "width": screenWidth,
577 372 "height": screenHeight,
582 377 "host": "bar",
583 378 "animation": "simple-center-slide-fade",
584 379 "direction": popoutClosing ? "up-out" : "down-in",
585 - "loaderActive": popoutOpen || popoutClosing,
380 + "loaderActive": popoutOpen,
586 381 "targetRect": popupWindowAnchorRect()

quickshell/nuguland/Theme.qml

Modified
3 3 import QtQuick
5 5 Item {
6 6 id: theme
8 + property bool lowPowerMode: false
8 9 readonly property string mode: "dark"
9 10 readonly property var palette: ({
10 11 "debug": "#ed5eed",
36 37 readonly property string warning: palette.warning
37 38 readonly property string info: palette.info
38 39 readonly property string debug: palette.debug
39 - readonly property string shadow: "#000000"
40 - readonly property string scrim: "#000000"
41 - readonly property var anim: ({
42 - "duration": ({
43 - "fast": 120,
44 - "normal": 200,
45 - "slow": 320
46 - }),
47 - "easing": ({
48 - "standard": [0.2, 0, 0, 1],
49 - "spatial": [0.23, 1, 0.32, 1]
50 - })
51 - })
53 41 function withAlpha(hex, alpha) {
54 42 const aa = Math.round(Math.max(0, Math.min(1, alpha)) * 255).toString(16).padStart(2, "0");

quickshell/nuguland/Time.qml

Modified
19 19 function formatClock(value) {
20 - const hour = value.getUTCHours();
21 - const minute = value.getUTCMinutes();
22 - const second = value.getUTCSeconds();
20 + const hour = value.getHours();
21 + const minute = value.getMinutes();
22 + const second = value.getSeconds();
23 23 return {
24 24 "hour": hour,
25 25 "minute": minute,
62 62 function formatDate(value) {
63 - const year = value.getUTCFullYear();
64 - const month = value.getUTCMonth() + 1;
65 - const day = value.getUTCDate();
66 - const weekday = weekdays[value.getUTCDay()];
63 + const year = value.getFullYear();
64 + const month = value.getMonth() + 1;
65 + const day = value.getDate();
66 + const weekday = weekdays[value.getDay()];
67 67 const monthName = monthNames[month - 1];
68 68 return {
69 69 "year": year,
71 71 "day": day,
72 72 "weekday": weekday,
73 73 "monthName": monthName,
74 + "isoDay": isoDay(value),
74 75 "line": `${weekday} ${day} ${monthName}`
78 79 function isoDay(value) {
79 - return `${value.getUTCFullYear()}-${pad(value.getUTCMonth() + 1)}-${pad(value.getUTCDate())}`;
80 + return `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(value.getDate())}`;
82 83 function relativeText(fromDate, toDate) {
115 116 "widgetProcesses": "forbidden",
116 117 "helperProcesses": [],
117 118 "font": "IBM Plex Mono",
118 - "timezone": "UTC",
119 + "timezone": "local",
119 120 "iso": value.toISOString(),
120 121 "clock": formatClock(value),
121 122 "odometerClock": odometerClock(value),
150 151 function calendar(year, month, selectedDay) {
151 - const first = new Date(Date.UTC(year, month - 1, 1));
152 - const mondayOffset = (first.getUTCDay() + 6) % 7;
153 - const cursor = new Date(first.getTime() - mondayOffset * 8.64e+07);
152 + const first = new Date(year, month - 1, 1);
153 + const mondayOffset = (first.getDay() + 6) % 7;
154 + const cursor = new Date(first.getFullYear(), first.getMonth(), first.getDate() - mondayOffset);
154 155 const todayIso = `${year}-${pad(month)}-${pad(selectedDay)}`;
155 156 const weeks = [];
156 157 for (let week = 0; week < 6; week++) {
157 158 const days = [];
158 159 for (let day = 0; day < 7; day++) {
159 160 const current = new Date(cursor.getTime());
160 - const inMonth = current.getUTCMonth() === month - 1;
161 - const currentDay = current.getUTCDate();
161 + const inMonth = current.getMonth() === month - 1;
162 + const currentDay = current.getDate();
162 163 const currentIso = isoDay(current);
163 164 days.push({
164 165 "iso": currentIso,
167 168 "selected": inMonth && currentDay === selectedDay,
168 169 "today": currentIso === todayIso
170 - cursor.setUTCDate(cursor.getUTCDate() + 1);
171 + cursor.setDate(cursor.getDate() + 1);
172 173 weeks.push(days);

quickshell/nuguland/Tray.qml

Modified
1 1 import QtQuick
2 +import Quickshell.Services.SystemTray
3 4 Item {
4 5 id: root
6 - property int attentionCount: 0
7 + property string selectedItemId: ""
7 8 property string expandedSubmenu: ""
8 9 property bool closeRequested: false
9 10 property string closeReason: ""
15 16 property var lastAction: ({
17 18 readonly property var rowKinds: ["action", "separator", "submenu", "check", "radio", "disabled"]
18 - property var menuRows: [{
19 - "id": "open",
20 - "kind": "action",
21 - "label": "Open",
22 - "enabled": true
23 - }, {
24 - "id": "sep-main",
25 - "kind": "separator",
26 - "label": "",
27 - "enabled": false
28 - }, {
29 - "id": "network",
30 - "kind": "submenu",
31 - "label": "Network",
32 - "enabled": true,
33 - "children": ["network-wifi", "network-vpn"]
34 - }, {
35 - "id": "audio",
36 - "kind": "submenu",
37 - "label": "Audio",
38 - "enabled": true,
39 - "children": ["audio-output", "audio-input"]
40 - }, {
41 - "id": "pin",
42 - "kind": "check",
43 - "label": "Pin to tray",
44 - "enabled": true,
45 - "checked": true
46 - }, {
47 - "id": "profile-balanced",
48 - "kind": "radio",
49 - "label": "Balanced",
50 - "enabled": true,
51 - "checked": true
52 - }, {
53 - "id": "quit-disabled",
54 - "kind": "disabled",
55 - "label": "Quit unavailable",
56 - "enabled": false
57 - }]
19 + readonly property var nativeItems: SystemTray.items.values
20 + readonly property int attentionCount: itemsArray().filter((item) => {
21 + return item.status === "NeedsAttention";
22 + }).length
59 24 function activeRole() {
60 25 return "ui.focus";
78 43 return active ? activeRole() : "transparent";
81 - function rowById(id) {
46 + function enumName(value, fallback) {
47 + const text = String(value === undefined || value === null ? "" : value);
48 + if (text.indexOf("NeedsAttention") >= 0)
49 + return "NeedsAttention";
51 + if (text.indexOf("Active") >= 0)
52 + return "Active";
54 + if (text.indexOf("Passive") >= 0)
55 + return "Passive";
57 + if (text.indexOf("Hardware") >= 0)
58 + return "Hardware";
60 + if (text.indexOf("SystemServices") >= 0)
61 + return "SystemServices";
63 + if (text.indexOf("Communications") >= 0)
64 + return "Communications";
66 + if (text.indexOf("ApplicationStatus") >= 0)
67 + return "ApplicationStatus";
69 + return fallback;
70 + }
72 + function itemKey(item, index) {
73 + const id = String(item && item.id ? item.id : "");
74 + const title = String(item && item.title ? item.title : (item && item.tooltipTitle ? item.tooltipTitle : ""));
75 + return id.length > 0 ? id : (title.length > 0 ? title : `tray-${index}`);
76 + }
78 + function shapeItem(item, index) {
79 + const id = itemKey(item, index);
80 + return {
81 + "id": id,
82 + "index": index,
83 + "title": String(item && item.title ? item.title : (item && item.tooltipTitle ? item.tooltipTitle : id)),
84 + "tooltipTitle": String(item && item.tooltipTitle ? item.tooltipTitle : ""),
85 + "tooltipDescription": String(item && item.tooltipDescription ? item.tooltipDescription : ""),
86 + "icon": String(item && item.icon ? item.icon : ""),
87 + "status": enumName(item ? item.status : null, "Passive"),
88 + "category": enumName(item ? item.category : null, "ApplicationStatus"),
89 + "hasMenu": !!(item && item.hasMenu),
90 + "onlyMenu": !!(item && item.onlyMenu),
91 + "nativeRoutes": ["activate", "secondaryActivate", "scroll", "display"],
92 + "backend": "SystemTrayItem"
93 + };
94 + }
96 + function itemsArray() {
97 + const result = [];
98 + for (let i = 0; i < nativeItems.length; i++) result.push(shapeItem(nativeItems[i], i))
99 + return result;
102 + function nativeItemById(id) {
82 103 const needle = String(id);
83 - for (let i = 0; i < menuRows.length; i++) if (menuRows[i].id === needle) {
84 - return menuRows[i];
104 + for (let i = 0; i < nativeItems.length; i++) if (itemKey(nativeItems[i], i) === needle) {
105 + return nativeItems[i];
107 + return null;
110 + function selectedItem() {
111 + const items = itemsArray();
112 + if (items.length === 0)
113 + return null;
115 + if (selectedItemId.length === 0)
116 + return items[0];
118 + for (let i = 0; i < items.length; i++) if (items[i].id === selectedItemId) {
119 + return items[i];
121 + return items[0];
124 + function menuRows() {
125 + const item = selectedItem();
126 + if (!item || !item.hasMenu)
127 + return [];
129 + return [{
130 + "id": `${item.id}:native-menu`,
131 + "kind": "submenu",
132 + "label": `${item.title} menu`,
133 + "enabled": true,
134 + "expanded": expandedSubmenu === `${item.id}:native-menu`,
135 + "native": true,
136 + "children": []
137 + }];
140 + function rowById(id) {
141 + const rows = menuRows();
142 + const needle = String(id);
143 + for (let i = 0; i < rows.length; i++) if (rows[i].id === needle) {
144 + return rows[i];
86 146 return ({
87 147 "id": needle,
88 148 "kind": "missing",
89 149 "label": "",
90 - "enabled": false
91 - });
92 - }
94 - function shapedRows() {
95 - return menuRows.map((row) => {
96 - const next = Object.assign({
97 - }, row);
98 - next.expanded = row.kind === "submenu" && row.id === expandedSubmenu;
99 - return next;
150 + "enabled": false,
151 + "native": false
103 155 function trayPanelContract() {
104 156 return {
105 - "source": "Nuguland TrayItem.qml plus Nuguland SysTray.qml MenuView.qml plus Nuguland TrayOverflowMenu.qml",
157 + "source": "Quickshell.Services.SystemTray SystemTray.items.values plus native StatusNotifierItem routes",
106 158 "ownedBy": "PopoutHost.qml inline TrayPanel",
107 159 "nativeTrayMenuPanel": true,
160 + "realSystemTray": true,
108 161 "trayItemGrid": true,
109 162 "dbusMenuRows": true,
163 + "noSyntheticDbusMenuRows": true,
110 164 "submenuCollapsePolicy": true,
111 165 "menuClosePropagation": true,
112 166 "attentionStatus": true,
113 167 "serviceActionsOnly": true,
114 - "nativeRoutes": ["activate", "secondaryActivate", "scroll", "DBusMenu"],
168 + "nativeRoutes": ["activate", "secondaryActivate", "scroll", "display"],
115 169 "rowKinds": rowKinds
119 173 function stateObject() {
174 + const rows = menuRows();
175 + const items = itemsArray();
120 176 return {
121 177 "backend": "Tray.qml",
178 + "source": "Quickshell.Services.SystemTray",
122 179 "usesNativeSystemTray": true,
123 180 "usesDBusMenu": true,
124 181 "helperProcesses": [],
182 + "fakeRows": false,
125 183 "nativeMenuHost": "bar-popout-host",
184 + "nativeItemCount": items.length,
185 + "attentionCount": attentionCount,
186 + "selectedItemId": selectedItemId,
187 + "items": items,
126 188 "trayPanelContract": trayPanelContract(),
127 189 "oneExpandedSubmenu": true,
128 190 "expandedSubmenu": expandedSubmenu,
129 - "siblingsCollapsed": shapedRows().filter((row) => {
191 + "siblingsCollapsed": rows.filter((row) => {
130 192 return row.kind === "submenu" && row.expanded;
131 193 }).length <= 1,
132 194 "rowKinds": rowKinds,
133 - "rows": shapedRows(),
195 + "rows": rows,
134 196 "closeRequested": closeRequested,
135 197 "closeReason": closeReason,
136 198 "closePropagation": closePropagation,
142 204 return JSON.stringify(stateObject());
207 + function selectItem(id) {
208 + const item = nativeItemById(id);
209 + selectedItemId = item ? String(id) : "";
210 + expandedSubmenu = "";
211 + lastAction = {
212 + "kind": "select-item",
213 + "id": String(id),
214 + "accepted": !!item
215 + };
216 + return stateJson();
145 219 function expandSubmenu(id) {
146 220 const row = rowById(id);
147 221 if (row.kind !== "submenu" || !row.enabled) {
163 237 lastAction = {
164 238 "kind": "expand-submenu",
165 239 "id": row.id,
166 - "accepted": true
240 + "accepted": true,
241 + "native": true
168 243 return stateJson();
171 246 function activateRow(id) {
247 + const item = nativeItemById(id);
248 + if (item) {
249 + item.activate();
250 + closeRequested = true;
251 + closeReason = "item-activated";
252 + closePropagation = {
253 + "requested": true,
254 + "source": String(id),
255 + "reason": closeReason
256 + };
257 + lastAction = {
258 + "kind": "activate-item",
259 + "id": String(id),
260 + "accepted": true,
261 + "native": true
262 + };
263 + return stateJson();
172 265 const row = rowById(id);
173 266 if (row.kind === "submenu")
174 267 return expandSubmenu(row.id);
176 - if (row.kind === "separator" || row.kind === "disabled" || row.kind === "missing" || !row.enabled) {
177 - closeRequested = false;
178 - closePropagation = {
179 - "requested": false,
180 - "source": row.id,
181 - "reason": row.kind
182 - };
183 - lastAction = {
184 - "kind": "activate-row",
185 - "id": row.id,
186 - "rowKind": row.kind,
187 - "accepted": false
188 - };
189 - return stateJson();
190 - }
191 - if (row.kind === "check") {
192 - menuRows = menuRows.map((item) => {
193 - return item.id === row.id ? Object.assign({
194 - }, item, {
195 - "checked": !item.checked
196 - }) : item;
197 - });
198 - closeRequested = false;
199 - closePropagation = {
200 - "requested": false,
201 - "source": row.id,
202 - "reason": "check-toggle"
203 - };
204 - lastAction = {
205 - "kind": "activate-row",
206 - "id": row.id,
207 - "rowKind": row.kind,
208 - "accepted": true
209 - };
210 - return stateJson();
211 - }
212 - if (row.kind === "radio")
213 - menuRows = menuRows.map((item) => {
214 - return item.kind === "radio" ? Object.assign({
215 - }, item, {
216 - "checked": item.id === row.id
217 - }) : item;
218 - });
220 - closeRequested = true;
221 - closeReason = "row-activated";
269 + closeRequested = false;
222 270 closePropagation = {
223 - "requested": true,
271 + "requested": false,
224 272 "source": row.id,
225 - "reason": "row-activated"
273 + "reason": row.kind
227 275 lastAction = {
228 276 "kind": "activate-row",
229 277 "id": row.id,
230 278 "rowKind": row.kind,
231 - "accepted": true
279 + "accepted": false,
280 + "native": false
233 282 return stateJson();

quickshell/nuguland/Util.js

Added
new file mode 100644
1 +.pragma library
3 +function parseJson(text, valueWhenInvalid) {
4 + try {
5 + return JSON.parse(String(text));
6 + } catch (error) {
7 + return valueWhenInvalid;
8 + }
9 +}

quickshell/nuguland/justfile

Modified
16 16 mapfile -t qml < <(find . -maxdepth 1 -name '*.qml' -print | sort)
17 17 mapfile -t sh < <(find . -maxdepth 1 -name '*.sh' -print | sort)
18 + mapfile -t mjs < <(find . -name '*.mjs' -print | sort)
18 19 mapfile -t frag < <(find shaders -name '*.frag' -print 2>/dev/null | sort)
19 20 # qmllint receives -i /usr/lib/qt6/qml/Quickshell/**/*.qmltypes for Quickshell custom types.
20 21 mapfile -t qmltypes < <(find /usr/lib/qt6/qml/Quickshell -name '*.qmltypes' -print | sort)
27 28 qmllint -I /usr/lib/qt6/qml "${qmltype_args[@]}" "$file" || { echo "qmllint failed: $file" >&2; exit 1; }
28 29 done
29 30 ((${#sh[@]} == 0)) || shellcheck "${sh[@]}"
31 + for file in "${mjs[@]}"; do
32 + node --check "$file"
33 + done
30 34 ((${#frag[@]} == 0)) || glslangValidator "${frag[@]}"
32 36 for file in "${qml[@]}"; do
50 54 for blob in shaders/*.qsb; do
51 55 [[ -f "${blob%.qsb}" ]] || { echo "orphan shader blob: $blob" >&2; exit 1; }
52 56 done
54 - qs -p shell.qml >/tmp/nuguland-lint.qs.out 2>/tmp/nuguland-lint.qs.err &
55 - qs_pid=$!
56 - sleep 3
57 - kill -0 "$qs_pid"
57 + if qs ipc -c nuguland call nuguland ping >/tmp/nuguland-lint.qs.out 2>/tmp/nuguland-lint.qs.err; then
58 + : > /tmp/nuguland-lint.qs.err
59 + else
60 + QT_NO_XDG_DESKTOP_PORTAL=1 qs -p shell.qml >/tmp/nuguland-lint.qs.out 2>/tmp/nuguland-lint.qs.err &
61 + qs_pid=$!
62 + sleep 3
63 + kill -0 "$qs_pid"
64 + fi
65 + if grep -E "WARN|ERROR|Error parsing|deprecated|Could not|failed" /tmp/nuguland-lint.qs.out /tmp/nuguland-lint.qs.err; then
66 + echo "runtime warnings during lint" >&2
67 + exit 1
68 + fi
59 70 # format Nuguland QML and shell scripts in place
60 71 fmt:
75 86 for shader in shaders/*.frag; do
76 87 /usr/lib/qt6/bin/qsb --glsl 330 --hlsl 50 --msl 12 -o "$shader.qsb" "$shader"
77 88 done
79 -# alias for agents/users expecting a check gate
80 -check: lint

quickshell/nuguland/pam/nuguland-lock.conf

Modified
1 -auth include login
1 +auth required pam_unix.so try_first_pass nullok
2 +account required pam_unix.so

quickshell/nuguland/shaders/aurora.frag

Modified
1 1 #version 440
2 2 layout(location = 0) in vec2 qt_TexCoord0;
3 3 layout(location = 0) out vec4 fragColor;
4 -layout(std140, binding = 0) uniform buf { mat4 qt_Matrix; float qt_Opacity; float iTime; vec2 iResolution; vec2 iMouse; } ubuf;
4 +layout(std140, binding = 0) uniform buf { mat4 qt_Matrix; float qt_Opacity; float iTime; vec2 iResolution; vec2 iMouse; float iFirestormMix; } ubuf;
5 5 float hash(vec2 p){return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453);}
6 6 float noise(vec2 p){vec2 i=floor(p),f=fract(p),u=f*f*(3.0-2.0*f);return mix(mix(hash(i),hash(i+vec2(1,0)),u.x),mix(hash(i+vec2(0,1)),hash(i+vec2(1,1)),u.x),u.y);}
7 7 void main(){
19 19 vec3 nugu=vec3(0.847,0.427,0.847);
20 20 vec3 cold=vec3(0.33,0.42,0.68);
21 21 vec3 col=mix(cold,nugu,wave)*glow;
22 - float alpha=clamp(glow*0.42,0.02,0.35);
22 + float ember=noise(vec2(p.x*7.0+t*9.0,p.y*5.5-t*15.0));
23 + float plume=smoothstep(0.95,-0.35,p.y+n*0.45+ember*0.22);
24 + float lick=smoothstep(0.35,1.0,sin((p.x+n*1.2)*18.0-t*42.0)*0.5+0.5);
25 + float heat=clamp(plume*(0.45+lick*0.65)+halo*0.35,0.0,1.0);
26 + vec3 firestorm=mix(vec3(0.45,0.05,0.015),vec3(1.0,0.32,0.04),heat);
27 + firestorm=mix(firestorm,vec3(1.0,0.78,0.20),pow(max(heat,0.0),3.0));
28 + float mixv=smoothstep(0.0,1.0,ubuf.iFirestormMix);
29 + col=mix(col, firestorm*max(glow,heat)*0.72, mixv);
30 + float alpha=clamp(mix(glow*0.42, max(glow,heat)*0.55, mixv),0.02,0.42);
23 31 fragColor=vec4(col,alpha)*ubuf.qt_Opacity;

quickshell/nuguland/shaders/aurora.frag.qsb

Modified

Previous version contains binary or non-UTF-8 data.

Current version contains binary or non-UTF-8 data.

quickshell/nuguland/shell.qml

Modified
1 1 import QtQuick
2 2 import Quickshell
3 3 import Quickshell.Io
4 +import Quickshell.Wayland
5 6 ShellRoot {
6 7 id: shell
8 9 Theme {
9 10 id: nuguTheme
12 + lowPowerMode: power.lowPowerMode()
12 15 Time {
48 51 id: media
50 53 osdService: osd
54 + audioService: audio
53 57 Audio {
56 60 osdService: osd
63 + Brightness {
64 + id: brightness
66 + osdService: osd
67 + }
59 69 Idle {
60 70 id: idle
100 110 id: surfaceManager
103 - Diagnostics {
104 - id: diagnostics
113 + Variants {
114 + model: Quickshell.screens
116 + delegate: Component {
117 + PanelWindow {
118 + required property var modelData
120 + objectName: "osdOverlaySurface"
121 + screen: modelData
122 + visible: osd.visibleState
123 + implicitWidth: 320
124 + implicitHeight: 88
125 + color: "transparent"
126 + exclusionMode: ExclusionMode.Ignore
127 + WlrLayershell.layer: WlrLayer.Overlay
128 + WlrLayershell.namespace: "nuguland-osd"
129 + WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
131 + anchors {
132 + top: true
133 + right: true
136 + margins {
137 + top: 48
138 + right: 16
141 + Rectangle {
142 + id: osdCard
144 + readonly property var indicator: osd.valueIndicator(osd.currentEvent, osd.currentValue)
145 + readonly property string roleColor: osd.currentRole === "error" ? nuguTheme.error : (osd.currentRole === "warning" ? nuguTheme.warning : nuguTheme.ui.accent)
147 + anchors.fill: parent
148 + anchors.margins: 8
149 + radius: 20
150 + color: nuguTheme.withAlpha(nuguTheme.ui.backdrop, 0.94)
151 + border.width: 0
152 + border.color: roleColor
153 + opacity: osd.visibleState ? 1 : 0
155 + Rectangle {
156 + id: osdIcon
158 + anchors.left: parent.left
159 + anchors.leftMargin: 14
160 + anchors.verticalCenter: parent.verticalCenter
161 + width: 42
162 + height: 42
163 + radius: 14
164 + color: nuguTheme.withAlpha(osdCard.roleColor, 0.2)
165 + border.width: 0
166 + border.color: osdCard.roleColor
168 + Text {
169 + anchors.centerIn: parent
170 + color: nuguTheme.content.normal
171 + font.family: "IBM Plex Mono"
172 + font.pixelSize: 13
173 + font.bold: true
174 + text: String(osdCard.indicator.iconRole || "osd").slice(0, 2)
179 + Column {
180 + anchors.left: osdIcon.right
181 + anchors.leftMargin: 12
182 + anchors.right: parent.right
183 + anchors.rightMargin: 14
184 + anchors.verticalCenter: parent.verticalCenter
185 + spacing: 6
187 + Row {
188 + width: parent.width
189 + spacing: 8
191 + Text {
192 + color: nuguTheme.content.normal
193 + font.family: "IBM Plex Sans"
194 + font.pixelSize: 15
195 + font.bold: true
196 + text: osd.currentEvent.length > 0 ? osd.currentEvent : "osd"
197 + width: parent.width - valueText.width - parent.spacing
198 + elide: Text.ElideRight
201 + Text {
202 + id: valueText
204 + color: nuguTheme.ui.normal
205 + font.family: "IBM Plex Mono"
206 + font.pixelSize: 13
207 + text: osd.currentValue
212 + Rectangle {
213 + width: parent.width
214 + height: osdCard.indicator.progressBar && osdCard.indicator.progressBar.visible ? 8 : 0
215 + visible: height > 0
216 + radius: 4
217 + color: nuguTheme.withAlpha(nuguTheme.ui.minor, 0.3)
219 + Rectangle {
220 + anchors.left: parent.left
221 + anchors.top: parent.top
222 + anchors.bottom: parent.bottom
223 + width: parent.width * Math.max(0, Math.min(1, osdCard.indicator.normalizedValue || 0))
224 + radius: parent.radius
225 + color: osdCard.roleColor
230 + Text {
231 + visible: osd.currentRole === "error"
232 + color: nuguTheme.error
233 + font.family: "IBM Plex Sans"
234 + font.pixelSize: 12
235 + text: osd.currentValue
236 + width: parent.width
237 + elide: Text.ElideRight
242 + Behavior on opacity {
243 + NumberAnimation {
244 + duration: nuguTheme.lowPowerMode ? 0 : 120
245 + easing.type: Easing.OutCubic
252 + mask: Region {
106 - niriService: niri
107 - timeService: time
108 - resourceService: resources
109 - notificationService: notifications
110 - trayService: tray
111 - launcherService: launcher
112 - clipboardService: clipboard
113 - mediaService: media
114 - audioService: audio
115 - idleService: idle
116 - privilegeService: privilege
117 - lockService: lock
118 - networkService: network
119 - bluetoothService: bluetooth
120 - powerService: power
121 - screenshotsService: screenshots
122 - osdService: osd
123 - surfaces: surfaceManager
126 - FloatingWindow {
127 - title: "Nuguland privilege"
128 - visible: privilege.active || privilege.error.length > 0
129 - width: 720
130 - height: 420
131 - color: "transparent"
261 + Variants {
262 + model: Quickshell.screens
264 + delegate: Component {
265 + PanelWindow {
266 + required property var modelData
268 + objectName: "privilegeSecuritySurface"
269 + screen: modelData
270 + visible: privilege.active || privilege.error.length > 0
271 + color: "transparent"
272 + exclusionMode: ExclusionMode.Ignore
273 + WlrLayershell.layer: WlrLayer.Overlay
274 + WlrLayershell.namespace: "nuguland-privilege"
275 + WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
277 + anchors {
278 + top: true
279 + bottom: true
280 + left: true
281 + right: true
284 + PrivilegeSurface {
285 + anchors.fill: parent
286 + theme: nuguTheme
287 + privilegeService: privilege
133 - PrivilegeSurface {
134 - anchors.fill: parent
135 - theme: nuguTheme
136 - privilegeService: privilege
146 301 required property var modelData
148 303 screen: modelData
304 + resourceService: resources
305 + lowPowerMode: power.lowPowerMode()
170 327 clipboardService: clipboard
171 328 launcherService: launcher
172 329 audioService: audio
330 + brightnessService: brightness
173 331 networkService: network
174 332 bluetoothService: bluetooth
175 333 powerService: power
176 - screenshotsService: screenshots
177 334 idleService: idle
178 335 lockService: lock
179 - diagnosticsService: diagnostics
180 336 surfaces: surfaceManager
201 357 return audio.muteInput();
204 - function route(action) {
360 + function route(action: string) : string {
205 361 return audio.route(action);
233 389 return media.action("repeat");
236 - function route(action) {
392 + function route(action: string) : string {
237 393 return media.action(action);
243 399 IpcHandler {
244 - function adjust(sign) {
245 - const direction = String(sign) === "-" ? "down" : "up";
246 - const expression = String(sign) === "-" ? "b - m / 20" : "b + m / 20";
247 - Quickshell.execDetached(["sh", "-c", `d=/sys/class/backlight/intel_backlight; b=$(cat $d/brightness); m=$(cat $d/max_brightness); n=$((${expression})); [ $n -lt 1 ] && n=1; [ $n -gt $m ] && n=$m; printf '%s\\n' $n > $d/brightness`]);
248 - return osd.trigger("brightness", direction);
400 + function increase() : string {
401 + return brightness.increase();
251 - function increase() {
252 - return adjust("+");
255 - function decrease() {
256 - return adjust("-");
404 + function decrease() : string {
405 + return brightness.decrease();
259 408 target: "brightness"
262 411 IpcHandler {
263 - function ping() {
412 + function ping() : string {
264 413 return "nuguland";
267 - function niriState() {
416 + function niriState() : string {
268 417 return niri.stateJson();
273 422 return nuguTheme.mode;
276 - function screenshotScreen(path) {
425 + function screenshotScreen(path: string) : string {
277 426 niri.screenshotScreen(path);
278 427 return path;
281 - function windowRuleMetadata() {
430 + function windowRuleMetadata() : string {
282 431 return niri.windowRuleMetadata();
285 - function windowCardAction(kind) {
434 + function windowCardAction(kind: string) : string {
286 435 return niri.windowCardAction(kind);
289 - function timeState() {
438 + function openWindow() : string {
439 + return surfaceManager.openRegisteredPopout("window");
442 + function timeState() : string {
290 443 return time.stateJson();
293 - function timeStateAt(iso) {
446 + function timeStateAt(iso: string) : string {
294 447 return time.stateAt(iso);
297 - function timeRelative(fromIso, toIso) {
450 + function timeRelative(fromIso: string, toIso: string) : string {
298 451 return time.relative(fromIso, toIso);
301 - function timeCalendar(year, month, selectedDay) {
454 + function timeCalendar(year: int, month: int, selectedDay: int) : string {
302 455 return time.calendar(year, month, selectedDay);
305 - function cpuWidgetState(value) {
306 - return resources.cpuWidgetState(value);
458 + function openClock() : string {
459 + return surfaceManager.openRegisteredPopout("clock");
309 - function resourceHeroCard(kind, value, samplesCsv) {
462 + function systemWidgetState() : string {
463 + return resources.systemWidgetState();
466 + function openSystem() : string {
467 + return surfaceManager.openRegisteredPopout("system");
470 + function resourceHeroCard(kind: string, value: real, samplesCsv: string) : string {
310 471 return resources.resourceHeroCard(kind, value, String(samplesCsv).split(",").map(Number));
313 - function notificationWidgetState(attention, active) {
474 + function firestormState() : string {
475 + return resources.firestormState();
478 + function systemLaunchBtm() : string {
479 + return resources.launchBtm();
482 + function notificationWidgetState(attention: bool, active: bool) : string {
314 483 return notifications.widgetState(attention, active);
317 - function notificationsState() {
486 + function notificationsState() : string {
318 487 return notifications.stateJson();
321 - function notificationsSeed() {
322 - return notifications.seed();
325 - function notificationsToggleDnd() {
490 + function notificationsToggleDnd() : string {
326 491 return notifications.toggleDnd();
329 - function notificationsAction(id, actionId) {
494 + function notificationsAction(id: string, actionId: string) : string {
330 495 return notifications.runAction(id, actionId);
333 - function notificationsToggleGroup(appName) {
498 + function notificationsToggleGroup(appName: string) : string {
334 499 return notifications.toggleGroup(appName);
337 - function notificationsDrag(id, deltaX, width) {
502 + function notificationsDrag(id: string, deltaX: real, width: real) : string {
338 503 return notifications.dragNotification(id, deltaX, width);
341 - function notificationsDiscardAll() {
506 + function notificationsDiscardAll() : string {
342 507 return notifications.discardAllNotifications();
345 - function trayWidgetState(attention, active) {
510 + function trayWidgetState(attention: bool, active: bool) : string {
346 511 return tray.widgetState(attention, active);
349 - function trayState() {
514 + function trayState() : string {
350 515 return tray.stateJson();
353 - function trayMenuExpand(id) {
518 + function openTray() : string {
519 + return surfaceManager.openRegisteredPopout("tray");
522 + function traySelectItem(id: string) : string {
523 + return tray.selectItem(id);
526 + function trayMenuExpand(id: string) : string {
354 527 return tray.expandSubmenu(id);
357 - function trayMenuActivate(id) {
530 + function trayMenuActivate(id: string) : string {
358 531 return tray.activateRow(id);
361 - function trayMenuClose(reason) {
534 + function trayMenuClose(reason: string) : string {
362 535 return tray.closeMenu(reason);
365 - function diagnosticsState() {
366 - return diagnostics.stateJson();
369 - function launcherSearch(query) {
538 + function launcherSearch(query: string) : string {
370 539 return launcher.search(query);
373 - function launcherState() {
542 + function launcherState() : string {
374 543 return launcher.stateJson();
377 - function osdTrigger(event, value) {
546 + function launcherLaunchRecord(rowJson: string) : string {
547 + return launcher.launchRecord(rowJson);
550 + function launcherActivate(rowJson: string) : string {
551 + return launcher.activate(rowJson);
554 + function launcherActivateFirst(query: string) : string {
555 + return launcher.activateFirst(query);
558 + function launcherActivateId(id: string) : string {
559 + return launcher.activateId(id);
562 + function hotkey(id: string) : string {
563 + return launcher.hotkey(id);
566 + function openLauncher() : string {
567 + return surfaceManager.openRegisteredPopout("launcher");
570 + function osdTrigger(event: string, value: string) : string {
378 571 return osd.trigger(event, value);
381 - function osdState() {
574 + function osdState() : string {
382 575 return osd.stateJson();
385 - function osdExpire() {
578 + function osdExpire() : string {
386 579 return osd.expire();
389 - function clipboardState() {
582 + function clipboardState() : string {
390 583 return clipboard.stateJson();
393 - function clipboardSearch(query) {
586 + function clipboardSearch(query: string) : string {
394 587 return clipboard.search(query);
397 - function clipboardTogglePin(id) {
590 + function clipboardTogglePin(id: string) : string {
398 591 return clipboard.togglePin(id);
401 - function clipboardCopy(id) {
594 + function clipboardCopy(id: string) : string {
402 595 return clipboard.copy(id);
405 - function clipboardPaste(id) {
598 + function clipboardPaste(id: string) : string {
406 599 return clipboard.paste(id);
409 - function clipboardDelete(id) {
602 + function clipboardDelete(id: string) : string {
410 603 return clipboard.deleteRow(id);
413 - function clipboardPrivateMode(enabled) {
606 + function clipboardPrivateMode(enabled: bool) : string {
414 607 return clipboard.setPrivateMode(enabled);
417 - function mediaState() {
610 + function openClipboard() : string {
611 + return surfaceManager.openRegisteredPopout("clipboard");
614 + function mediaState() : string {
418 615 return media.stateJson();
421 - function mediaAction(kind) {
618 + function openMedia() : string {
619 + return surfaceManager.openRegisteredPopout("media");
622 + function mediaAction(kind: string) : string {
422 623 return media.action(kind);
425 - function mediaSeek(position) {
626 + function mediaSeek(position: real) : string {
426 627 return media.seek(position);
429 - function mediaSelect(id) {
630 + function mediaSelect(id: string) : string {
430 631 return media.select(id);
433 - function audioState() {
634 + function audioState() : string {
434 635 return audio.stateJson();
437 - function audioSetVolume(id, volume) {
638 + function openAudio() : string {
639 + return surfaceManager.openRegisteredPopout("audio");
642 + function privacyWidgetState() : string {
643 + return audio.privacyWidgetJson();
646 + function audioSetVolume(id: string, volume: real) : string {
438 647 return audio.setVolume(id, volume);
441 - function audioToggleMute(id) {
650 + function audioToggleMute(id: string) : string {
442 651 return audio.toggleMute(id);
445 - function audioSetDefaultSink(id) {
654 + function audioSetDefaultSink(id: string) : string {
446 655 return audio.setDefaultSink(id);
449 - function audioSetDefaultSource(id) {
658 + function audioSetDefaultSource(id: string) : string {
450 659 return audio.setDefaultSource(id);
453 - function audioMoveStream(id, target) {
662 + function audioMoveStream(id: string, target: string) : string {
454 663 return audio.moveStream(id, target);
457 - function idleState() {
666 + function brightnessState() : string {
667 + return brightness.stateJson();
670 + function openBrightness() : string {
671 + return surfaceManager.openRegisteredPopout("brightness");
674 + function brightnessSetLevel(level: string) : string {
675 + return brightness.setLevel(level);
678 + function brightnessIncrease() : string {
679 + return brightness.increase();
682 + function brightnessDecrease() : string {
683 + return brightness.decrease();
686 + function idleState() : string {
458 687 return idle.stateJson();
461 - function idleEnable(minutes, reason) {
690 + function idleEnable(minutes: real, reason: string) : string {
462 691 return idle.enable(minutes, reason);
465 - function idleDisable() {
694 + function idleDisable() : string {
466 695 return idle.disable();
469 - function idleToggle(minutes, reason) {
698 + function idleToggle(minutes: real, reason: string) : string {
470 699 return idle.toggle(minutes, reason);
473 - function idleSetActivity(name) {
702 + function idleSetActivity(name: string) : string {
474 703 return idle.setActivity(name);
477 - function idleExpire() {
706 + function idleExpire() : string {
478 707 return idle.expire();
481 - function privilegeState() {
710 + function openIdle() : string {
711 + return surfaceManager.openRegisteredPopout("idle");
714 + function privilegeState() : string {
482 715 return privilege.stateJson();
485 - function privilegeBeginTestRequest(app, actionId, message) {
486 - return privilege.beginTestRequest(app, actionId, message);
489 - function privilegeSubmit(secret) {
718 + function privilegeSubmit(secret: string) : string {
490 719 return privilege.submit(secret);
493 - function privilegeDeny() {
722 + function privilegeDeny() : string {
494 723 return privilege.deny();
497 - function privilegeCancel() {
726 + function privilegeCancel() : string {
498 727 return privilege.cancel();
501 - function privilegeFail(message) {
730 + function privilegeFail(message: string) : string {
502 731 return privilege.fail(message);
505 - function privilegeClear() {
734 + function privilegeClear() : string {
506 735 return privilege.clear();
509 - function lockState() {
738 + function lockState() : string {
510 739 return lock.stateJson();
513 - function lockRequest() {
742 + function lockRequest() : string {
514 743 return lock.request();
517 - function lockType(secret) {
746 + function lockType(secret: string) : string {
518 747 return lock.typeSecret(secret);
521 - function lockSubmit(secret) {
750 + function lockSubmit(secret: string) : string {
522 751 return lock.submit(secret);
525 - function lockFail(message) {
526 - return lock.fail(message);
529 - function lockUnlock() {
530 - return lock.unlock();
533 - function lockCancel() {
754 + function lockCancel() : string {
534 755 return lock.cancel();
537 - function networkState() {
758 + function networkState() : string {
538 759 return network.stateJson();
762 + function networkWidgetState() : string {
763 + const state = JSON.parse(network.stateJson());
764 + state.barLabel = "network";
765 + state.shader.values = [resources.networkRxLevel(), resources.networkTxLevel(), state.compact.signal / 100, state.wifi.enabled ? 1 : 0];
766 + state.shader.history = resources.shaderHistoryObject(resources.networkHistorySamples);
767 + state.rates = {
768 + "rxRate": resources.networkRxRate,
769 + "txRate": resources.networkTxRate,
770 + "rxLevel": resources.networkRxLevel(),
771 + "txLevel": resources.networkTxLevel()
772 + };
773 + return JSON.stringify(state);
541 776 function networkScan() {
542 777 return network.scan();
545 - function networkSelect(id) {
780 + function networkSelect(id: string) : string {
546 781 return network.select(id);
549 - function networkToggleWifi(enabled) {
784 + function networkToggleWifi(enabled: bool) : string {
550 785 return network.toggleWifi(enabled);
553 - function networkForget(id) {
788 + function networkForget(id: string) : string {
554 789 return network.forget(id);
558 793 return network.checkConnectivity();
561 - function bluetoothState() {
796 + function bluetoothState() : string {
562 797 return bluetooth.stateJson();
565 - function bluetoothScan() {
800 + function bluetoothScan() : string {
566 801 return bluetooth.scan();
569 - function bluetoothToggle(enabled) {
804 + function bluetoothToggle(enabled: bool) : string {
570 805 return bluetooth.toggle(enabled);
573 - function bluetoothDeviceAction(kind, id) {
808 + function bluetoothDeviceAction(kind: string, id: string) : string {
574 809 return bluetooth.deviceAction(kind, id);
577 - function powerState() {
812 + function powerState() : string {
578 813 return power.stateJson();
581 - function powerSetProfile(name) {
816 + function openPower() : string {
817 + return surfaceManager.openRegisteredPopout("power");
820 + function openNetwork() : string {
821 + return surfaceManager.openRegisteredPopout("connectivity");
824 + function powerSetProfile(name: string) : string {
582 825 return power.setProfile(name);
585 - function powerSessionAction(kind) {
828 + function powerSessionAction(kind: string) : string {
586 829 return power.sessionAction(kind);
589 - function powerConfirmAction(kind) {
832 + function powerConfirmAction(kind: string) : string {
590 833 return power.confirmAction(kind);
593 - function powerCancelAction() {
836 + function powerCancelAction() : string {
594 837 return power.cancelAction();
597 - function screenshotsState() {
840 + function screenshotsState() : string {
598 841 return screenshots.stateJson();
601 - function screenshotsBeginSelection(x, y) {
844 + function screenshotsBeginSelection(x: real, y: real) : string {
602 845 return screenshots.beginSelection(x, y);
605 - function screenshotsUpdateSelection(x, y) {
848 + function screenshotsUpdateSelection(x: real, y: real) : string {
606 849 return screenshots.updateSelection(x, y);
609 - function screenshotsCompleteSelection(path) {
852 + function screenshotsCompleteSelection(path: string) : string {
610 853 return screenshots.completeSelection(path);
613 - function screenshotsCancelSelection() {
856 + function screenshotsCancelSelection() : string {
614 857 return screenshots.cancelSelection();
617 - function screenshotsCapture(kind, path) {
860 + function screenshotsCapture(kind: string, path: string) : string {
618 861 return screenshots.capture(kind, path);
621 - function screenshotsPickColor() {
864 + function screenshotsPickColor() : string {
622 865 return screenshots.pickColor();
625 - function screenshotsRecordAction(kind, id) {
868 + function screenshotsRecordAction(kind: string, id: string) : string {
626 869 return screenshots.recordAction(kind, id);
629 - function screenshotsClear() {
872 + function screenshotsClear() : string {
630 873 return screenshots.clear();
633 - function registeredAnchors() {
876 + function openScreenshots() : string {
877 + return surfaceManager.openRegisteredPopout("screenshots");
880 + function registeredAnchors() : string {
634 881 return surfaceManager.registeredAnchors();
637 - function popoutContentCatalog() {
884 + function popoutContentCatalog() : string {
638 885 return surfaceManager.popoutContentCatalog();
641 - function setPopoutScreen(width, height) {
888 + function setPopoutScreen(width: int, height: int) : string {
642 889 return surfaceManager.setPopoutScreen(width, height);
645 - function openPopout(name, anchor) {
892 + function openPopout(name: string, anchor: string) : string {
646 893 return surfaceManager.openPopout(name, anchor);
649 - function openRegisteredPopout(name) {
896 + function openRegisteredPopout(name: string) : string {
650 897 return surfaceManager.openRegisteredPopout(name);
653 - function openNotifications() {
900 + function openNotifications() : string {
654 901 return surfaceManager.openRegisteredPopout("notifications");
657 - function hoverRegisteredPopout(name) {
904 + function hoverRegisteredPopout(name: string) : string {
658 905 return surfaceManager.hoverRegisteredPopout(name);
661 - function closePopout() {
908 + function closePopout() : string {
662 909 return surfaceManager.closePopout("");
665 - function popoutInteraction(kind) {
912 + function popoutInteraction(kind: string) : string {
666 913 return surfaceManager.popoutInteraction(kind);
669 - function gesturePress(x, y) {
670 - return surfaceManager.gesturePress(x, y);
673 - function gestureDrag(x, y) {
674 - return surfaceManager.gestureDrag(x, y);
677 - function gestureRelease(x, y) {
678 - return surfaceManager.gestureRelease(x, y);
681 - function gestureCancel(reason) {
682 - return surfaceManager.gestureCancel(reason);
685 - function popoutState() {
916 + function popoutState() : string {
686 917 return surfaceManager.popoutState();
744 975 target: translation
745 976 property: "x"
746 977 to: shakeRoot.shakeOffsets[1]
747 - duration: 50
978 + duration: nuguTheme.lowPowerMode ? 0 : 50
748 979 easing.type: Easing.OutCubic
752 983 target: translation
753 984 property: "x"
754 985 to: shakeRoot.shakeOffsets[2]
755 - duration: 50
986 + duration: nuguTheme.lowPowerMode ? 0 : 50
756 987 easing.type: Easing.OutCubic
760 991 target: translation
761 992 property: "x"
762 993 to: shakeRoot.shakeOffsets[3]
763 - duration: 40
994 + duration: nuguTheme.lowPowerMode ? 0 : 40
764 995 easing.type: Easing.OutCubic
768 999 target: translation
769 1000 property: "x"
770 1001 to: shakeRoot.shakeOffsets[4]
771 - duration: 40
1002 + duration: nuguTheme.lowPowerMode ? 0 : 40
772 1003 easing.type: Easing.OutCubic
776 1007 target: translation
777 1008 property: "x"
778 1009 to: shakeRoot.shakeOffsets[5]
779 - duration: 30
1010 + duration: nuguTheme.lowPowerMode ? 0 : 30
780 1011 easing.type: Easing.OutCubic
864 1095 height: Math.min(parent.height - 48, 370)
865 1096 radius: 22
866 1097 color: root.theme ? root.theme.ui.backdrop : "transparent"
867 - border.width: 1
1098 + border.width: 0
868 1099 border.color: root.theme ? root.theme.warning : "transparent"
870 1101 Column {
875 1106 NuguText {
876 1107 theme: root.theme
877 1108 variant: "meta"
878 - text: "Authentication required"
1109 + text: "authentication required"
879 1110 width: parent.width
880 1111 wrapMode: Text.WordWrap
886 1117 height: 94
887 1118 radius: 15
888 1119 color: root.theme ? root.theme.withAlpha(root.theme.warning, 0.14) : "transparent"
889 - border.width: 1
1120 + border.width: 0
890 1121 border.color: root.theme ? root.theme.warning : "transparent"
892 1123 Column {
935 1166 height: 46
936 1167 radius: 23
937 1168 color: root.theme ? root.theme.withAlpha(root.state.error ? root.theme.error : root.theme.ui.focus, root.state.error ? 0.18 : 0.12) : "transparent"
938 - border.width: 1
1169 + border.width: 0
939 1170 border.color: root.theme ? (root.state.error ? root.theme.error : root.theme.ui.focus) : "transparent"
941 1172 NuguText {
1015 1246 height: 38
1016 1247 radius: 12
1017 1248 color: root.theme ? root.theme.withAlpha(action.modelData === "confirm" ? root.theme.ui.focus : root.theme.ui.minor, action.modelData === "confirm" ? 0.16 : 0.1) : "transparent"
1018 - border.width: 1
1249 + border.width: 0
1019 1250 border.color: root.theme ? (action.modelData === "confirm" ? root.theme.ui.focus : root.theme.ui.minor) : "transparent"
1021 1252 NuguText {