repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

fix nuguland launcher focus

025140e2f8617b2d80adbc4d2eadd89a612e2ffe

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (36)

niri/cfg/keybinds.kdl

Modified
9 9 spawn "uwsm" "app" "-s" "work.slice" "--" "wezterm" "start" "--always-new-process"
11 11 Mod+Space hotkey-overlay-title="Nuguland: launcher" {
12 - spawn "uwsm" "app" "-s" "session-graphical.slice" "--" "qs" "ipc" "-c" "nuguland" "call" "nuguland" "openRegisteredPopout" "launcher"
12 + spawn "uwsm" "app" "-s" "session-graphical.slice" "--" "qs" "ipc" "-c" "nuguland" "call" "nuguland" "openLauncher"
14 14 Mod+Shift+O hotkey-overlay-title="Nuguland: toggle bar orientation" {
15 15 spawn "uwsm" "app" "-s" "session-graphical.slice" "--" "qs" "ipc" "-c" "nuguland" "call" "nuguland" "setOrientation" "toggle"

quickshell/nuguland/.qmllint.ini

Added
new file mode 100644
1 +[General]
2 +MaxWarnings=0
4 +[Warnings]
5 +UncreatableType=disable

quickshell/nuguland/AGENTS.md

Modified
16 16 Zero-warning policy:
18 18 - `just lint` is the real gate: typecheck, lint, format-check, shader freshness, and Quickshell load.
19 -- `just lint` must emit no warnings.
19 +- `just lint` must emit no warnings and must fail on any non-disabled `qmllint` warning (`MaxWarnings=0`).
20 20 - Nuguland runtime never compiles shaders.
21 21 - Every future shader source must live under `shaders/*.frag`; `just build` must compile its checked-in `*.frag.qsb` blob.
22 22 - `just lint` must fail when any shader blob is missing, stale, or orphaned.

quickshell/nuguland/Audio.qml

Modified
1 1 import QtQuick
2 -import Quickshell
3 2 import Quickshell.Services.Pipewire
4 3 import "audio.js" as Audio
6 5 Item {
7 6 id: root
9 - property QtObject osdService
10 - property var lastAction: ({
11 - })
12 - property var lastOsd: ({
13 - })
8 + property Osd osdService
9 + property var lastAction: ({})
10 + property var lastOsd: ({})
14 11 readonly property bool pipewireReady: Pipewire.ready
15 12 readonly property var boundedActions: ["increase", "decrease", "muteOutput", "muteInput", "set-volume", "toggle-mute", "set-default-sink", "set-default-source"]
29 26 function nodeProps(node) {
30 - return node && node.properties ? node.properties : ({
31 - });
27 + return node && node.properties ? node.properties : ({});
34 30 function nodeName(node) {
53 49 const channels = node.audio.channels || [];
54 50 const strings = [];
55 - for (let i = 0; i < channels.length; i++) strings.push(String(PwAudioChannel.toString(channels[i])))
51 + for (let i = 0; i < channels.length; i++)
52 + strings.push(String(PwAudioChannel.toString(channels[i])));
56 53 return Audio.channelNames(strings);
112 109 function nodeById(id) {
113 110 const wanted = String(id);
114 111 const nodes = pipewireNodes();
115 - for (let i = 0; i < nodes.length; i++) if (nodeId(nodes[i]) === wanted) {
116 - return nodes[i];
117 - }
112 + for (let i = 0; i < nodes.length; i++)
113 + if (nodeId(nodes[i]) === wanted) {
114 + return nodes[i];
118 116 return null;
136 134 if (nodeId(link.target) === id)
137 135 return nodeId(link.source);
140 137 return "";
181 178 function microphoneActive() {
182 179 const sources = audioSources();
183 - for (let i = 0; i < sources.length; i++) if (nodeActive(sources[i]) && !nodeMuted(sources[i])) {
184 - return true;
185 - }
180 + for (let i = 0; i < sources.length; i++)
181 + if (nodeActive(sources[i]) && !nodeMuted(sources[i])) {
182 + return true;
186 184 return false;
208 206 function nativeCameraActive() {
209 207 const nodes = pipewireNodes();
210 - for (let i = 0; i < nodes.length; i++) if (cameraNodeActive(nodes[i])) {
211 - return true;
212 - }
208 + for (let i = 0; i < nodes.length; i++)
209 + if (cameraNodeActive(nodes[i])) {
210 + return true;
213 212 return false;
253 252 function osd(event, value) {
254 253 if (!osdService)
255 254 return {
256 - "event": event,
257 - "value": value
258 - };
255 + "event": event,
256 + "value": value
257 + };
261 260 return JSON.parse(osdService.trigger(event, value));
270 269 function stateObject(osdState) {
271 270 const sink = defaultSinkNode();
272 271 const source = defaultSourceNode();
273 - const sinkRows = audioSinks().map((node) => {
272 + const sinkRows = audioSinks().map(node => {
274 273 return Audio.shapeRow(nodeRow(node, "sink"), "sink");
276 - const sourceRows = audioSources().map((node) => {
275 + const sourceRows = audioSources().map(node => {
277 276 return Audio.shapeRow(nodeRow(node, "source"), "source");
279 - const streamRows = audioStreams().map((node) => {
278 + const streamRows = audioStreams().map(node => {
280 279 const raw = nodeRow(node, "stream");
281 280 const row = Audio.shapeRow(raw, "stream");
282 281 row.app = String(raw.app || row.name);
313 312 "active": privacyActive()
314 313 }, privacyWidgetState().privacy),
315 314 "lastAction": lastAction,
316 - "osd": osdState || lastOsd || {
317 - }
315 + "osd": osdState || lastOsd || {}
342 340 check("volumePercent(1)", Audio.volumePercent(1), 100);
343 341 check("volumePercent(1.5)", Audio.volumePercent(1.5), 150);
344 342 check("volumePercent(0)", Audio.volumePercent(0), 0);
345 - check("roleForSink(muted)", Audio.roleForSink({ "muted": true, "volume": 0.5 }), "warning");
346 - check("roleForSink(vol0)", Audio.roleForSink({ "muted": false, "volume": 0 }), "ui.minor");
347 - check("roleForSink(vol0.5)", Audio.roleForSink({ "muted": false, "volume": 0.5 }), "ui.accent");
348 - check("privacyLabel(mic+cam)", Audio.privacyLabel({ "mic": true, "cam": true }), "Mic Cam");
349 - check("privacyLabel(mic)", Audio.privacyLabel({ "mic": true, "cam": false }), "Mic");
350 - check("privacyLabel(cam)", Audio.privacyLabel({ "mic": false, "cam": true }), "Cam");
351 - check("privacyLabel(none)", Audio.privacyLabel({ "mic": false, "cam": false }), "Audio");
352 - const row = Audio.shapeRow({ "id": 42, "description": "Speakers", "volume": 0.5, "muted": false, "isDefault": true }, "sink");
343 + check("roleForSink(muted)", Audio.roleForSink({
344 + "muted": true,
345 + "volume": 0.5
346 + }), "warning");
347 + check("roleForSink(vol0)", Audio.roleForSink({
348 + "muted": false,
349 + "volume": 0
350 + }), "ui.minor");
351 + check("roleForSink(vol0.5)", Audio.roleForSink({
352 + "muted": false,
353 + "volume": 0.5
354 + }), "ui.accent");
355 + check("privacyLabel(mic+cam)", Audio.privacyLabel({
356 + "mic": true,
357 + "cam": true
358 + }), "Mic Cam");
359 + check("privacyLabel(mic)", Audio.privacyLabel({
360 + "mic": true,
361 + "cam": false
362 + }), "Mic");
363 + check("privacyLabel(cam)", Audio.privacyLabel({
364 + "mic": false,
365 + "cam": true
366 + }), "Cam");
367 + check("privacyLabel(none)", Audio.privacyLabel({
368 + "mic": false,
369 + "cam": false
370 + }), "Audio");
371 + const row = Audio.shapeRow({
372 + "id": 42,
373 + "description": "Speakers",
374 + "volume": 0.5,
375 + "muted": false,
376 + "isDefault": true
377 + }, "sink");
353 378 check("shapeRow.percent", row.percent, 50);
354 379 check("shapeRow.role", row.role, "ui.accent");
355 380 check("shapeRow.muted", row.muted, false);
363 388 function stateJson() {
364 - return JSON.stringify(stateObject({
365 - }));
389 + return JSON.stringify(stateObject({}));
368 392 function setVolume(id, volume) {
473 497 PwObjectTracker {
474 498 objects: [Pipewire.defaultAudioSink, Pipewire.defaultAudioSource]

quickshell/nuguland/AuroraBackdrop.qml

Modified
1 +pragma ComponentBehavior: Bound
1 2 import QtQuick
2 3 import Quickshell
3 4 import Quickshell.Io
6 7 PanelWindow {
7 8 id: root
9 - required property var screen
10 - required property QtObject resourceService
10 + required property Resources resourceService
11 11 property real targetX: 0.5
12 12 property real targetY: 0.5
13 13 property real smoothX: 0.5
16 16 property bool auroraAvailable: false
17 17 property bool lowPowerMode: false
18 18 property real firestormMix: 0
19 + property real auroraTime: 0
20 21 function targetFirestormMix() {
21 22 return root.resourceService ? Number(root.resourceService.firestormTarget || 0) : 0;
24 - screen: root.screen
25 25 visible: true
26 26 color: "#101010"
27 27 exclusionMode: ExclusionMode.Ignore
56 56 active: root.auroraAvailable && !root.lowPowerMode
58 58 sourceComponent: ShaderEffect {
59 - property real iTime: 0
59 + property real iTime: root.auroraTime
60 60 property vector2d iResolution: Qt.vector2d(width, height)
61 61 property vector2d iMouse: Qt.vector2d(root.smoothX, root.smoothY)
62 62 property real iFirestormMix: root.firestormMix
64 64 blending: true
65 65 fragmentShader: Qt.resolvedUrl("shaders/aurora.frag.qsb")
70 69 MouseArea {
71 70 anchors.fill: parent
72 71 hoverEnabled: true
73 72 acceptedButtons: Qt.NoButton
74 - onPositionChanged: (mouse) => {
73 + onPositionChanged: mouse => {
75 74 root.targetX = mouse.x / Math.max(1, width);
76 75 root.targetY = mouse.y / Math.max(1, height);
77 76 root.activeTicks = root.lowPowerMode ? 0 : 45;
85 84 onTriggered: {
86 85 root.activeTicks = Math.max(0, root.activeTicks - 1);
87 86 if (auroraLoader.item)
88 - auroraLoader.item.iTime += 0.04;
87 + root.auroraTime += 0.04;
90 89 root.smoothX += (root.targetX - root.smoothX) * 0.035;
91 90 root.smoothY += (root.targetY - root.smoothY) * 0.035;
92 91 root.firestormMix += (root.targetFirestormMix() - root.firestormMix) * 0.0035;

quickshell/nuguland/Bar.qml

Modified
1 +pragma ComponentBehavior: Bound
1 2 import QtQuick
2 3 import QtQuick.Layouts
3 4 import Quickshell
6 7 PanelWindow {
7 8 id: root
9 - required property var screen
10 - required property QtObject theme
11 - required property QtObject niriService
12 - required property QtObject timeService
13 - required property QtObject resourceService
14 - required property QtObject notificationService
15 - required property QtObject trayService
16 - required property QtObject mediaService
17 - required property QtObject clipboardService
18 - required property QtObject launcherService
19 - required property QtObject audioService
20 - required property QtObject brightnessService
21 - required property QtObject networkService
22 - required property QtObject bluetoothService
23 - required property QtObject powerService
24 - required property QtObject idleService
25 - required property QtObject lockService
26 - required property QtObject surfaces
27 - required property QtObject usageService
28 - required property QtObject caldavService
29 - required property QtObject formatService
10 + required property Theme theme
11 + required property Niri niriService
12 + required property Time timeService
13 + required property Resources resourceService
14 + required property Notifications notificationService
15 + required property Tray trayService
16 + required property Media mediaService
17 + required property Clipboard clipboardService
18 + required property Launcher launcherService
19 + required property Audio audioService
20 + required property Brightness brightnessService
21 + required property Network networkService
22 + required property Bluetooth bluetoothService
23 + required property Power powerService
24 + required property Idle idleService
25 + required property Lock lockService
26 + required property SurfaceManager surfaces
27 + required property Usage usageService
28 + required property CalDav caldavService
29 + required property Format formatService
30 30 required property string orientation
32 32 readonly property bool vertical: orientation === "vertical"
104 104 // Skip hidden items: the horizontal clock chip and the vertical clock
105 105 // stack share the "clock" key, so only the visible one must register.
106 106 if (!root.surfaces || !item || !item.visible || item.width <= 0 || item.height <= 0)
107 - return ;
107 + return;
109 109 const rect = itemRectInBar(item);
110 110 root.surfaces.registerAnchor(name, `${Math.round(rect.x)},${Math.round(rect.y)},${Math.round(rect.width)},${Math.round(rect.height)}`);
113 113 function activatePopout(name) {
114 114 if (!root.surfaces)
115 - return ;
115 + return;
117 117 const target = String(name);
118 118 if (root.surfaces.popoutOpen && root.surfaces.popoutName === target) {
135 - screen: root.screen
136 135 // horizontal: width spans (left+right anchored), implicitHeight sets bar
137 136 // height. vertical: height spans (top+bottom anchored), implicitWidth sets
138 137 // bar thickness from the widest chip content (never a magic constant).
210 209 columnSpacing: 8
211 210 clip: true
212 211 anchors.left: parent.left
213 - anchors.leftMargin: 10
212 + anchors.leftMargin: root.vertical ? 0 : 10
214 213 anchors.right: clockChip.left
215 - anchors.rightMargin: 12
214 + anchors.rightMargin: root.vertical ? 0 : 12
216 215 anchors.verticalCenter: parent.verticalCenter
216 + anchors.topMargin: root.vertical ? 10 : 0
217 + anchors.bottomMargin: root.vertical ? 10 : 0
218 219 states: State {
219 220 when: root.vertical
227 228 anchors.bottom: clockStack.top
228 229 anchors.horizontalCenter: parent.horizontalCenter
231 - PropertyChanges {
232 - target: workspaceStrip
233 - anchors.leftMargin: 0
234 - anchors.rightMargin: 0
235 - anchors.topMargin: 10
236 - anchors.bottomMargin: 10
237 - }
240 233 Repeater {
342 335 // fallback only for the unnamed, which are filtered out.
343 336 if (root.niriService)
344 337 root.niriService.focusWorkspace(pillWrap.modelData.name || pillWrap.modelData.idx || pillWrap.modelData.id);
365 349 // RIGHT zone: glanceable widgets at natural width, anchored to the right
377 361 rowSpacing: 4
378 362 columnSpacing: 4
379 363 anchors.right: parent.right
380 - anchors.rightMargin: 10
364 + anchors.rightMargin: root.vertical ? 0 : 10
381 365 anchors.verticalCenter: parent.verticalCenter
366 + anchors.bottomMargin: root.vertical ? 10 : 0
383 368 states: State {
384 369 when: root.vertical
390 375 anchors.bottom: parent.bottom
391 376 anchors.horizontalCenter: parent.horizontalCenter
394 - PropertyChanges {
395 - target: widgetsRow
396 - anchors.rightMargin: 0
397 - anchors.bottomMargin: 10
398 - }
401 380 Repeater {
407 386 popoutName: modelData
408 387 label: root.vertical ? root.formatService.abbreviate(root.chipLabel(modelData)) : root.chipLabel(modelData)
417 393 PopoutHost {
438 414 component NuguText: Text {
439 - required property QtObject theme
415 + required property Theme theme
440 416 property string variant: "body"
441 417 property bool selected: false
450 426 component OdometerText: Item {
451 427 id: odometer
453 - required property QtObject theme
429 + required property Theme theme
454 430 property string text: "--:--"
455 431 property bool selected: false
456 432 property int digitWidth: 10
524 500 model: 10
526 502 delegate: Text {
503 + required property int index
527 505 width: odometer.digitWidth
528 506 height: odometer.digitHeight
529 507 horizontalAlignment: Text.AlignHCenter
533 511 font.pixelSize: odometer.pixelSize
534 512 color: odometer.colorForCell(cellRoot.modelData)
539 516 Behavior on y {
541 518 duration: odometer.theme && odometer.theme.lowPowerMode ? 0 : 220
542 519 easing.type: Easing.OutCubic
549 524 Text {
554 529 font.pixelSize: odometer.pixelSize
555 530 color: odometer.colorForCell(cellRoot.modelData)
566 537 component StateLayer: MouseArea {
567 538 id: layer
569 - property QtObject theme
540 + property Theme theme
570 541 property bool checked: false
571 542 property bool disabled: false
572 543 property bool shapeMorph: true
575 546 property real disabledOpacity: 0.38
576 547 property point pressOrigin: Qt.point(width / 2, height / 2)
577 548 property real rippleRadius: 0
549 + property real cornerRadius: 0
578 550 property real endRadius: Math.sqrt(width * width + height * height) * (shapeMorph ? 1.25 : 1)
579 551 property string sourceMechanic: "Nuguland StateLayer.qml ButtonBase.qml"
581 - signal activated()
553 + signal activated
583 555 function stateLayerContract() {
584 556 return {
617 589 acceptedButtons: Qt.LeftButton
618 590 cursorShape: disabled ? Qt.ArrowCursor : Qt.PointingHandCursor
619 591 activeFocusOnTab: !disabled
620 - onPressed: (event) => {
592 + onPressed: event => {
621 593 return beginPress(event.x, event.y);
623 595 onClicked: activated()
624 - Keys.onReturnPressed: (event) => {
596 + Keys.onReturnPressed: event => {
625 597 event.accepted = true;
626 598 keyboardActivate();
628 - Keys.onSpacePressed: (event) => {
600 + Keys.onSpacePressed: event => {
629 601 event.accepted = true;
630 602 keyboardActivate();
633 605 Rectangle {
634 606 anchors.fill: parent
635 - radius: parent && parent.parent && parent.parent.radius !== undefined ? parent.parent.radius : 0
607 + radius: layer.cornerRadius
636 608 color: layer.theme ? layer.theme.ui.accent : "white"
637 609 opacity: layer.disabled ? layer.disabledOpacity : layer.pressed ? layer.pressOpacity : layer.containsMouse || layer.checked ? layer.hoverOpacity : 0
641 613 duration: layer.theme && layer.theme.lowPowerMode ? 0 : 120
642 614 easing.type: Easing.OutCubic
649 619 Rectangle {
660 630 duration: layer.theme && layer.theme.lowPowerMode ? 0 : 160
661 631 easing.type: Easing.OutCubic
668 636 NumberAnimation {
674 642 duration: layer.theme && layer.theme.lowPowerMode ? 0 : 220
675 643 easing.type: Easing.OutCubic
680 647 // Shared clock renderer. `stacked` lays HH / rule / MM in a column (vertical
721 688 Rectangle {
722 689 Layout.alignment: Qt.AlignCenter
723 - width: clk.stacked ? 16 : 2
724 - height: clk.stacked ? 2 : 14
690 + Layout.preferredWidth: clk.stacked ? 16 : 2
691 + Layout.preferredHeight: clk.stacked ? 2 : 14
725 692 radius: 1
726 693 color: root.theme ? root.theme.ui.accent : "transparent"
738 705 StateLayer {
739 706 theme: root.theme
707 + cornerRadius: clk.radius
740 708 checked: clk.selected
741 709 onEntered: {
742 710 if (root.surfaces)
743 711 root.surfaces.hoverRegisteredPopout("clock");
746 713 onActivated: {
747 714 if (root.surfaces)
748 715 root.activatePopout("clock");
813 779 duration: root.theme && root.theme.lowPowerMode ? 0 : 160
814 780 easing.type: Easing.OutCubic
821 785 StateLayer {
822 786 theme: root.theme
787 + cornerRadius: chip.radius
823 788 checked: chip.selected
825 790 onEntered: {
826 791 // idle is a toggle, not a popout — no hover-switch
827 792 if (chip.popoutName === "idle")
828 - return ;
793 + return;
830 795 if (root.surfaces)
831 796 root.surfaces.hoverRegisteredPopout(chip.popoutName);
834 798 onActivated: {
835 799 if (chip.popoutName === "idle") {
839 803 if (root.idleService)
840 804 root.idleService.toggle();
842 - return ;
806 + return;
844 808 if (root.surfaces)
845 809 root.activatePopout(chip.popoutName);

quickshell/nuguland/Bluetooth.qml

Modified
1 1 import QtQuick
2 -import Quickshell
3 2 import Quickshell.Bluetooth
3 +import "bluetoothNative.js" as BluetoothNative
5 5 Item {
6 6 id: root
8 8 property string error: ""
9 - property var lastAction: ({
10 - })
9 + property var lastAction: ({})
11 10 readonly property string nativeApi: "Quickshell.Bluetooth.Bluetooth.defaultAdapter BluetoothAdapter BluetoothDevice"
12 11 readonly property var boundedActions: ["scan", "toggle", "connect", "disconnect", "pair", "forget", "trust", "block"]
13 12 readonly property bool nativeActionRoute: true
14 13 function nativeAdapter() {
15 - return Bluetooth.defaultAdapter;
14 + return BluetoothNative.defaultAdapter(Bluetooth);
18 17 function deviceId(device) {
39 38 function nativeDevices() {
40 - return Bluetooth.devices.values.map((device) => {
39 + return BluetoothNative.devices(Bluetooth).map(device => {
41 40 return ({
42 - "id": deviceId(device),
43 - "name": deviceName(device),
44 - "type": String(device.icon || "device"),
45 - "connected": !!device.connected,
46 - "paired": !!device.paired,
47 - "trusted": !!device.trusted,
48 - "blocked": !!device.blocked,
49 - "battery": Number(device.batteryAvailable ? Math.round(Number(device.battery || 0) * 100) : -1),
50 - "nativeObject": device
51 - });
41 + "id": deviceId(device),
42 + "name": deviceName(device),
43 + "type": String(device.icon || "device"),
44 + "connected": !!device.connected,
45 + "paired": !!device.paired,
46 + "trusted": !!device.trusted,
47 + "blocked": !!device.blocked,
48 + "battery": Number(device.batteryAvailable ? Math.round(Number(device.battery || 0) * 100) : -1),
49 + "nativeObject": device
50 + });
71 70 function devicesById() {
72 - const indexed = {
73 - };
71 + const indexed = {};
74 72 const list = devicesList();
75 - for (let i = 0; i < list.length; i++) indexed[deviceId(list[i])] = cloneDevice(list[i])
73 + for (let i = 0; i < list.length; i++)
74 + indexed[deviceId(list[i])] = cloneDevice(list[i]);
76 75 return indexed;
79 - function enabled() {
78 + function adapterEnabled() {
80 79 const adapter = nativeAdapter();
81 80 return !!(adapter && adapter.enabled);
90 89 if (error.length > 0)
91 90 return "error";
93 - if (!enabled())
92 + if (!adapterEnabled())
94 93 return "ui.minor";
96 95 return discovering() ? "warning" : "ui.accent";
99 98 function connectedCount() {
100 99 let count = 0;
101 100 const list = devicesList();
102 - for (let i = 0; i < list.length; i++) if (list[i].connected) {
103 - count++;
104 - }
101 + for (let i = 0; i < list.length; i++)
102 + if (list[i].connected) {
103 + count++;
105 105 return count;
119 119 "error": error,
120 120 "adapter": {
121 121 "id": !nativeAdapter() ? "" : String(nativeAdapter().adapterId || ""),
122 - "state": enabled() ? "powered" : "disabled",
122 + "state": adapterEnabled() ? "powered" : "disabled",
123 123 "discovering": discovering(),
124 124 "discoverable": !nativeAdapter() ? false : !!nativeAdapter().discoverable,
125 125 "pairable": !nativeAdapter() ? false : !!nativeAdapter().pairable
127 - "devices": devicesList().map((device) => {
127 + "devices": devicesList().map(device => {
128 128 return cloneDevice(device);
130 130 "devicesById": devicesById(),
131 131 "compact": {
132 - "label": enabled() ? String(connectedCount()) + " connected" : "bluetooth off",
132 + "label": adapterEnabled() ? String(connectedCount()) + " connected" : "bluetooth off",
133 133 "role": role()
135 135 "lastAction": lastAction
143 143 function scan() {
144 144 const adapter = nativeAdapter();
145 - const wasEnabled = enabled();
145 + const wasEnabled = adapterEnabled();
146 146 if (adapter) {
147 147 adapter.enabled = true;
148 148 if (wasEnabled)
149 149 adapter.discovering = true;
152 151 error = "";
153 152 lastAction = {
163 162 nativeAdapter().enabled = !!on;
164 163 if (!on)
165 164 nativeAdapter().discovering = false;
168 166 error = "";
169 167 lastAction = {
170 168 "kind": "toggle",
171 - "enabled": enabled(),
169 + "enabled": adapterEnabled(),
172 170 "nativeActionRoute": nativeActionRoute
174 172 return stateJson();
202 200 if (actionName === "block")
203 201 device.blocked = true;
206 - };
207 204 error = "";
208 205 lastAction = {
209 206 "kind": actionName,
213 210 return stateJson();

quickshell/nuguland/Brightness.qml

Modified
6 6 Item {
7 7 id: root
9 - property QtObject osdService
9 + property Osd osdService
10 10 property string devicePath: "/sys/class/backlight/intel_backlight"
11 - property var lastAction: ({
12 - })
13 - property var lastOsd: ({
14 - })
11 + property var lastAction: ({})
12 + property var lastOsd: ({})
15 13 // Optimistic session level. The sysfs write is async (execDetached) and the
16 14 // FileView (blockAllReads) loads once and never reloads, so a fresh read after
17 15 // a write returns the stale startup value. Track the level we just set so
42 40 const text = String(Brightness.levelPercent(value));
43 41 if (!osdService)
44 42 return {
45 - "event": "brightness",
46 - "value": text
47 - };
43 + "event": "brightness",
44 + "value": text
45 + };
49 47 try {
50 48 return JSON.parse(osdService.trigger("brightness", text));
76 74 function selfTest() {
77 75 const cases = [];
78 76 const check = (name, got, want) => cases.push({
79 - "case": name,
80 - "ok": JSON.stringify(got) === JSON.stringify(want),
81 - "got": got,
82 - "want": want
83 - });
77 + "case": name,
78 + "ok": JSON.stringify(got) === JSON.stringify(want),
79 + "got": got,
80 + "want": want
81 + });
84 82 check("clampLevel(-1)", Brightness.clampLevel(-1), 0);
85 83 check("clampLevel(2)", Brightness.clampLevel(2), 1);
86 84 check("levelPercent(0.5)", Brightness.levelPercent(0.5), 50);
137 135 blockAllReads: true
138 136 printErrors: false

quickshell/nuguland/CalDav.qml

Modified
1 +pragma ComponentBehavior: Bound
1 2 import QtQuick
2 3 import Quickshell
3 4 import Quickshell.Io
12 13 property var events: []
13 14 property bool stale: false
14 15 // needs-setup until config has url+username AND a fetch has succeeded/failed
15 - property string status: (cfgAdapter.url && cfgAdapter.username) ? "loading" : "needs-setup"
16 + property string status: (root.config.url && root.config.username) ? "loading" : "needs-setup"
17 18 readonly property string host: {
18 - const u = cfgAdapter.url ? String(cfgAdapter.url) : "";
19 + const u = root.config.url ? String(root.config.url) : "";
19 20 const m = /^https?:\/\/([^\/:]+)/.exec(u);
20 21 return m ? m[1] : "";
23 24 // scheme+host only; PROPFIND hrefs are absolute from the host root, so the
24 25 // dav path must NOT be prepended again when building fetch URLs.
25 26 readonly property string origin: {
26 - const u = cfgAdapter.url ? String(cfgAdapter.url) : "";
27 + const u = root.config.url ? String(root.config.url) : "";
27 28 const m = /^(https?:\/\/[^\/]+)/.exec(u);
28 29 return m ? m[1] : "";
44 45 function selfTest() {
45 46 const cases = [];
46 - function ok(name, cond) { cases.push({ name: name, pass: !!cond }); }
47 + function ok(name, cond) {
48 + cases.push({
49 + name: name,
50 + pass: !!cond
51 + });
52 + }
47 53 try {
48 54 ok("unescape-adjacent", Ical.unescapeText("lit\\\\nslash") === "lit\\nslash");
49 55 ok("entity-decode", Ical.decodeXmlEntities("a&quot;b") === 'a"b');
50 56 const ev = Ical.parseIcs('@@CAL /p/\t#5b8cff\tVEVENT\n<c:calendar-data>BEGIN:VEVENT\nUID:u\nSUMMARY:X\nDTSTART:20260601T090000Z\nEND:VEVENT</c:calendar-data>')[0];
51 57 ok("parse-timed", ev && ev.summary === "X" && ev.allDay === false);
52 - const seg = Ical.buildSegments([{ allDay: true, date: "2026-06-10", endDate: "2026-06-13", color: "#fff", summary: "U" }], "2026-06-08");
58 + const seg = Ical.buildSegments([
59 + {
60 + allDay: true,
61 + date: "2026-06-10",
62 + endDate: "2026-06-13",
63 + color: "#fff",
64 + summary: "U"
65 + }
66 + ], "2026-06-08");
53 67 ok("segments", seg.segments.length === 1 && seg.segments[0].colStart === 2 && seg.segments[0].colEnd === 4);
54 68 const propfind = '<d:multistatus xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:ic="http://apple.com/ns/ical/"><d:response><d:href>/p/personal/</d:href><d:propstat><d:prop><d:displayname>Mine</d:displayname><ic:calendar-color>#5b8cff</ic:calendar-color><d:resourcetype><cal:calendar/></d:resourcetype><cal:supported-calendar-component-set><cal:comp name="VEVENT"/></cal:supported-calendar-component-set></d:prop></d:propstat></d:response></d:multistatus>';
55 69 const cals = root.parseCalendars(propfind);
56 70 ok("discover", cals.length === 1 && cals[0].displayName === "Mine" && cals[0].color === "#5b8cff" && cals[0].components.indexOf("VEVENT") >= 0);
57 71 const w = root.windowUtc("2026-06-08"); // Monday grid start
58 72 const shape = /^\d{8}T\d{6}Z$/;
59 - const back = new Date(Date.UTC(+w.start.slice(0,4), +w.start.slice(4,6)-1, +w.start.slice(6,8), +w.start.slice(9,11), +w.start.slice(11,13), +w.start.slice(13,15)));
60 - const spanDays = (Date.UTC(+w.end.slice(0,4), +w.end.slice(4,6)-1, +w.end.slice(6,8), +w.end.slice(9,11)) - Date.UTC(+w.start.slice(0,4), +w.start.slice(4,6)-1, +w.start.slice(6,8), +w.start.slice(9,11))) / 86400000;
61 - ok("window", shape.test(w.start) && shape.test(w.end)
62 - && back.getFullYear() === 2026 && back.getMonth() === 5 && back.getDate() === 8 && back.getHours() === 0
63 - && spanDays === 42); // local-midnight round-trip + 42-day span, timezone-independent
73 + const back = new Date(Date.UTC(+w.start.slice(0, 4), +w.start.slice(4, 6) - 1, +w.start.slice(6, 8), +w.start.slice(9, 11), +w.start.slice(11, 13), +w.start.slice(13, 15)));
74 + const spanDays = (Date.UTC(+w.end.slice(0, 4), +w.end.slice(4, 6) - 1, +w.end.slice(6, 8), +w.end.slice(9, 11)) - Date.UTC(+w.start.slice(0, 4), +w.start.slice(4, 6) - 1, +w.start.slice(6, 8), +w.start.slice(9, 11))) / 86400000;
75 + ok("window", shape.test(w.start) && shape.test(w.end) && back.getFullYear() === 2026 && back.getMonth() === 5 && back.getDate() === 8 && back.getHours() === 0 && spanDays === 42); // local-midnight round-trip + 42-day span, timezone-independent
64 76 } catch (e) {
65 77 ok("threw:" + e, false);
67 79 const fail = cases.filter(c => !c.pass).length;
68 - return JSON.stringify({ pass: cases.length - fail, fail: fail, cases: cases });
80 + return JSON.stringify({
81 + pass: cases.length - fail,
82 + fail: fail,
83 + cases: cases
84 + });
71 - // write the adapter back to disk (also fires automatically on property change)
72 - function persistConfig() { cfgFile.writeAdapter(); }
87 + function loadConfig() {
88 + let data = {};
89 + try {
90 + data = JSON.parse(cfgFile.text() || "{}");
91 + } catch (error) {
92 + data = {};
93 + }
94 + root.config.url = String(data.url || "");
95 + root.config.username = String(data.username || "");
96 + root.config.calendars = data.calendars || [];
97 + }
99 + function persistConfig() {
100 + cfgFile.setText(JSON.stringify({
101 + "url": root.config.url,
102 + "username": root.config.username,
103 + "calendars": root.config.calendars || []
104 + }, null, 2));
74 107 // --- discovery: parse a PROPFIND multistatus into calendar descriptors ---
75 108 function parseCalendars(xml) {
83 116 const name = (/<[^>]*:?displayname[^>]*>([\s\S]*?)<\/[^>]*:?displayname>/.exec(body) || [])[1];
84 117 const color = (/<[^>]*calendar-color[^>]*>([\s\S]*?)<\/[^>]*calendar-color>/.exec(body) || [])[1];
85 118 const isCal = /<[^>]*:?calendar\b[^>]*\/?>/.test(body);
86 - if (!href || !name || !isCal) continue; // skip inbox/outbox/trashbin (no displayname) + non-calendars
119 + if (!href || !name || !isCal)
120 + continue; // skip inbox/outbox/trashbin (no displayname) + non-calendars
87 121 const comps = [];
88 122 const compRe = /<[^>]*:?comp[^>]*name="([^"]+)"/g;
89 123 let cm;
90 - while ((cm = compRe.exec(body)) !== null) comps.push(cm[1]);
124 + while ((cm = compRe.exec(body)) !== null)
125 + comps.push(cm[1]);
91 126 out.push({
92 127 href: Ical.decodeXmlEntities(href).trim(),
93 128 displayName: Ical.decodeXmlEntities(name).trim(),
102 137 function discoverAndFetch() {
103 - if (!root.host || !root.config.username) { root.status = "needs-setup"; return; }
138 + if (!root.host || !root.config.username) {
139 + root.status = "needs-setup";
140 + return;
104 142 root.status = "loading";
105 143 discoverProc.exec({
106 144 command: ["sh", "-c", root.discoverScript()],
115 153 function discoverScript() {
116 154 // password read here, fed to curl via -K - on stdin; never in argv
117 - return 'PW="$(secret-tool lookup service caldav host "$CALDAV_HOST" 2>/dev/null)";' +
118 - 'if [ -z "$PW" ]; then echo __NO_SECRET__; exit 0; fi;' +
119 - 'curl -sS -X PROPFIND -H "Depth: 1" -H "Content-Type: application/xml" ' +
120 - '--data \'<d:propfind xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:i="http://apple.com/ns/ical/"><d:prop><d:resourcetype/><d:displayname/><i:calendar-color/><c:supported-calendar-component-set/></d:prop></d:propfind>\' ' +
121 - '-K - "$CALDAV_URL" <<EOF\nuser = "$CALDAV_USER:$PW"\nEOF';
155 + return 'PW="$(secret-tool lookup service caldav host "$CALDAV_HOST" 2>/dev/null)";' + 'if [ -z "$PW" ]; then echo __NO_SECRET__; exit 0; fi;' + 'curl -sS -X PROPFIND -H "Depth: 1" -H "Content-Type: application/xml" ' + '--data \'<d:propfind xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:i="http://apple.com/ns/ical/"><d:prop><d:resourcetype/><d:displayname/><i:calendar-color/><c:supported-calendar-component-set/></d:prop></d:propfind>\' ' + '-K - "$CALDAV_URL" <<EOF\nuser = "$CALDAV_USER:$PW"\nEOF';
124 158 function applyDiscovery(text) {
125 159 const t = String(text || "");
126 - if (t.indexOf("__NO_SECRET__") >= 0) { root.status = "needs-setup"; return; }
160 + if (t.indexOf("__NO_SECRET__") >= 0) {
161 + root.status = "needs-setup";
162 + return;
127 164 const cals = root.parseCalendars(t);
128 - if (!cals.length) { root.status = "offline"; root.stale = true; return; }
165 + if (!cals.length) {
166 + root.status = "offline";
167 + root.stale = true;
168 + return;
129 170 root.config.calendars = cals;
130 171 root.persistConfig();
131 172 root.refresh();
138 179 const first = new Date(now.getFullYear(), now.getMonth(), 1);
139 180 const dow = (first.getDay() + 6) % 7; // 0=Mon
140 181 first.setDate(first.getDate() - dow);
141 - function p(n){ return (n<10?"0":"")+n; }
142 - return first.getFullYear() + "-" + p(first.getMonth()+1) + "-" + p(first.getDate());
182 + function p(n) {
183 + return (n < 10 ? "0" : "") + n;
185 + return first.getFullYear() + "-" + p(first.getMonth() + 1) + "-" + p(first.getDate());
145 188 // window from a "YYYY-MM-DD" local grid start: [start, start+42d] as UTC ICAL stamps
146 189 function windowUtc(gridStart) {
147 190 const p = gridStart.split("-");
148 - const s = new Date(+p[0], +p[1]-1, +p[2], 0, 0, 0); // local midnight
149 - const e = new Date(s.getTime()); e.setDate(e.getDate() + 42);
150 - function fmt(d){
151 - function z(n){ return (n<10?"0":"")+n; }
152 - return d.getUTCFullYear()+z(d.getUTCMonth()+1)+z(d.getUTCDate())+"T"+z(d.getUTCHours())+z(d.getUTCMinutes())+z(d.getUTCSeconds())+"Z";
191 + const s = new Date(+p[0], +p[1] - 1, +p[2], 0, 0, 0); // local midnight
192 + const e = new Date(s.getTime());
193 + e.setDate(e.getDate() + 42);
194 + function fmt(d) {
195 + function z(n) {
196 + return (n < 10 ? "0" : "") + n;
198 + return d.getUTCFullYear() + z(d.getUTCMonth() + 1) + z(d.getUTCDate()) + "T" + z(d.getUTCHours()) + z(d.getUTCMinutes()) + z(d.getUTCSeconds()) + "Z";
154 - return { start: fmt(s), end: fmt(e) };
200 + return {
201 + start: fmt(s),
202 + end: fmt(e)
203 + };
157 206 function refresh() {
158 - if (!root.host || !root.config.username) { root.status = "needs-setup"; return; }
159 - if (!root.config.calendars || !root.config.calendars.length) { root.discoverAndFetch(); return; }
207 + if (!root.host || !root.config.username) {
208 + root.status = "needs-setup";
209 + return;
211 + if (!root.config.calendars || !root.config.calendars.length) {
212 + root.discoverAndFetch();
213 + return;
160 215 root.status = "loading";
161 216 const gs = root.gridStartDate();
162 217 const w = root.windowUtc(gs);
182 237 function fetchScript() {
183 238 // For each "href\tcolor\tkind" line: print delimiter, then curl REPORT.
184 239 // VEVENT uses <c:expand>; VTODO must NOT (Nextcloud #45333 drops tasks).
185 - return 'PW="$(secret-tool lookup service caldav host "$CALDAV_HOST" 2>/dev/null)";' +
186 - 'if [ -z "$PW" ]; then echo __NO_SECRET__; exit 0; fi;' +
187 - 'printf %s "$CALDAV_CALS" | while IFS="\t" read -r HREF COLOR KIND; do ' +
188 - '[ -z "$HREF" ] && continue;' +
189 - 'printf "@@CAL %s\\t%s\\t%s\\n" "$HREF" "$COLOR" "$KIND";' +
190 - 'if [ "$KIND" = "VTODO" ]; then ' +
191 - 'BODY="<c:calendar-query xmlns:d=\\"DAV:\\" xmlns:c=\\"urn:ietf:params:xml:ns:caldav\\"><d:prop><c:calendar-data/></d:prop><c:filter><c:comp-filter name=\\"VCALENDAR\\"><c:comp-filter name=\\"VTODO\\"/></c:comp-filter></c:filter></c:calendar-query>";' +
192 - 'else ' +
193 - 'BODY="<c:calendar-query xmlns:d=\\"DAV:\\" xmlns:c=\\"urn:ietf:params:xml:ns:caldav\\"><d:prop><c:calendar-data><c:expand start=\\"$CALDAV_WIN_START\\" end=\\"$CALDAV_WIN_END\\"/></c:calendar-data></d:prop><c:filter><c:comp-filter name=\\"VCALENDAR\\"><c:comp-filter name=\\"VEVENT\\"><c:time-range start=\\"$CALDAV_WIN_START\\" end=\\"$CALDAV_WIN_END\\"/></c:comp-filter></c:comp-filter></c:filter></c:calendar-query>";' +
194 - 'fi;' +
195 - 'curl -sS -X REPORT -H "Depth: 1" -H "Content-Type: application/xml" --data "$BODY" -K - "$CALDAV_BASE$HREF" <<EOF\nuser = "$CALDAV_USER:$PW"\nEOF\n' +
196 - 'printf "\\n";' +
197 - 'done';
240 + return 'PW="$(secret-tool lookup service caldav host "$CALDAV_HOST" 2>/dev/null)";' + 'if [ -z "$PW" ]; then echo __NO_SECRET__; exit 0; fi;' + 'printf %s "$CALDAV_CALS" | while IFS="\t" read -r HREF COLOR KIND; do ' + '[ -z "$HREF" ] && continue;' + 'printf "@@CAL %s\\t%s\\t%s\\n" "$HREF" "$COLOR" "$KIND";' + 'if [ "$KIND" = "VTODO" ]; then ' + 'BODY="<c:calendar-query xmlns:d=\\"DAV:\\" xmlns:c=\\"urn:ietf:params:xml:ns:caldav\\"><d:prop><c:calendar-data/></d:prop><c:filter><c:comp-filter name=\\"VCALENDAR\\"><c:comp-filter name=\\"VTODO\\"/></c:comp-filter></c:filter></c:calendar-query>";' + 'else ' + 'BODY="<c:calendar-query xmlns:d=\\"DAV:\\" xmlns:c=\\"urn:ietf:params:xml:ns:caldav\\"><d:prop><c:calendar-data><c:expand start=\\"$CALDAV_WIN_START\\" end=\\"$CALDAV_WIN_END\\"/></c:calendar-data></d:prop><c:filter><c:comp-filter name=\\"VCALENDAR\\"><c:comp-filter name=\\"VEVENT\\"><c:time-range start=\\"$CALDAV_WIN_START\\" end=\\"$CALDAV_WIN_END\\"/></c:comp-filter></c:comp-filter></c:filter></c:calendar-query>";' + 'fi;' + 'curl -sS -X REPORT -H "Depth: 1" -H "Content-Type: application/xml" --data "$BODY" -K - "$CALDAV_BASE$HREF" <<EOF\nuser = "$CALDAV_USER:$PW"\nEOF\n' + 'printf "\\n";' + 'done';
200 243 function applyFetch(text) {
201 244 const t = String(text || "");
202 - if (t.indexOf("__NO_SECRET__") >= 0) { root.status = "needs-setup"; return; }
245 + if (t.indexOf("__NO_SECRET__") >= 0) {
246 + root.status = "needs-setup";
247 + return;
203 249 let parsed = [];
204 - try { parsed = Ical.parseIcs(t); } catch (e) { parsed = []; }
250 + try {
251 + parsed = Ical.parseIcs(t);
252 + } catch (e) {
253 + parsed = [];
205 255 // a successful REPORT is a 207 <d:multistatus>; its absence means a
206 256 // transport/auth failure (curl prints @@CAL headers but no data), so
207 257 // t is non-empty yet useless — keep last-good events and flag stale.
208 258 // (an empty month still returns multistatus, so this won't false-trip.)
209 - if (t.indexOf("multistatus") < 0) { root.status = "offline"; root.stale = true; return; }
259 + if (t.indexOf("multistatus") < 0) {
260 + root.status = "offline";
261 + root.stale = true;
262 + return;
210 264 // client-side window filter for tasks (VTODO has no server time-range)
211 265 const gs = root.gridStartDate();
212 266 const winStart = gs, winEnd = Ical.addDays(gs, 42);
213 267 root.events = parsed.filter(function (ev) {
214 - if (ev.kind !== "task") return true;
268 + if (ev.kind !== "task")
269 + return true;
215 270 return ev.date && ev.date >= winStart && ev.date < winEnd;
217 272 root.status = "ok";
228 283 root.secretError = "";
229 284 const u = String(url || "").trim().replace(/\/+$/, "");
230 285 const user = String(username || "").trim();
231 - if (!u || !user || !password) { root.secretError = "URL, Benutzer und Passwort nötig"; return; }
286 + if (!u || !user || !password) {
287 + root.secretError = "URL, Benutzer und Passwort nötig";
288 + return;
232 290 const m = /^https?:\/\/([^\/:]+)/.exec(u);
233 291 const h = m ? m[1] : "";
234 - if (!h) { root.secretError = "URL ungültig (https://… erwartet)"; return; }
292 + if (!h) {
293 + root.secretError = "URL ungültig (https://… erwartet)";
294 + return;
235 296 root.config.url = u;
236 297 root.config.username = user;
237 298 root.config.calendars = [];
239 300 root.status = "loading";
240 301 storeProc.exec({
241 302 command: ["sh", "-c", root.storeScript()],
242 - environment: { CALDAV_HOST: h, CALDAV_USER: user, CALDAV_NEWPW: String(password) }
303 + environment: {
304 + CALDAV_HOST: h,
305 + CALDAV_USER: user,
306 + CALDAV_NEWPW: String(password)
250 315 Process {
251 316 id: discoverProc
252 - stdout: StdioCollector { waitForEnd: true; onStreamFinished: root.applyDiscovery(this.text) }
253 - stderr: StdioCollector { waitForEnd: true; onStreamFinished: if (this.text.trim()) root.stale = true }
317 + stdout: StdioCollector {
318 + waitForEnd: true
319 + onStreamFinished: root.applyDiscovery(this.text)
321 + stderr: StdioCollector {
322 + waitForEnd: true
323 + onStreamFinished: if (this.text.trim())
324 + root.stale = true
256 328 Process {
257 329 id: fetchProc
258 - stdout: StdioCollector { waitForEnd: true; onStreamFinished: root.applyFetch(this.text) }
259 - stderr: StdioCollector { waitForEnd: true; onStreamFinished: if (this.text.trim()) { root.stale = true; if (root.status === "loading") root.status = "offline"; } }
330 + stdout: StdioCollector {
331 + waitForEnd: true
332 + onStreamFinished: root.applyFetch(this.text)
334 + stderr: StdioCollector {
335 + waitForEnd: true
336 + onStreamFinished: if (this.text.trim()) {
337 + root.stale = true;
338 + if (root.status === "loading")
339 + root.status = "offline";
262 344 Process {
263 345 id: storeProc
264 - stderr: StdioCollector { waitForEnd: true; onStreamFinished: if (this.text.trim()) root.secretError = this.text.trim() }
265 - onExited: (code, status) => {
266 - if (code === 0) { root.secretError = ""; root.discoverAndFetch(); }
267 - else { root.status = "needs-setup"; if (!root.secretError) root.secretError = "Keyring-Fehler (" + code + ")"; }
346 + stderr: StdioCollector {
347 + waitForEnd: true
348 + onStreamFinished: if (this.text.trim())
349 + root.secretError = this.text.trim()
351 + function onExited(code) {
352 + if (code === 0) {
353 + root.secretError = "";
354 + root.discoverAndFetch();
355 + } else {
356 + root.status = "needs-setup";
357 + if (!root.secretError)
358 + root.secretError = "Keyring-Fehler (" + code + ")";
275 367 onTriggered: root.refresh()
370 + QtObject {
371 + id: cfgAdapter
373 + property string url: ""
374 + property string username: ""
375 + property var calendars: []
278 378 FileView {
279 379 id: cfgFile
280 380 path: root.configPath
281 - onAdapterUpdated: writeAdapter()
282 381 // config is read async; refresh only once url/username are populated
283 - onLoaded: Qt.callLater(root.refresh)
284 - onLoadFailed: root.status = "needs-setup"
286 - JsonAdapter {
287 - id: cfgAdapter
288 - property string url: ""
289 - property string username: ""
290 - property var calendars: []
382 + onLoaded: {
383 + root.loadConfig();
384 + Qt.callLater(root.refresh);
386 + onLoadFailed: root.status = "needs-setup"

quickshell/nuguland/Clipboard.qml

Modified
9 9 property bool privateMode: false
10 10 property var rows: []
11 - property var lastAction: ({
12 - })
11 + property var lastAction: ({})
13 12 property bool persistenceReady: false
14 13 readonly property int maxRows: 40
15 14 readonly property string historyPath: Quickshell.statePath("clipboard-history.json")
17 16 // --- linear lookup over the raw persisted rows (id, title, body, pinned, createdAt) ---
18 17 function rawRowById(id) {
19 18 const needle = String(id);
20 - for (let i = 0; i < rows.length; i++) if (rows[i].id === needle) {
21 - return rows[i];
22 - }
19 + for (let i = 0; i < rows.length; i++)
20 + if (rows[i].id === needle) {
21 + return rows[i];
22 + }
23 23 return null;
26 26 function captureClipboard(text) {
27 27 const body = String(text || "");
28 28 if (privateMode || !Clip.isReadableText(body))
29 - return ;
29 + return;
31 31 const id = `clip-${Clip.hashText(body)}`;
32 32 const next = [];
52 52 // --- trimmed serialization: the view binds the cloned rows directly ---
53 53 function stateObject(query) {
54 54 const now = Date.now();
55 - const viewRows = Clip.filterRows(rows, query).map((row) => {
55 + const viewRows = Clip.filterRows(rows, query).map(row => {
56 56 return Clip.cloneRow(row, now);
58 58 return {
74 74 function launcherRows(query) {
75 75 const now = Date.now();
76 - const result = Clip.filterRows(rows, query).map((row) => {
76 + const result = Clip.filterRows(rows, query).map(row => {
77 77 return Clip.cloneRow(row, now);
79 79 for (let i = 0; i < result.length; i++) {
86 86 function mutateRow(id, callback) {
87 87 const next = [];
88 88 for (let i = 0; i < rows.length; i++) {
89 - const row = Object.assign({
90 - }, rows[i]);
89 + const row = Object.assign({}, rows[i]);
91 90 if (row.id === String(id))
92 91 callback(row);
100 99 function togglePin(id) {
101 - mutateRow(id, (row) => {
100 + mutateRow(id, row => {
102 101 return row.pinned = !row.pinned;
104 103 lastAction = {
142 141 for (let i = 0; i < rows.length; i++) {
143 142 if (rows[i].id !== target)
144 143 next.push(rows[i]);
147 145 rows = next;
148 146 saveHistory();
158 156 const parsed = JSON.parse(String(text || "{}"));
159 157 const loadedRows = Array.isArray(parsed.rows) ? parsed.rows : [];
160 - rows = loadedRows.map((row) => {
158 + rows = loadedRows.map(row => {
161 159 return Clip.persistedRow(row);
162 - }).filter((row) => {
160 + }).filter(row => {
163 161 return row.id.length > 0 && Clip.isReadableText(row.body);
164 162 }).slice(0, maxRows);
165 163 } catch (error) {
172 170 function saveHistory() {
173 171 if (!persistenceReady)
174 - return ;
172 + return;
176 174 const payload = {
177 175 "version": 1,
178 - "rows": rows.map((row) => {
176 + "rows": rows.map(row => {
179 177 return Clip.persistedRow(row);
180 178 }).slice(0, maxRows)
207 205 ok("detect-path", Clip.detectKind("/etc/hosts").kind === "path");
208 206 ok("detect-text", Clip.detectKind("just some words").kind === "text");
209 207 const sorted = Clip.sortRows([
210 - { "id": "a", "title": "a", "body": "a", "pinned": false, "createdAt": 100 },
211 - { "id": "b", "title": "b", "body": "b", "pinned": false, "createdAt": 200 },
212 - { "id": "c", "title": "c", "body": "c", "pinned": true, "createdAt": 50 }
209 + "id": "a",
210 + "title": "a",
211 + "body": "a",
212 + "pinned": false,
213 + "createdAt": 100
214 + },
216 + "id": "b",
217 + "title": "b",
218 + "body": "b",
219 + "pinned": false,
220 + "createdAt": 200
221 + },
223 + "id": "c",
224 + "title": "c",
225 + "body": "c",
226 + "pinned": true,
227 + "createdAt": 50
214 230 ok("sort-pinned-first", sorted[0].id === "c");
215 231 ok("sort-recency-desc", sorted[1].id === "b" && sorted[2].id === "a");
216 232 const filtered = Clip.filterRows([
217 - { "id": "x", "title": "hello", "body": "world", "pinned": false, "createdAt": 1 },
218 - { "id": "y", "title": "foo", "body": "bar", "pinned": false, "createdAt": 2 }
234 + "id": "x",
235 + "title": "hello",
236 + "body": "world",
237 + "pinned": false,
238 + "createdAt": 1
239 + },
241 + "id": "y",
242 + "title": "foo",
243 + "body": "bar",
244 + "pinned": false,
245 + "createdAt": 2
219 247 ], "foo");
220 248 ok("filter-match", filtered.length === 1 && filtered[0].id === "y");
221 - const imageRow = Clip.cloneRow({ "id": "i", "body": "/tmp/p.png", "pinned": false, "createdAt": Date.now() });
249 + const imageRow = Clip.cloneRow({
250 + "id": "i",
251 + "body": "/tmp/p.png",
252 + "pinned": false,
253 + "createdAt": Date.now()
254 + });
222 255 ok("clone-image", imageRow.isImage === true && imageRow.title === "Image" && imageRow.imagePath === "/tmp/p.png");
223 - const colorRow = Clip.cloneRow({ "id": "c2", "body": "#abc", "pinned": false, "createdAt": Date.now() });
256 + const colorRow = Clip.cloneRow({
257 + "id": "c2",
258 + "body": "#abc",
259 + "pinned": false,
260 + "createdAt": Date.now()
261 + });
224 262 ok("clone-swatch", colorRow.kind === "color" && colorRow.swatch === "#aabbcc");
225 263 } catch (error) {
226 264 ok("threw:" + error, false);
228 - const fail = cases.filter((c) => {
266 + const fail = cases.filter(c => {
229 267 return !c.pass;
230 268 }).length;
231 269 return JSON.stringify({
258 296 stdout: SplitParser {
259 297 splitMarker: "\u001e"
260 - onRead: (data) => {
298 + onRead: data => {
261 299 return root.captureClipboard(data);

quickshell/nuguland/Format.qml

Modified
1 -pragma ComponentBehavior: Bound
2 1 import QtQuick
4 3 // Tiny stateless text helper. Lives outside the Bar (a Variants delegate with

quickshell/nuguland/Idle.qml

Modified
44 44 implicitHeight: 0
45 45 color: "transparent"
47 - mask: Region {
48 - }
47 + mask: Region {}
52 50 IdleInhibitor {
53 51 enabled: root.inhibited
54 52 window: idleWindow

quickshell/nuguland/Launcher.qml

Modified
5 5 Item {
6 6 id: root
8 - property QtObject niriService
9 - property QtObject clipboardService
10 8 property var launchRecords: []
11 - property var lastInteraction: ({
12 - })
13 - readonly property var actions: [{
14 - "id": "lock",
15 - "title": "Lock",
16 - "subtitle": "Lock this session",
17 - "route": "service"
18 - }, {
19 - "id": "overview",
20 - "title": "Overview",
21 - "subtitle": "Open niri overview",
22 - "route": "service"
23 - }, {
24 - "id": "screenshot",
25 - "title": "Screenshot",
26 - "subtitle": "Capture with native niri screenshot",
27 - "route": "service"
28 - }, {
29 - "id": "color",
30 - "title": "Pick color",
31 - "subtitle": "Use native niri color picker",
32 - "route": "service"
33 - }]
34 - // Apps come straight from Quickshell's native DesktopEntries singleton, which
35 - // already parses XDG desktop files, drops Hidden/NoDisplay, and dedupes by id.
36 - // The binding re-evaluates when the entry set changes. Mapping lives in launch.js.
9 + property var lastInteraction: ({})
37 11 readonly property var apps: Launch.buildApps(DesktopEntries.applications ? DesktopEntries.applications.values : [])
38 12 readonly property bool appScanDone: true
39 13 readonly property string appScanError: ""
41 - // IPC serializer (launcherState). Telemetry essentials only — all narration
42 - // fields were removed with the launcher redesign.
43 15 function stateJson() {
44 16 return JSON.stringify({
45 17 "launchRecords": launchRecords,
53 - // Telemetry-ONLY: records activations; does NOT feed scoring (ranking is a
54 - // pure function of query + static per-provider boost in launch.js).
55 25 function rememberActivation(record, executed) {
56 26 const entry = {
57 27 "kind": "activate",
81 - return rowJson || ({
82 - });
51 + return rowJson || ({});
85 54 function sliceForRow(row) {
86 - if (row.provider === "app")
87 - return row.terminal ? "work.slice" : "app-graphical.slice";
89 - return "session-graphical.slice";
55 + return row.terminal ? "work.slice" : "app-graphical.slice";
92 58 function launchRecord(rowJson) {
93 59 const row = rowFromJson(rowJson);
94 - const provider = String(row.provider || row.route || "item");
95 - const title = String(row.title || row.id || provider);
60 + const title = String(row.title || row.id || "app");
96 61 const id = String(row.id || row.desktopId || title);
97 - 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)] : []))));
98 62 return JSON.stringify({
99 63 "id": id,
100 64 "label": title,
101 - "kind": provider === "app" ? "app" : provider,
102 - "provider": provider,
65 + "kind": "app",
66 + "provider": "app",
103 67 "desktopId": row.desktopId || "",
104 68 "desktopPath": row.desktopPath || "",
105 - "argv": argv,
106 - "workingDirectory": "",
107 - "environment": {
108 - },
69 + "argv": row.execArgv || [],
70 + "workingDirectory": row.workingDirectory || "",
71 + "environment": {},
109 72 "slice": sliceForRow(row),
110 - "startupNotify": provider === "app",
73 + "startupNotify": true,
111 74 "windowMatching": {
112 75 "desktopId": row.desktopId || "",
113 76 "title": title,
114 77 "appId": row.desktopId ? String(row.desktopId).replace(/\.desktop$/, "") : ""
116 - "osdFeedback": `${provider}:${title}`,
117 - "route": row.route || provider,
79 + "osdFeedback": `app:${title}`,
80 + "route": "desktop-entry",
118 81 "terminal": !!row.terminal
122 - function runAction(id) {
123 - const name = String(id);
124 - if (name === "overview" && niriService)
125 - niriService.action(["toggle-overview"]);
85 + function execRecord(record) {
86 + if (!record.argv || record.argv.length === 0)
87 + return false;
127 - if (name === "screenshot" && niriService)
128 - niriService.screenshot(Quickshell.env("XDG_RUNTIME_DIR") + "/nuguland-launcher-screenshot.png");
130 - if (name === "color" && niriService)
131 - niriService.pickColor();
133 - return name === "overview" || name === "screenshot" || name === "color";
89 + const selector = record.slice === "work.slice" ? "w" : "a";
90 + Quickshell.execDetached(["uwsm", "app", "-s", selector, "--"].concat(record.argv));
91 + return true;
136 94 function activate(rowJson) {
137 - const row = rowFromJson(rowJson);
138 - const record = JSON.parse(launchRecord(row));
139 - if (record.kind === "calculator" || record.kind === "clipboard") {
140 - Quickshell.execDetached(record.argv);
141 - return rememberActivation(record, true);
142 - }
143 - if (record.kind === "action")
144 - return rememberActivation(record, runAction(record.id));
95 + const record = JSON.parse(launchRecord(rowJson));
96 + return rememberActivation(record, execRecord(record));
97 + }
146 - if (record.kind === "window" && niriService) {
147 - niriService.action(["focus-window", "--id", String(row.windowId || row.id)]);
148 - return rememberActivation(record, true);
99 + function activateAction(rowJson, index) {
100 + const row = rowFromJson(rowJson);
101 + const action = (row.actions || [])[Number(index) || 0];
102 + if (!action) {
103 + lastInteraction = {
104 + "kind": "activate-missing-action",
105 + "row": row.id || row.title || "app",
106 + "index": Number(index) || 0
107 + };
108 + return stateJson();
150 - if (record.kind === "app" && record.argv.length > 0) {
151 - const selector = record.slice === "work.slice" ? "w" : "a";
152 - Quickshell.execDetached(["uwsm", "app", "-s", selector].concat(record.desktopPath ? [record.desktopPath] : record.argv));
153 - return rememberActivation(record, true);
154 - }
155 - return rememberActivation(record, false);
111 + const record = JSON.parse(launchRecord(row));
112 + record.id = `${record.id}:${action.id || action.title}`;
113 + record.label = `${record.label}: ${action.title || action.id}`;
114 + record.argv = action.execArgv || [];
115 + record.desktopPath = "";
116 + record.osdFeedback = `app-action:${record.label}`;
117 + return rememberActivation(record, execRecord(record));
158 120 function activateFirst(query) {
170 132 function rowById(id) {
171 133 const wanted = String(id);
172 - for (let i = 0; i < actions.length; i++) {
173 - if (actions[i].id === wanted)
174 - return Launch.shapeRow(actions[i], "action", 1500);
176 - }
177 134 for (let i = 0; i < apps.length; i++) {
178 135 if (apps[i].id === wanted || apps[i].desktopId === wanted)
179 136 return Launch.shapeRow(Object.assign({
180 - "route": "desktop-entry"
181 - }, apps[i]), "app", 1500);
137 + "route": "desktop-entry"
138 + }, apps[i]), "app", 1500);
184 140 return null;
217 173 return JSON.stringify(lastInteraction);
220 - // Clipboard rows come from the clipboard service as a JSON string; the service
221 - // does its own query filtering. Empty list on missing service / parse failure.
222 - function clipboardProviderRows(query) {
223 - if (!clipboardService)
224 - return [];
226 - try {
227 - return JSON.parse(clipboardService.launcherRows(query));
228 - } catch (error) {
229 - return [];
230 - }
231 - }
233 - // Thin wrapper over launch.rankResults: gather the live source bundles (apps,
234 - // actions, niri windows, clipboard rows) and delegate all parsing/scoring/sort
235 - // to the pure ranking core. Returns {query, providerIntent, selectedIndex, results}.
236 176 function search(raw) {
237 - const intent = Launch.prefixIntent(raw);
238 - const windows = niriService ? (niriService.windows || []) : [];
239 - const clipRows = (intent.intent === "clipboard" || intent.intent === "all") ? clipboardProviderRows(intent.query) : [];
240 177 const ranked = Launch.rankResults(raw, {
241 - "apps": apps,
242 - "actions": actions,
243 - "windows": windows,
244 - "clipRows": clipRows
178 + "apps": apps
246 180 return JSON.stringify({
247 181 "query": raw,
254 - // Gate test: exercises the pure launch.js logic through QML so a stale qmlcache
255 - // or a broken import surfaces as failing cases. Mirrors Clipboard.qml selfTest.
256 188 function selfTest() {
257 189 const cases = [];
258 190 function ok(name, cond) {
265 - ok("prefix-calculator", Launch.prefixIntent("=2+2").intent === "calculator");
266 - ok("prefix-action", Launch.prefixIntent("> over").intent === "action");
267 - ok("prefix-clipboard", Launch.prefixIntent("clip foo").intent === "clipboard" && Launch.prefixIntent("clip foo").query === "foo");
268 - ok("prefix-all", Launch.prefixIntent("firefox").intent === "all");
197 + ok("intent-app", Launch.prefixIntent("firefox").intent === "app");
269 198 const exact = Launch.fuzzyScore("firefox", "firefox", 0);
270 199 const prefix = Launch.fuzzyScore("fire", "firefox", 0);
271 200 const subseq = Launch.fuzzyScore("frfx", "firefox", 0);
272 201 ok("fuzzy-order", exact > prefix && prefix > subseq && subseq >= 0);
273 202 ok("fuzzy-miss", Launch.fuzzyScore("zzz", "firefox", 0) === -1);
274 - ok("calc-eval", Launch.calculatorValue("2+2") === "4");
275 - ok("calc-reject-call", Launch.calculatorValue("a()") === null);
276 - ok("calc-reject-assign", Launch.calculatorValue("x=1") === null);
277 - const rApp = Launch.rankResults("firefox", {
278 - "apps": [{
279 - "title": "Files",
280 - "id": "app:files"
281 - }, {
282 - "title": "Firefox",
283 - "id": "app:ff",
284 - "icon": "firefox"
285 - }]
203 + const built = Launch.buildApps([
205 + "id": "firefox",
206 + "name": "Firefox",
207 + "genericName": "Web Browser",
208 + "icon": "firefox",
209 + "categories": ["Network"],
210 + "keywords": ["web", "browser"],
211 + "actions": [
213 + "id": "new-window",
214 + "name": "New Window",
215 + "command": ["firefox", "--new-window"]
219 + ]);
220 + ok("app-details", built[0].details[0].value === "Network" && built[0].keywords[0] === "web");
221 + ok("app-actions", built[0].actions[0].title === "New Window");
222 + const rApp = Launch.rankResults("browser", {
223 + "apps": built
287 - ok("rank-exact-first", rApp.selectedIndex === 0 && rApp.results[0].title === "Firefox");
288 - ok("rank-keeps-icon", rApp.results[0].icon === "firefox");
289 - const rAction = Launch.rankResults("> over", {
290 - "actions": [{
291 - "title": "Overview",
292 - "id": "overview"
293 - }],
294 - "apps": [{
295 - "title": "Overx",
296 - "id": "app:x"
297 - }]
298 - });
299 - ok("rank-action-intent", rAction.providerIntent === "action" && rAction.results[0].provider === "action");
300 - const rClip = Launch.rankResults("clip ", {
301 - "clipRows": [{
302 - "title": "snippet",
303 - "id": "clip-1"
304 - }]
305 - });
306 - ok("rank-clip-intent", rClip.providerIntent === "clipboard" && rClip.results[0].provider === "clipboard");
307 - const rCalc = Launch.rankResults("=2*21", {});
308 - ok("rank-calc-row", rCalc.calc !== null && rCalc.calc.value === "42" && rCalc.results[0].title === "42");
225 + ok("rank-keyword", rApp.selectedIndex === 0 && rApp.results[0].title === "Firefox");
226 + ok("rank-app-only", rApp.results[0].provider === "app");
309 227 } catch (error) {
310 228 ok("threw:" + error, false);
312 - const fail = cases.filter((c) => {
230 + const fail = cases.filter(c => {
313 231 return !c.pass;
314 232 }).length;
315 233 return JSON.stringify({
318 236 "cases": cases

quickshell/nuguland/Lock.qml

Modified
1 +pragma ComponentBehavior: Bound
1 2 import QtQuick
2 -import Quickshell
3 3 import Quickshell.Io
4 4 import Quickshell.Services.Pam
5 5 import Quickshell.Wayland
7 7 Item {
8 8 id: root
10 - property QtObject theme
11 - property QtObject timeService
12 - property QtObject mediaService
13 - property QtObject notificationService
14 - property QtObject powerService
10 + property Theme theme
11 + property Time timeService
12 + property Media mediaService
13 + property Notifications notificationService
14 + property Power powerService
15 15 readonly property bool nativeActionRoute: true
16 16 property bool active: false
17 17 property bool logicalLocked: false
25 25 property real auroraTime: 0
26 26 property real angryMix: 0
27 27 property bool auroraAvailable: false
28 - property var lastAction: ({
29 - })
28 + property var lastAction: ({})
30 29 readonly property string pamConfig: "nuguland-lock.conf"
31 30 readonly property var boundedActions: ["request", "type", "submit", "cancel"]
206 205 blending: true
207 206 fragmentShader: Qt.resolvedUrl("shaders/aurora.frag.qsb")
212 210 Item {
248 246 onTextChanged: {
249 247 if (root.logicalLocked)
250 248 root.typeSecret(text);
253 - Keys.onReturnPressed: (event) => {
250 + Keys.onReturnPressed: event => {
254 251 event.accepted = true;
255 252 root.submit(secretInput.text);
256 253 secretInput.text = "";
258 - Keys.onEnterPressed: (event) => {
255 + Keys.onEnterPressed: event => {
259 256 event.accepted = true;
260 257 root.submit(secretInput.text);
261 258 secretInput.text = "";
273 270 function onLogicalLockedChanged() {
274 271 if (root.logicalLocked)
275 272 Qt.callLater(secretInput.forceActiveFocus);
279 275 function onFailureNonceChanged() {
319 315 duration: 70
320 316 easing.type: Easing.OutCubic
331 323 PamContext {
339 331 root.pendingSecret = "";
342 - onCompleted: (result) => {
334 + onCompleted: result => {
343 335 if (result === PamResult.Success)
344 336 root.finishUnlock({
345 - "kind": "pam-unlock"
346 - });
337 + "kind": "pam-unlock"
338 + });
348 340 root.fail("incorrect password");
350 - onError: (error) => {
342 + onError: error => {
351 343 root.fail(PamError.toString(error));

quickshell/nuguland/Media.qml

Modified
1 1 import QtQuick
2 -import Quickshell
3 2 import Quickshell.Services.Mpris
5 4 Item {
6 5 id: root
8 - property QtObject osdService
9 - property QtObject audioService
7 + property Osd osdService
8 + property Audio audioService
10 9 property string manualSelection: ""
11 - property var lastAction: ({
12 - })
10 + property var lastAction: ({})
13 11 property var trackChange: ({
14 - "direction": "none",
15 - "reverse": false,
16 - "fromTitle": "",
17 - "toTitle": ""
18 - })
12 + "direction": "none",
13 + "reverse": false,
14 + "fromTitle": "",
15 + "toTitle": ""
16 + })
19 17 readonly property bool nativeActionRoute: true
20 18 // cheap reactive "something playing" signal for the bar chip active dot
21 19 readonly property bool playing: {
22 20 const players = Mpris.players.values || [];
23 - for (let i = 0; i < players.length; i++) if (players[i].playbackState === MprisPlaybackState.Playing)
24 - return true;
21 + for (let i = 0; i < players.length; i++)
22 + if (players[i].playbackState === MprisPlaybackState.Playing)
23 + return true;
26 25 return false;
48 47 function nativePlayerById(id) {
49 48 const players = Mpris.players.values || [];
50 - for (let i = 0; i < players.length; i++) if (playerId(players[i]) === id) {
51 - return players[i];
52 - }
49 + for (let i = 0; i < players.length; i++)
50 + if (playerId(players[i]) === id) {
51 + return players[i];
52 + }
53 53 return null;
88 88 function activeIndex() {
89 89 const players = servicePlayers();
90 90 if (manualSelection.length > 0) {
91 - for (let i = 0; i < players.length; i++) if (clonePlayer(players[i]).id === manualSelection) {
92 - return i;
91 + for (let i = 0; i < players.length; i++)
92 + if (clonePlayer(players[i]).id === manualSelection) {
93 + return i;
94 + }
95 + }
96 + for (let j = 0; j < players.length; j++)
97 + if (clonePlayer(players[j]).playbackState === "playing") {
98 + return j;
94 - }
95 - for (let j = 0; j < players.length; j++) if (clonePlayer(players[j]).playbackState === "playing") {
96 - return j;
97 - }
98 100 return players.length > 0 ? 0 : -1;
102 104 const players = servicePlayers();
103 105 const index = activeIndex();
104 106 return index >= 0 ? players[index] : ({
105 - "dbusName": "",
106 - "identity": "",
107 - "trackTitle": "",
108 - "trackArtist": "",
109 - "trackAlbum": "",
110 - "playbackState": MprisPlaybackState.Stopped,
111 - "position": 0,
112 - "length": 1,
113 - "shuffle": false,
114 - "loopState": MprisLoopState.None,
115 - "trackArtUrl": ""
116 - });
107 + "dbusName": "",
108 + "identity": "",
109 + "trackTitle": "",
110 + "trackArtist": "",
111 + "trackAlbum": "",
112 + "playbackState": MprisPlaybackState.Stopped,
113 + "position": 0,
114 + "length": 1,
115 + "shuffle": false,
116 + "loopState": MprisLoopState.None,
117 + "trackArtUrl": ""
118 + });
119 121 function activePlayer() {
123 125 function osd(eventText) {
124 126 if (!osdService)
125 127 return {
126 - "event": "media",
127 - "value": eventText,
128 - "role": "info"
129 - };
128 + "event": "media",
129 + "value": eventText,
130 + "role": "info"
131 + };
132 134 return JSON.parse(osdService.trigger("media", eventText));
193 195 "nativeActionRoute": nativeActionRoute,
194 196 "externalVisualizer": false,
195 197 "manualSelection": manualSelection,
196 - "players": servicePlayers().map((player) => {
198 + "players": servicePlayers().map(player => {
197 199 return clonePlayer(player);
199 201 "activePlayer": active,
239 241 "trackChange": trackChange,
240 242 "lastAction": lastAction,
241 - "osd": osdState || {
242 - }
243 + "osd": osdState || {}
246 247 function stateJson() {
247 - return JSON.stringify(stateObject({
248 - }));
248 + return JSON.stringify(stateObject({}));
251 251 function action(kind) {
304 304 return JSON.stringify(stateObject(osd(`select ${manualSelection}`)));

quickshell/nuguland/Network.qml

Modified
1 1 import QtQuick
2 -import Quickshell
3 2 import Quickshell.Io
4 3 import "network.js" as Network
31 30 property bool scanning: false
32 31 property string lastError: ""
33 32 // Parsed GetManagedObjects payload (device/station/networks/knownBySsid).
34 - property var managed: ({
35 - })
33 + property var managed: ({})
36 34 property var mergedModel: []
37 - property var lastAction: ({
38 - })
35 + property var lastAction: ({})
39 36 property int scanRetriesLeft: 0
40 37 // StationDiagnostic.GetDiagnostics detail for the CONNECTED BSS only
41 38 // (bssid/band/channel/rssi/rates/mode), fetched lazily on expand. {} = none.
42 - property var connectionDetail: ({
43 - })
39 + property var connectionDetail: ({})
45 41 // Emitted whenever the model is recomputed after an async read. The view
46 42 // connects to this to re-pull stateJson().
47 - signal refreshed()
43 + signal refreshed
49 45 // D-Bus constants.
50 46 readonly property string svc: "net.connman.iwd"
61 57 function activeRow() {
62 - for (var i = 0; i < mergedModel.length; i++) if (mergedModel[i].connected) {
63 - return mergedModel[i];
64 - }
58 + for (var i = 0; i < mergedModel.length; i++)
59 + if (mergedModel[i].connected) {
60 + return mergedModel[i];
61 + }
65 62 return null;
68 65 function rowForId(id) {
69 66 const name = String(id);
70 - for (var i = 0; i < mergedModel.length; i++) if (mergedModel[i].id === name || mergedModel[i].ssid === name) {
71 - return mergedModel[i];
72 - }
67 + for (var i = 0; i < mergedModel.length; i++)
68 + if (mergedModel[i].id === name || mergedModel[i].ssid === name) {
69 + return mergedModel[i];
70 + }
73 71 return null;
91 89 // the pure network.js rows with label/percent/glyph/role/state view fields.
92 90 function buildModel(ordered) {
93 91 const rows = Network.networkRows(managed, ordered);
94 - const station = managed.station || {
95 - };
92 + const station = managed.station || {};
96 93 const connecting = station.state === "connecting";
97 94 const out = [];
98 95 for (var i = 0; i < rows.length; i++) {
118 115 mergedModel = out;
119 116 // Drop stale per-BSS detail if nothing is connected anymore.
120 117 var stillConnected = false;
121 - for (var j = 0; j < out.length; j++) if (out[j].connected) stillConnected = true;
118 + for (var j = 0; j < out.length; j++)
119 + if (out[j].connected)
120 + stillConnected = true;
122 121 if (!stillConnected)
123 122 connectionDetail = ({});
124 123 refreshed();
147 146 // state.shader.values / state.shader.history (throws on undefined).
148 147 "shader": {
149 148 "values": [],
150 - "history": {
151 - }
149 + "history": {}
153 151 "lastAction": lastAction
186 184 // Build with bracket assignment (avoid ES6 computed keys for V4 safety).
187 185 var objs = {};
188 186 objs["/net/connman/iwd/0"] = {
189 - "net.connman.iwd.Adapter": { "Powered": { "type": "b", "data": true } }
187 + "net.connman.iwd.Adapter": {
188 + "Powered": {
189 + "type": "b",
190 + "data": true
191 194 objs[devPath] = {
192 195 "net.connman.iwd.Device": {
193 - "Name": { "type": "s", "data": "wlan0" },
194 - "Powered": { "type": "b", "data": true },
195 - "Mode": { "type": "s", "data": "station" }
196 + "Name": {
197 + "type": "s",
198 + "data": "wlan0"
199 + },
200 + "Powered": {
201 + "type": "b",
202 + "data": true
203 + },
204 + "Mode": {
205 + "type": "s",
206 + "data": "station"
197 209 "net.connman.iwd.Station": {
198 - "State": { "type": "s", "data": "connected" },
199 - "Scanning": { "type": "b", "data": false },
200 - "ConnectedNetwork": { "type": "o", "data": homePath }
210 + "State": {
211 + "type": "s",
212 + "data": "connected"
213 + },
214 + "Scanning": {
215 + "type": "b",
216 + "data": false
217 + },
218 + "ConnectedNetwork": {
219 + "type": "o",
220 + "data": homePath
203 224 objs[homePath] = {
204 225 "net.connman.iwd.Network": {
205 - "Name": { "type": "s", "data": "home-wifi" },
206 - "Type": { "type": "s", "data": "psk" },
207 - "Connected": { "type": "b", "data": true },
208 - "KnownNetwork": { "type": "o", "data": "/known/home" }
226 + "Name": {
227 + "type": "s",
228 + "data": "home-wifi"
229 + },
230 + "Type": {
231 + "type": "s",
232 + "data": "psk"
233 + },
234 + "Connected": {
235 + "type": "b",
236 + "data": true
237 + },
238 + "KnownNetwork": {
239 + "type": "o",
240 + "data": "/known/home"
211 244 objs[fivegPath] = {
212 245 "net.connman.iwd.Network": {
213 - "Name": { "type": "s", "data": "home-wifi-5g" },
214 - "Type": { "type": "s", "data": "psk" },
215 - "Connected": { "type": "b", "data": false }
246 + "Name": {
247 + "type": "s",
248 + "data": "home-wifi-5g"
249 + },
250 + "Type": {
251 + "type": "s",
252 + "data": "psk"
253 + },
254 + "Connected": {
255 + "type": "b",
256 + "data": false
218 260 objs[cafePath] = {
219 261 "net.connman.iwd.Network": {
220 - "Name": { "type": "s", "data": "Cafe Guest WiFi" },
221 - "Type": { "type": "s", "data": "open" },
222 - "Connected": { "type": "b", "data": false }
262 + "Name": {
263 + "type": "s",
264 + "data": "Cafe Guest WiFi"
265 + },
266 + "Type": {
267 + "type": "s",
268 + "data": "open"
269 + },
270 + "Connected": {
271 + "type": "b",
272 + "data": false
225 - var gmo = JSON.stringify({ "type": "a{oa{sa{sv}}}", "data": [objs] });
276 + var gmo = JSON.stringify({
277 + "type": "a{oa{sa{sv}}}",
278 + "data": [objs]
279 + });
226 280 var gon = JSON.stringify({
227 281 "type": "a(on)",
228 282 "data": [[[homePath, -6800], [fivegPath, -4900], [cafePath, -6500]]]
268 322 check("parseManaged(null) safe", Network.parseManaged(null).devicePath, "");
270 324 // connectionDetail (StationDiagnostic) — synthetic, sanitized BSSID.
271 - var diag = JSON.stringify({ "type": "a{sv}", "data": [{
272 - "ConnectedBss": { "type": "s", "data": "00:aa:bb:cc:dd:01" },
273 - "Frequency": { "type": "u", "data": 5220 },
274 - "Channel": { "type": "q", "data": 44 },
275 - "RSSI": { "type": "n", "data": -65 },
276 - "RxMode": { "type": "s", "data": "802.11n" },
277 - "TxBitrate": { "type": "u", "data": 1080 },
278 - "RxBitrate": { "type": "u", "data": 1350 }
279 - }] });
325 + var diag = JSON.stringify({
326 + "type": "a{sv}",
327 + "data": [
329 + "ConnectedBss": {
330 + "type": "s",
331 + "data": "00:aa:bb:cc:dd:01"
332 + },
333 + "Frequency": {
334 + "type": "u",
335 + "data": 5220
336 + },
337 + "Channel": {
338 + "type": "q",
339 + "data": 44
340 + },
341 + "RSSI": {
342 + "type": "n",
343 + "data": -65
344 + },
345 + "RxMode": {
346 + "type": "s",
347 + "data": "802.11n"
348 + },
349 + "TxBitrate": {
350 + "type": "u",
351 + "data": 1080
352 + },
353 + "RxBitrate": {
354 + "type": "u",
355 + "data": 1350
359 + });
280 360 var det = Network.connectionDetail(diag);
281 361 check("connectionDetail band", det.band, "5 GHz");
282 362 check("connectionDetail channel", det.channel, 44);
332 412 // New secured network: iwctl registers an agent and supplies the key.
333 413 if (deviceName)
334 414 actionProc.exec(["iwctl", "--passphrase", pp, "station", deviceName, "connect", name]);
336 415 } else if (row && row.path) {
337 416 actionProc.exec(busctlCall(row.path, ifaceNetwork, "Connect"));
422 501 root.deviceName = "";
423 502 root.devicePath = "";
424 503 root.buildModel([]);
425 - return ;
504 + return;
427 506 root.deviceName = m.device.name;
428 507 root.devicePath = m.devicePath;
441 519 Process {
449 527 root.buildModel(Network.parseOrdered(this.text));
455 532 // Lazy StationDiagnostic read (connected BSS only). On reply, shape via
466 543 root.refreshed();
472 548 // --- action Processes --------------------------------------------------
485 561 // "Operation already in progress" = scan already running, NOT a hard
486 562 // error: keep scanning, let the retry timer re-read the list.
487 - onExited: (exitCode, exitStatus) => {
563 + function onExited(exitCode) {
488 564 const err = String(scanErr.text || "");
489 565 if (exitCode !== 0 && err.indexOf("already in progress") < 0)
490 566 root.lastError = "scan-failed";
501 576 running: false
503 - onExited: (exitCode, exitStatus) => {
578 + function onExited() {
504 579 root.refresh();

quickshell/nuguland/Niri.qml

Modified
15 15 property var focusedWindow: null
16 16 property string overviewState: "unknown"
17 17 property string lastPickedColor: ""
18 - property var lastWindowAction: ({
19 - })
18 + property var lastWindowAction: ({})
20 19 readonly property var focusedWindowRecord: windowById(focusedWindow)
21 20 readonly property string focusedTitle: focusedWindowRecord ? (focusedWindowRecord.title || "") : ""
22 21 readonly property string focusedAppId: focusedWindowRecord ? (focusedWindowRecord.app_id || focusedWindowRecord.appId || "") : ""
22 + readonly property string focusedOutputName: focusedOutputNameFromWorkspaces(workspaces)
24 24 function refresh() {
25 25 if (!available || query.running)
26 - return ;
26 + return;
28 28 query.exec(["niri", "msg", "--json", "event-stream"]);
31 31 function loadSnapshot() {
32 32 if (!available || snapshot.running)
33 - return ;
33 + return;
35 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'"]);
41 41 data = JSON.parse(String(text || "{}"));
42 42 } catch (error) {
43 43 lastError = String(error);
44 - return ;
44 + return;
46 46 windows = data.windows || [];
47 47 workspaces = data.workspaces || [];
80 80 function displayWorkspaces(items) {
81 - return (items || []).filter((workspace) => {
81 + return (items || []).filter(workspace => {
82 82 return workspace.name || workspace.is_focused || workspace.is_active || workspace.is_urgent || workspace.active_window_id !== null && workspace.active_window_id !== undefined;
86 + function focusedOutputNameFromWorkspaces(items) {
87 + const list = items || [];
88 + for (let i = 0; i < list.length; i++)
89 + if (list[i].is_focused)
90 + return String(list[i].output || "");
92 + return "";
93 + }
86 95 // Group visible workspaces by output, each output's list idx-sorted, so the
87 96 // single primary bar renders every monitor's workspaces in its own tray.
88 97 // Pure: pass `items` for testing; defaults to the live workspace array.
89 98 function groupWorkspaces(items) {
90 99 const vis = displayWorkspaces(items === undefined ? workspaces : items);
91 - const byOutput = ({
92 - });
100 + const byOutput = ({});
93 101 const order = [];
94 102 for (let i = 0; i < vis.length; i++) {
95 103 const name = String(vis[i].output || "");
100 108 byOutput[name].push(vis[i]);
102 - return order.map((name) => {
110 + return order.map(name => {
103 111 return {
104 112 "output": name,
105 113 "workspaces": byOutput[name].slice().sort((a, b) => Number(a.idx || 0) - Number(b.idx || 0))
112 120 function outputList() {
113 121 if (Array.isArray(outputs))
114 122 return outputs;
115 - const obj = outputs || ({
116 - });
117 - return Object.keys(obj).map((key) => {
123 + const obj = outputs || ({});
124 + return Object.keys(obj).map(key => {
118 125 return Object.assign({
119 126 "name": key
120 127 }, obj[key]);
128 135 const want = String(name || "");
129 136 for (let i = 0; i < list.length; i++) {
130 137 if (String(list[i].name || "") === want) {
131 - const logical = list[i].logical || ({
132 - });
138 + const logical = list[i].logical || ({});
133 139 return typeof logical.x === "number" ? logical.x : 1000000;
146 152 // empty-trailing-workspace filtering. Drive via the niriSelfTest IPC.
147 153 function selfTest() {
148 154 const failures = [];
149 - const sample = [{
150 - "idx": 4,
151 - "output": "DP-2",
152 - "name": "browser"
153 - }, {
154 - "idx": 5,
155 - "output": "DP-2",
156 - "name": "vault"
157 - }, {
158 - "idx": 3,
159 - "output": "DP-1",
160 - "name": "games"
161 - }, {
162 - "idx": 6,
163 - "output": "DP-1",
164 - "name": null
165 - }, {
166 - "idx": 2,
167 - "output": "DP-1",
168 - "name": "media"
169 - }, {
170 - "idx": 1,
171 - "output": "DP-1",
172 - "name": "code",
173 - "is_focused": true
174 - }];
155 + const sample = [
157 + "idx": 4,
158 + "output": "DP-2",
159 + "name": "browser"
160 + },
162 + "idx": 5,
163 + "output": "DP-2",
164 + "name": "vault"
165 + },
167 + "idx": 3,
168 + "output": "DP-1",
169 + "name": "games"
170 + },
172 + "idx": 6,
173 + "output": "DP-1",
174 + "name": null
175 + },
177 + "idx": 2,
178 + "output": "DP-1",
179 + "name": "media"
180 + },
182 + "idx": 1,
183 + "output": "DP-1",
184 + "name": "code",
185 + "is_focused": true
187 + ];
175 188 const groups = groupWorkspaces(sample);
176 189 if (groups.length !== 2)
177 190 failures.push(`expected 2 groups, got ${groups.length}`);
179 - const dp1 = groups.filter((g) => g.output === "DP-1")[0] || null;
180 - const dp2 = groups.filter((g) => g.output === "DP-2")[0] || null;
192 + const dp1 = groups.filter(g => g.output === "DP-1")[0] || null;
193 + const dp2 = groups.filter(g => g.output === "DP-2")[0] || null;
181 194 if (!dp1)
182 195 failures.push("missing DP-1 group");
185 198 failures.push("missing DP-2 group");
187 200 if (dp1) {
188 - const idxs = JSON.stringify(dp1.workspaces.map((w) => w.idx));
201 + const idxs = JSON.stringify(dp1.workspaces.map(w => w.idx));
189 202 if (idxs !== "[1,2,3]")
190 203 failures.push(`DP-1 idx order ${idxs} != [1,2,3]`);
193 205 if (dp2) {
194 - const idxs = JSON.stringify(dp2.workspaces.map((w) => w.idx));
206 + const idxs = JSON.stringify(dp2.workspaces.map(w => w.idx));
195 207 if (idxs !== "[4,5]")
196 208 failures.push(`DP-2 idx order ${idxs} != [4,5]`);
199 210 const total = groups.reduce((sum, g) => sum + g.workspaces.length, 0);
200 211 if (total !== 5)
201 212 failures.push(`expected 5 pills after empty filter, got ${total}`);
214 + try {
215 + const focused = focusedOutputNameFromWorkspaces(sample);
216 + if (focused !== "DP-1")
217 + failures.push(`focused output ${focused} != DP-1`);
218 + } catch (error) {
219 + failures.push(`focused output helper missing: ${error}`);
203 222 return {
204 223 "pass": failures.length === 0,
205 224 "failures": failures
220 239 for (let i = 0; i < windows.length; i++) {
221 240 if (windows[i].id === id)
222 241 return windows[i];
225 243 return null;
228 246 function windowActions(id) {
229 - return [{
230 - "id": "focus",
231 - "label": "focus",
232 - "route": "Niri.qml",
233 - "niriAction": "focus-window",
234 - "destructive": false,
235 - "keyboard": "Enter"
236 - }, {
237 - "id": "toggle-fullscreen",
238 - "label": "fullscreen",
239 - "route": "Niri.qml",
240 - "niriAction": "toggle-fullscreen",
241 - "destructive": false,
242 - "keyboard": "F"
243 - }, {
244 - "id": "move-workspace",
245 - "label": "move workspace",
246 - "route": "Niri.qml",
247 - "niriAction": "move-window-to-workspace",
248 - "destructive": false,
249 - "keyboard": "M"
250 - }, {
251 - "id": "close-window",
252 - "label": "close",
253 - "route": "Niri.qml",
254 - "niriAction": "close-window",
255 - "destructive": true,
256 - "keyboard": "Delete"
257 - }].map((action) => {
258 - return Object.assign({
259 - }, action, {
247 + return [
249 + "id": "focus",
250 + "label": "focus",
251 + "route": "Niri.qml",
252 + "niriAction": "focus-window",
253 + "destructive": false,
254 + "keyboard": "Enter"
255 + },
257 + "id": "toggle-fullscreen",
258 + "label": "fullscreen",
259 + "route": "Niri.qml",
260 + "niriAction": "toggle-fullscreen",
261 + "destructive": false,
262 + "keyboard": "F"
263 + },
265 + "id": "move-workspace",
266 + "label": "move workspace",
267 + "route": "Niri.qml",
268 + "niriAction": "move-window-to-workspace",
269 + "destructive": false,
270 + "keyboard": "M"
271 + },
273 + "id": "close-window",
274 + "label": "close",
275 + "route": "Niri.qml",
276 + "niriAction": "close-window",
277 + "destructive": true,
278 + "keyboard": "Delete"
280 + ].map(action => {
281 + return Object.assign({}, action, {
260 282 "windowId": id
283 305 function windowCardObject() {
284 - const win = focusedWindowRecord || ({
285 - });
306 + const win = focusedWindowRecord || ({});
286 307 const appId = win.app_id || win.appId || "";
287 308 const title = win.title || "";
288 309 const workspace = win.workspace_id || win.workspaceId || null;
320 341 "actions": actions
322 343 "windowPanelContract": windowPanelContract(),
323 - "detailsRows": [{
324 - "id": "app-id",
325 - "label": "app-id",
326 - "value": appId,
327 - "role": "content.normal"
328 - }, {
329 - "id": "title",
330 - "label": "title",
331 - "value": title,
332 - "role": "content.normal"
333 - }, {
334 - "id": "workspace",
335 - "label": "workspace",
336 - "value": workspace === null ? "unknown" : String(workspace),
337 - "role": "ui.accent"
338 - }, {
339 - "id": "focused",
340 - "label": "focused",
341 - "value": focusedWindowRecord !== null ? "yes" : "no",
342 - "role": focusedWindowRecord !== null ? "ui.accent" : "ui.minor"
343 - }],
344 + "detailsRows": [
346 + "id": "app-id",
347 + "label": "app-id",
348 + "value": appId,
349 + "role": "content.normal"
350 + },
352 + "id": "title",
353 + "label": "title",
354 + "value": title,
355 + "role": "content.normal"
356 + },
358 + "id": "workspace",
359 + "label": "workspace",
360 + "value": workspace === null ? "unknown" : String(workspace),
361 + "role": "ui.accent"
362 + },
364 + "id": "focused",
365 + "label": "focused",
366 + "value": focusedWindowRecord !== null ? "yes" : "no",
367 + "role": focusedWindowRecord !== null ? "ui.accent" : "ui.minor"
369 + ],
344 370 "actions": actions,
345 371 "lastWindowAction": lastWindowAction
355 381 const card = windowCardObject();
356 382 const actionRows = card.actions || [];
357 383 let selected = null;
358 - for (let i = 0; i < actionRows.length; i++) if (actionRows[i].id === name) {
359 - selected = actionRows[i];
360 - }
384 + for (let i = 0; i < actionRows.length; i++)
385 + if (actionRows[i].id === name) {
386 + selected = actionRows[i];
361 388 lastWindowAction = {
362 389 "kind": name,
363 390 "route": "Niri.qml",
376 403 "workspaceCount": workspaces.length,
377 404 "windowCount": windows.length,
378 405 "windows": windows,
379 - "outputCount": Array.isArray(outputs) ? outputs.length : Object.keys(outputs || {
380 - }).length,
406 + "outputCount": Array.isArray(outputs) ? outputs.length : Object.keys(outputs || {}).length,
381 407 "outputs": outputs,
382 408 "workspaces": workspaces,
383 409 "overviewState": overviewState,
384 410 "focusedWindow": focusedWindow,
411 + "focusedOutputName": focusedOutputName,
385 412 "focusedAppId": focusedAppId,
386 413 "focusedTitle": focusedTitle,
387 414 "lastError": lastError
394 421 event = JSON.parse(line);
395 422 } catch (e) {
396 - return ;
423 + return;
398 425 ready = true;
399 426 if (event.WorkspacesChanged)
403 430 const activatedId = event.WorkspaceActivated.id;
404 431 const focused = !!event.WorkspaceActivated.focused;
405 432 let activatedOutput = null;
406 - for (let i = 0; i < workspaces.length; i++) if (workspaces[i].id === activatedId)
407 - activatedOutput = workspaces[i].output;
433 + for (let i = 0; i < workspaces.length; i++)
434 + if (workspaces[i].id === activatedId)
435 + activatedOutput = workspaces[i].output;
409 - workspaces = workspaces.map((ws) => {
410 - const next = Object.assign({
411 - }, ws);
437 + workspaces = workspaces.map(ws => {
438 + const next = Object.assign({}, ws);
412 439 if (ws.output === activatedOutput)
413 440 next.is_active = ws.id === activatedId;
430 457 if (event.OverviewOpenedOrClosed)
431 458 overviewState = event.OverviewOpenedOrClosed.is_open ? "open" : "closed";
435 461 Component.onCompleted: {
452 478 onStreamFinished: {
453 479 if (this.text.trim().length > 0)
454 480 root.lastError = this.text.trim();
461 485 Process {
462 486 id: query
464 488 running: false
465 - onExited: (code, status) => {
489 + function onExited(code) {
466 490 if (code !== 0 && root.available)
467 491 root.lastError = `event stream exited ${code}`;
471 494 stdout: SplitParser {
472 - onRead: (data) => {
495 + onRead: data => {
473 496 return root.applyEvent(data);
477 500 stderr: StdioCollector {
478 501 onStreamFinished: root.lastError = this.text
483 505 Process {
486 508 stderr: StdioCollector {
487 509 onStreamFinished: root.lastError = this.text
492 513 Process {
499 520 stderr: StdioCollector {
500 521 onStreamFinished: root.lastError = this.text

quickshell/nuguland/NotificationCard.qml

Modified
1 +pragma ComponentBehavior: Bound
1 2 import QtQuick
2 3 import Quickshell
3 4 import Quickshell.Widgets
5 6 Rectangle {
6 7 id: card
8 - required property QtObject theme
9 + required property Theme theme
9 10 required property var modelData
10 11 property bool compact: false
11 12 signal dismiss(string id)
19 20 // a real picture (absolute path = double slash, or raster extension) renders
20 21 // as the large preview; a named icon renders as the small identity glyph.
21 22 readonly property string photoCandidate: String(modelData.image || "")
22 - readonly property bool imageIsPhoto: photoCandidate.indexOf("image://icon//") === 0
23 - || /\.(png|jpe?g|gif|webp|bmp)(\?|#|$)/i.test(photoCandidate)
23 + readonly property bool imageIsPhoto: photoCandidate.indexOf("image://icon//") === 0 || /\.(png|jpe?g|gif|webp|bmp)(\?|#|$)/i.test(photoCandidate)
24 24 readonly property string iconSource: modelData.appIcon || (imageIsPhoto ? "" : photoCandidate)
25 25 // image://icon//abs/path -> file:///abs/path so plain Image keeps true aspect
26 26 readonly property string photoSource: !imageIsPhoto ? "" : (photoCandidate.indexOf("image://icon//") === 0 ? "file://" + photoCandidate.substring(13) : photoCandidate)
32 32 // local text styling, mirrors PopoutHost NuguText variants
33 33 component CardText: Text {
34 - required property QtObject theme
34 + required property Theme theme
35 35 property string variant: "body"
36 36 color: !theme ? "transparent" : (variant === "title" ? theme.ui.important_global : (variant === "meta" ? theme.ui.normal : theme.content.normal))
37 37 font.family: variant === "mono" ? "IBM Plex Mono" : "IBM Plex Sans"
83 83 // freedesktop "default" action: invoked by clicking the notification body
84 84 // (not rendered as a button). Buttons declared later sit above this area,
85 85 // so clicks on them are unaffected.
86 - readonly property var defaultAction: (modelData.actionRows || []).find((a) => a.id === "default") || null
86 + readonly property var defaultAction: (modelData.actionRows || []).find(a => a.id === "default") || null
87 87 readonly property bool hasDefault: !!defaultAction
89 89 MouseArea {
149 149 variant: "meta"
150 150 text: "copy"
151 151 opacity: copyArea.containsMouse ? 1 : (cardHover.hovered ? 0.5 : 0)
152 - Behavior on opacity { NumberAnimation { duration: card.theme && card.theme.lowPowerMode ? 0 : 120 } }
152 + Behavior on opacity {
153 + NumberAnimation {
154 + duration: card.theme && card.theme.lowPowerMode ? 0 : 120
154 158 MouseArea {
155 159 id: copyArea
210 214 height: parent.height
211 215 radius: 2
212 216 color: card.theme ? card.theme.ui.accent : "transparent"
213 - Behavior on width { NumberAnimation { duration: card.theme && card.theme.lowPowerMode ? 0 : 200 } }
217 + Behavior on width {
218 + NumberAnimation {
219 + duration: card.theme && card.theme.lowPowerMode ? 0 : 200
219 227 width: parent.width
220 228 spacing: 6
221 229 visible: !card.compact && actionModel.length > 0
222 - property var actionModel: (card.modelData.actionRows || []).filter((a) => a.kind !== "close" && a.kind !== "copy-body" && a.id !== "default")
230 + property var actionModel: (card.modelData.actionRows || []).filter(a => a.kind !== "close" && a.kind !== "copy-body" && a.id !== "default")
223 231 Repeater {
224 232 model: parent.actionModel
225 233 delegate: Rectangle {
266 274 onClicked: card.invokeAction(String(card.modelData.id), String(actionBtn.modelData.id))
268 276 Behavior on color {
269 - ColorAnimation { duration: card.theme && card.theme.lowPowerMode ? 0 : 120 }
277 + ColorAnimation {
278 + duration: card.theme && card.theme.lowPowerMode ? 0 : 120
331 341 variant: "mono"
332 342 text: "×"
334 - Behavior on opacity { NumberAnimation { duration: 120 } }
344 + Behavior on opacity {
345 + NumberAnimation {
346 + duration: 120
336 350 MouseArea {
337 351 id: closeArea
345 - HoverHandler { id: cardHover }
359 + HoverHandler {
360 + id: cardHover

quickshell/nuguland/Notifications.qml

Modified
1 +pragma ComponentBehavior: Bound
1 2 import QtQuick
2 3 import Quickshell
3 4 import Quickshell.Services.Notifications
10 11 property bool popupInhibition: false
11 12 property int unreadCount: 0
12 13 property var notifications: []
13 - property var nativeNotifications: ({
14 - })
14 + property var nativeNotifications: ({})
15 15 property var expandedGroups: []
16 16 property var activeToasts: []
17 17 property var toastById: ({})
18 18 readonly property int defaultToastTimeoutMs: 5000
19 - property var lastAction: ({
20 - })
19 + property var lastAction: ({})
21 20 readonly property bool nativeActionRoute: true
22 21 readonly property bool usesNativeNotificationServer: true
23 22 readonly property int groupPreviewCount: 1
88 87 function normalize(input) {
89 - const record = input || ({
90 - });
88 + const record = input || ({});
91 89 const id = String(record.id || record.notificationId || `notif-${notifications.length + 1}`);
92 90 const actions = actionList(record);
93 91 return {
185 183 // replace-by-id: same id updates in place, no duplicate
186 184 let list = [];
187 - list = mergeRow(list, {"id": "7", "summary": "10%", "closed": false, "read": false});
188 - list = mergeRow(list, {"id": "7", "summary": "50%", "closed": false, "read": false});
185 + list = mergeRow(list, {
186 + "id": "7",
187 + "summary": "10%",
188 + "closed": false,
189 + "read": false
190 + });
191 + list = mergeRow(list, {
192 + "id": "7",
193 + "summary": "50%",
194 + "closed": false,
195 + "read": false
196 + });
189 197 expect(list.length === 1, "replace-by-id should not duplicate");
190 198 expect(list[0].summary === "50%", "replace-by-id should update content");
191 199 // distinct ids stay separate
192 - list = mergeRow(list, {"id": "8", "summary": "other", "closed": false, "read": false});
200 + list = mergeRow(list, {
201 + "id": "8",
202 + "summary": "other",
203 + "closed": false,
204 + "read": false
205 + });
193 206 expect(list.length === 2, "distinct ids should be separate rows");
194 207 // read flag preserved on replace
195 208 let rlist = [];
196 - rlist = mergeRow(rlist, {"id": "9", "summary": "x", "closed": false, "read": true});
197 - rlist = mergeRow(rlist, {"id": "9", "summary": "y", "closed": false, "read": false});
209 + rlist = mergeRow(rlist, {
210 + "id": "9",
211 + "summary": "x",
212 + "closed": false,
213 + "read": true
214 + });
215 + rlist = mergeRow(rlist, {
216 + "id": "9",
217 + "summary": "y",
218 + "closed": false,
219 + "read": false
220 + });
198 221 expect(rlist[0].read === true, "replace-by-id should preserve original read flag");
199 - expect(toastEligible({"urgency": "normal"}, false) === true, "normal toasts when DND off");
200 - expect(toastEligible({"urgency": "normal"}, true) === false, "normal suppressed under DND");
201 - expect(toastEligible({"urgency": "critical"}, true) === true, "critical bypasses DND");
202 - expect(toastTimeoutMs({"urgency": "critical", "expireTimeout": 5}) === 0, "critical is sticky");
203 - expect(toastTimeoutMs({"urgency": "normal", "expireTimeout": 0}) === 0, "expireTimeout 0 is sticky");
204 - expect(toastTimeoutMs({"urgency": "normal", "expireTimeout": -1}) === defaultToastTimeoutMs, "default timeout");
222 + expect(toastEligible({
223 + "urgency": "normal"
224 + }, false) === true, "normal toasts when DND off");
225 + expect(toastEligible({
226 + "urgency": "normal"
227 + }, true) === false, "normal suppressed under DND");
228 + expect(toastEligible({
229 + "urgency": "critical"
230 + }, true) === true, "critical bypasses DND");
231 + expect(toastTimeoutMs({
232 + "urgency": "critical",
233 + "expireTimeout": 5
234 + }) === 0, "critical is sticky");
235 + expect(toastTimeoutMs({
236 + "urgency": "normal",
237 + "expireTimeout": 0
238 + }) === 0, "expireTimeout 0 is sticky");
239 + expect(toastTimeoutMs({
240 + "urgency": "normal",
241 + "expireTimeout": -1
242 + }) === defaultToastTimeoutMs, "default timeout");
205 243 return {
206 244 "pass": failures.length === 0,
207 245 "failures": failures
211 249 function acceptNativeNotification(notification) {
212 250 if (!notification)
213 - return ;
251 + return;
215 253 notification.tracked = true;
216 254 const id = String(notification.id);
256 294 "expiresAt": tms > 0 ? Date.now() + tms : 0
258 296 toastById = map;
259 - activeToasts = activeToasts.filter((x) => x !== row.id).concat([row.id]);
297 + activeToasts = activeToasts.filter(x => x !== row.id).concat([row.id]);
260 298 playSound(notification);
262 300 lastAction = {
269 307 function actionRows(notification) {
270 - const rows = [{
271 - "id": "close",
272 - "kind": "close",
273 - "label": "Close",
274 - "route": "Notifications.qml"
275 - }];
308 + const rows = [
310 + "id": "close",
311 + "kind": "close",
312 + "label": "Close",
313 + "route": "Notifications.qml"
315 + ];
276 316 const serverActions = notification.actions || [];
277 317 for (let i = 0; i < serverActions.length; i++) {
278 318 const aid = serverActions[i].id || serverActions[i].identifier || `action-${i}`;
297 337 function highestUrgency(rows) {
298 - for (let i = 0; i < rows.length; i++) if (rows[i].urgency === "critical") {
299 - return "critical";
300 - }
301 - for (let j = 0; j < rows.length; j++) if (rows[j].urgency === "normal") {
302 - return "normal";
303 - }
338 + for (let i = 0; i < rows.length; i++)
339 + if (rows[i].urgency === "critical") {
340 + return "critical";
342 + for (let j = 0; j < rows.length; j++)
343 + if (rows[j].urgency === "normal") {
344 + return "normal";
304 346 return "low";
339 381 function dismissToast(id) {
340 382 const sid = String(id);
341 383 const toast = toastById[sid];
342 - activeToasts = activeToasts.filter((x) => x !== sid);
384 + activeToasts = activeToasts.filter(x => x !== sid);
343 385 const map = Object.assign({}, toastById);
344 386 delete map[sid];
345 387 toastById = map;
371 413 function groups() {
372 - const byApp = ({
373 - });
414 + const byApp = ({});
374 415 for (let raw = 0; raw < notifications.length; raw++) {
375 416 if (notifications[raw].closed)
376 417 continue;
380 421 if (!byApp[n.appName])
381 422 byApp[n.appName] = {
382 - "appName": n.appName,
383 - "latestTime": 0,
384 - "notifications": [],
385 - "expanded": expandedGroups.indexOf(n.appName) >= 0
386 - };
423 + "appName": n.appName,
424 + "latestTime": 0,
425 + "notifications": [],
426 + "expanded": expandedGroups.indexOf(n.appName) >= 0
427 + };
388 - byApp[n.appName].notifications.push(Object.assign({
389 - }, n, {
429 + byApp[n.appName].notifications.push(Object.assign({}, n, {
390 430 "actionRows": actionRows(n)
392 432 byApp[n.appName].latestTime = Math.max(byApp[n.appName].latestTime, n.time);
413 453 function stateObject() {
414 - const active = notifications.filter((n) => {
454 + const active = notifications.filter(n => {
415 455 return !n.closed;
417 457 const grouped = groups();
459 499 function closeNotification(row, skipNativeDismiss) {
460 500 if (!row || row.closed)
461 - return ;
501 + return;
463 503 row.closed = true;
464 504 row.removalLifecycleLock = removalLifecycleLock;
470 510 if (!skipNativeDismiss && nativeActionRoute && nativeNotification && nativeNotification.dismiss)
471 511 nativeNotification.dismiss();
473 - activeToasts = activeToasts.filter((x) => x !== String(row.id));
513 + activeToasts = activeToasts.filter(x => x !== String(row.id));
474 514 const tmap = Object.assign({}, toastById);
475 515 delete tmap[String(row.id)];
476 516 toastById = tmap;
587 627 function toggleGroup(appName) {
588 628 const app = String(appName);
589 629 const expanded = expandedGroups.indexOf(app) < 0;
590 - expandedGroups = expanded ? expandedGroups.concat([app]) : expandedGroups.filter((row) => {
630 + expandedGroups = expanded ? expandedGroups.concat([app]) : expandedGroups.filter(row => {
591 631 return row !== app;
593 633 lastAction = {
627 667 actionIconsSupported: true
628 668 imageSupported: true
629 669 inlineReplySupported: true
630 - onNotification: (notification) => {
670 + onNotification: notification => {
631 671 return root.acceptNativeNotification(notification);

quickshell/nuguland/Osd.qml

Modified
219 219 repeat: false
220 220 onTriggered: root.expire()

quickshell/nuguland/PopoutHost.qml

Modified
9 9 PanelWindow {
10 10 id: root
12 - required property QtObject theme
13 - required property QtObject surfaces
14 - required property QtObject niriService
15 - required property QtObject timeService
16 - property QtObject caldavService
17 - required property QtObject resourceService
18 - required property QtObject notificationService
19 - required property QtObject trayService
20 - required property QtObject mediaService
21 - required property QtObject clipboardService
22 - required property QtObject launcherService
23 - required property QtObject audioService
24 - required property QtObject brightnessService
25 - required property QtObject networkService
26 - required property QtObject bluetoothService
27 - required property QtObject powerService
28 - required property QtObject lockService
12 + readonly property var sys: Sys
14 + required property Theme theme
15 + required property SurfaceManager surfaces
16 + required property Niri niriService
17 + required property Time timeService
18 + property CalDav caldavService
19 + required property Resources resourceService
20 + required property Notifications notificationService
21 + required property Tray trayService
22 + required property Media mediaService
23 + required property Clipboard clipboardService
24 + required property Launcher launcherService
25 + required property Audio audioService
26 + required property Brightness brightnessService
27 + required property Network networkService
28 + required property Bluetooth bluetoothService
29 + required property Power powerService
30 + required property Lock lockService
29 31 required property var barWindow
30 32 readonly property var contentSize: surfaces ? surfaces.popoutContentSize(surfaces.popoutName) : ({
31 - "width": 320,
32 - "height": 180
33 - })
33 + "width": 320,
34 + "height": 180
35 + })
34 36 readonly property var popupAnchorRect: surfaces ? surfaces.popupWindowAnchorRect() : ({
35 - "x": 0,
36 - "y": 0,
37 - "width": 320,
38 - "height": 1
39 - })
37 + "x": 0,
38 + "y": 0,
39 + "width": 320,
40 + "height": 1
41 + })
40 42 readonly property var cardFrame: surfaces ? surfaces.popupCardFrame(surfaces.popoutProgress) : ({
41 - "currentRect": {
42 - "x": 8,
43 - "y": 8,
44 - "width": 304,
45 - "height": 164
46 - },
47 - "opacity": 1
48 - })
43 + "currentRect": {
44 + "x": 8,
45 + "y": 8,
46 + "width": 304,
47 + "height": 164
48 + },
49 + "opacity": 1
50 + })
49 51 readonly property var currentRect: cardFrame.currentRect
50 52 readonly property string activeName: surfaces ? surfaces.popoutName : ""
51 53 readonly property string removingName: surfaces ? surfaces.removingLoaderName : ""
55 57 readonly property int surfaceWidth: surfaces && surfaces.screenWidth > 0 ? (root.vertical ? Math.max(1, surfaces.screenWidth - surfaces.barHeight) : surfaces.screenWidth) : contentSize.width
56 58 readonly property int surfaceHeight: surfaces && surfaces.screenHeight > 0 ? (root.vertical ? surfaces.screenHeight : Math.max(1, surfaces.screenHeight - surfaces.barHeight)) : contentSize.height
60 + function screenByName(name) {
61 + const want = String(name || "");
62 + const screens = Quickshell.screens;
63 + for (let i = 0; i < screens.length; i++)
64 + if (String(screens[i].name) === want)
65 + return screens[i];
67 + return root.barWindow ? root.barWindow.screen : null;
68 + }
58 70 function contentComponent(name) {
59 71 switch (String(name)) {
60 72 case "clock":
87 99 visible: surfaces && (surfaces.popoutOpen || surfaces.popoutClosing)
88 - screen: root.barWindow ? root.barWindow.screen : null
100 + screen: root.screenByName(root.surfaces ? root.surfaces.popoutOutput : "")
89 101 implicitWidth: root.surfaceWidth
90 102 implicitHeight: root.surfaceHeight
91 103 color: "transparent"
96 108 onVisibleChanged: {
97 109 if (!visible && root.surfaces && root.surfaces.popoutOpen && !root.surfaces.popoutClosing)
98 110 root.surfaces.closePopout("focus-grab-outside");
101 112 onClosed: {
102 113 if (root.surfaces)
103 114 root.surfaces.closePopout("popup-closed");
107 117 anchors {
117 127 onActivated: {
118 128 if (root.surfaces)
119 129 root.surfaces.closePopout("escape-key");
140 149 width: popoutInputRegion.width
141 150 height: popoutInputRegion.height
142 151 acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
143 - onPressed: (mouse) => {
152 + onPressed: mouse => {
144 153 // mouse.x/y are layer-local; the card rect is in root coords. The
145 154 // layer origin is offset on both axes (below the top bar, or right
146 155 // of the left bar), so convert both before the hit test.
172 181 onVisibleChanged: {
173 182 if (visible)
174 183 forceActiveFocus();
177 - Keys.onEscapePressed: (event) => {
185 + Keys.onEscapePressed: event => {
178 186 event.accepted = true;
179 187 if (root.surfaces)
180 188 root.surfaces.closePopout("escape-key");
184 191 Column {
206 213 duration: root.theme && root.theme.lowPowerMode ? 0 : 180
207 214 easing.type: Easing.OutCubic
214 219 Loader {
223 228 duration: root.theme && root.theme.lowPowerMode ? 0 : 180
224 229 easing.type: Easing.OutCubic
235 236 Behavior on y {
237 238 duration: root.theme && root.theme.lowPowerMode ? 0 : 130
238 239 easing.type: Easing.InOutCubic
243 243 Behavior on opacity {
245 245 duration: root.theme && root.theme.lowPowerMode ? 0 : 90
246 246 easing.type: Easing.InOutCubic
253 251 Component {
256 254 Column {
257 255 id: clockCol
259 - property var state: root.timeService ? Util.parseJson(root.timeService.stateJson(), {
260 - }) : ({
261 - })
257 + property var panelState: root.timeService ? Util.parseJson(root.timeService.stateJson(), {}) : ({})
262 258 property date localNow: new Date()
263 259 property var calendar: root.timeService ? Util.parseJson(root.timeService.calendar(localNow.getFullYear(), localNow.getMonth() + 1, localNow.getDate()), {
264 260 "weeks": []
265 261 }) : ({
266 - "weeks": []
267 - })
262 + "weeks": []
263 + })
268 264 property var days: calendar.weeks ? [].concat.apply([], calendar.weeks) : []
270 266 readonly property bool setupMode: root.caldavService && root.caldavService.status === "needs-setup"
297 293 // all-day pills before timed dots within each day
298 294 for (const k in map)
299 - map[k].sort(function (a, b) { return (b.allDay ? 1 : 0) - (a.allDay ? 1 : 0); });
295 + map[k].sort(function (a, b) {
296 + return (b.allDay ? 1 : 0) - (a.allDay ? 1 : 0);
297 + });
300 298 return map;
304 302 readonly property var bandLayout: {
305 303 const gs = root.caldavService ? root.caldavService.gridStartDate() : null;
306 304 if (!gs)
307 - return { "segments": [], "laneCount": 0 };
305 + return {
306 + "segments": [],
307 + "laneCount": 0
308 + };
308 309 return Ical.buildSegments(caldavEvents || [], gs);
311 312 readonly property string todayIso: {
312 313 const d = clockCol.localNow;
313 - function p(n) { return (n < 10 ? "0" : "") + n; }
314 - return d.getFullYear() + "-" + p(d.getMonth() + 1) + "-" + p(d.getDate());
314 + const month = d.getMonth() + 1;
315 + const day = d.getDate();
316 + return d.getFullYear() + "-" + (month < 10 ? "0" : "") + month + "-" + (day < 10 ? "0" : "") + day;
316 318 // today's events + tasks, sorted: all-day/untimed first, then by start time
317 319 readonly property var todayItems: {
332 334 spacing: 8
333 335 width: parent ? parent.width : 0
335 - Component.onCompleted: if (root.caldavService) root.caldavService.refresh()
337 + Component.onCompleted: if (root.caldavService)
338 + root.caldavService.refresh()
337 340 NuguText {
338 341 width: parent ? parent.width : 0
339 342 horizontalAlignment: Text.AlignHCenter
340 343 theme: root.theme
341 344 variant: "title"
342 - text: clockCol.state.clock ? clockCol.state.clock.statusDisplay : "--:--:--"
345 + text: clockCol.panelState.clock ? clockCol.panelState.clock.statusDisplay : "--:--:--"
345 348 NuguText {
347 350 horizontalAlignment: Text.AlignHCenter
348 351 theme: root.theme
349 352 variant: "meta"
350 - text: (clockCol.state.date ? clockCol.state.date.line : "calendar") + (root.caldavService && root.caldavService.stale ? " ·" : "")
353 + text: (clockCol.panelState.date ? clockCol.panelState.date.line : "calendar") + (root.caldavService && root.caldavService.stale ? " ·" : "")
353 356 // centered calendar block: weekday header + month grid + bands
382 385 text: modelData
383 386 opacity: index >= 5 ? 0.4 : 0.7
392 392 Item {
393 393 width: monthGrid.width
394 394 height: monthGrid.height
396 - Grid {
397 - id: monthGrid
396 + Grid {
397 + id: monthGrid
399 - objectName: "calendar-grid"
400 - columns: 7
401 - spacing: clockCol.gridSpacing
403 - Repeater {
404 - model: clockCol.days
406 - Item {
407 - id: cell
409 - readonly property var markers: clockCol.eventsByDate[modelData.iso] || []
411 - width: clockCol.cellW
412 - height: clockCol.cellH
414 - // today: filled accent circle behind the number
415 - Rectangle {
416 - visible: !!modelData.today
417 - anchors.horizontalCenter: parent.horizontalCenter
418 - anchors.verticalCenter: parent.verticalCenter
419 - anchors.verticalCenterOffset: -5
420 - width: 34
421 - height: 34
422 - radius: 17
423 - color: root.theme ? root.theme.ui.accent : "transparent"
426 - NuguText {
427 - anchors.horizontalCenter: parent.horizontalCenter
428 - anchors.verticalCenter: parent.verticalCenter
429 - anchors.verticalCenterOffset: -5
430 - theme: root.theme
431 - variant: "body"
432 - text: modelData.day ? String(modelData.day) : ""
433 - color: modelData.today && root.theme ? root.theme.content.backdrop : (root.theme ? root.theme.content.normal : "white")
434 - opacity: modelData.inMonth ? 1 : 0.3
437 - // marker strip: all-day pills + timed dots, max 3 then "+"
438 - Row {
439 - anchors.horizontalCenter: parent.horizontalCenter
440 - anchors.bottom: parent.bottom
441 - anchors.bottomMargin: 7
442 - spacing: 3
399 + objectName: "calendar-grid"
400 + columns: 7
401 + spacing: clockCol.gridSpacing
444 403 Repeater {
445 - model: Math.min(cell.markers.length, 3)
404 + model: clockCol.days
406 + Item {
407 + id: cell
409 + readonly property var markers: clockCol.eventsByDate[modelData.iso] || []
411 + width: clockCol.cellW
412 + height: clockCol.cellH
414 + // today: filled accent circle behind the number
415 + Rectangle {
416 + visible: !!modelData.today
417 + anchors.horizontalCenter: parent.horizontalCenter
418 + anchors.verticalCenter: parent.verticalCenter
419 + anchors.verticalCenterOffset: -5
420 + width: 34
421 + height: 34
422 + radius: 17
423 + color: root.theme ? root.theme.ui.accent : "transparent"
426 + NuguText {
427 + anchors.horizontalCenter: parent.horizontalCenter
428 + anchors.verticalCenter: parent.verticalCenter
429 + anchors.verticalCenterOffset: -5
430 + theme: root.theme
431 + variant: "body"
432 + text: modelData.day ? String(modelData.day) : ""
433 + color: modelData.today && root.theme ? root.theme.content.backdrop : (root.theme ? root.theme.content.normal : "white")
434 + opacity: modelData.inMonth ? 1 : 0.3
437 + // marker strip: all-day pills + timed dots, max 3 then "+"
438 + Row {
439 + anchors.horizontalCenter: parent.horizontalCenter
440 + anchors.bottom: parent.bottom
441 + anchors.bottomMargin: 7
442 + spacing: 3
444 + Repeater {
445 + model: Math.min(cell.markers.length, 3)
447 + Rectangle {
448 + readonly property var m: cell.markers[index]
449 + readonly property bool overflow: index === 2 && cell.markers.length > 3
451 + width: overflow ? 5 : (m.allDay ? 8 : 4)
452 + height: 3
453 + radius: 1.5
454 + color: overflow ? (root.theme ? root.theme.content.minor : "gray") : m.color
462 + // multi-day band overlay: thin lane-stacked bars over the grid.
463 + // pitch derives from the live cell size; bands sit near the
464 + // cell bottom, stacking upward per lane.
465 + Item {
466 + anchors.fill: monthGrid
467 + z: 2
469 + Repeater {
470 + model: clockCol.bandLayout.segments
447 472 Rectangle {
448 - readonly property var m: cell.markers[index]
449 - readonly property bool overflow: index === 2 && cell.markers.length > 3
473 + readonly property var seg: modelData
451 - width: overflow ? 5 : (m.allDay ? 8 : 4)
452 - height: 3
453 - radius: 1.5
454 - color: overflow ? (root.theme ? root.theme.content.minor : "gray") : m.color
475 + x: seg.colStart * clockCol.pitchX
476 + y: seg.row * clockCol.pitchY + clockCol.cellH - 17 - seg.lane * 9
477 + width: (seg.colEnd - seg.colStart + 1) * clockCol.pitchX - clockCol.gridSpacing
478 + height: 6
479 + color: Qt.alpha(seg.color, 0.9)
480 + topLeftRadius: seg.roundLeft ? 3 : 0
481 + bottomLeftRadius: seg.roundLeft ? 3 : 0
482 + topRightRadius: seg.roundRight ? 3 : 0
483 + bottomRightRadius: seg.roundRight ? 3 : 0
467 - // multi-day band overlay: thin lane-stacked bars over the grid.
468 - // pitch derives from the live cell size; bands sit near the
469 - // cell bottom, stacking upward per lane.
470 - Item {
471 - anchors.fill: monthGrid
472 - z: 2
474 - Repeater {
475 - model: clockCol.bandLayout.segments
477 - Rectangle {
478 - readonly property var seg: modelData
480 - x: seg.colStart * clockCol.pitchX
481 - y: seg.row * clockCol.pitchY + clockCol.cellH - 17 - seg.lane * 9
482 - width: (seg.colEnd - seg.colStart + 1) * clockCol.pitchX - clockCol.gridSpacing
483 - height: 6
484 - color: Qt.alpha(seg.color, 0.9)
485 - topLeftRadius: seg.roundLeft ? 3 : 0
486 - bottomLeftRadius: seg.roundLeft ? 3 : 0
487 - topRightRadius: seg.roundRight ? 3 : 0
488 - bottomRightRadius: seg.roundRight ? 3 : 0
501 491 // today's agenda: events + tasks, ○ for open tasks, ✓ for done; centered
511 501 width: clockCol.gridW
512 502 spacing: 4
514 - Repeater {
515 - model: clockCol.todayItems
504 + Repeater {
505 + model: clockCol.todayItems
517 - Row {
518 - spacing: 6
507 + Row {
508 + spacing: 6
520 - Rectangle {
521 - anchors.verticalCenter: parent.verticalCenter
522 - width: 6
523 - height: 6
524 - radius: 3
525 - color: modelData.color
510 + Rectangle {
511 + anchors.verticalCenter: parent.verticalCenter
512 + width: 6
513 + height: 6
514 + radius: 3
515 + color: modelData.color
528 - NuguText {
529 - theme: root.theme
530 - variant: "body"
531 - text: {
532 - const ev = modelData;
533 - const mark = ev.kind === "task" ? (ev.done ? "✓ " : "○ ") : "";
534 - let t = "";
535 - if (!ev.allDay && ev.startMs != null) {
536 - const d = new Date(ev.startMs);
537 - const p = function (n) { return (n < 10 ? "0" : "") + n; };
538 - t = p(d.getHours()) + ":" + p(d.getMinutes()) + " ";
518 + NuguText {
519 + theme: root.theme
520 + variant: "body"
521 + text: {
522 + const ev = modelData;
523 + const mark = ev.kind === "task" ? (ev.done ? "✓ " : "○ ") : "";
524 + let t = "";
525 + if (!ev.allDay && ev.startMs != null) {
526 + const d = new Date(ev.startMs);
527 + const p = function (n) {
528 + return (n < 10 ? "0" : "") + n;
529 + };
530 + t = p(d.getHours()) + ":" + p(d.getMinutes()) + " ";
532 + return t + mark + (ev.summary || "(ohne Titel)");
540 - return t + mark + (ev.summary || "(ohne Titel)");
538 + NuguText {
539 + visible: clockCol.todayItems.length === 0
540 + theme: root.theme
541 + variant: "meta"
542 + text: "Keine Termine"
548 - NuguText {
549 - visible: clockCol.todayItems.length === 0
550 - theme: root.theme
551 - variant: "meta"
552 - text: "Keine Termine"
559 547 // setup form: shown when the service has no usable config yet.
569 557 // grab keyboard focus into the first field once the card has
570 558 // finished claiming the surface focus (callLater wins the race)
571 - onVisibleChanged: if (visible) Qt.callLater(urlField.field.forceActiveFocus)
572 - Component.onCompleted: if (visible) Qt.callLater(urlField.field.forceActiveFocus)
574 - component Field: Rectangle {
575 - property alias field: ti
576 - property string placeholder: ""
577 - property bool secret: false
579 - width: setupForm.width
580 - height: 30
581 - radius: 10
582 - color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.14) : "transparent"
584 - TextInput {
585 - id: ti
587 - anchors.fill: parent
588 - anchors.leftMargin: 10
589 - anchors.rightMargin: 10
590 - verticalAlignment: TextInput.AlignVCenter
591 - color: root.theme ? root.theme.content.normal : "white"
592 - selectionColor: root.theme ? root.theme.ui.focus : "#ffffff"
593 - selectedTextColor: root.theme ? root.theme.content.backdrop : "black"
594 - font.family: "IBM Plex Sans"
595 - font.pixelSize: 13
596 - echoMode: parent.secret ? TextInput.Password : TextInput.Normal
597 - clip: true
600 - NuguText {
601 - anchors.left: parent.left
602 - anchors.leftMargin: 10
603 - anchors.verticalCenter: parent.verticalCenter
604 - visible: ti.text.length === 0
605 - theme: root.theme
606 - variant: "meta"
607 - text: parent.placeholder
559 + onVisibleChanged: if (visible)
560 + Qt.callLater(urlField.field.forceActiveFocus)
561 + Component.onCompleted: if (visible)
562 + Qt.callLater(urlField.field.forceActiveFocus)
612 564 NuguText {
613 565 theme: root.theme
650 602 MouseArea {
651 603 anchors.fill: parent
652 604 cursorShape: Qt.PointingHandCursor
653 - onClicked: if (root.caldavService) root.caldavService.saveSetup(urlField.field.text, userField.field.text, pwField.field.text)
605 + onClicked: if (root.caldavService)
606 + root.caldavService.saveSetup(urlField.field.text, userField.field.text, pwField.field.text)
658 610 NuguText {
662 614 color: root.theme ? root.theme.error : "red"
663 615 text: root.caldavService ? root.caldavService.secretError : ""
621 + component Field: Rectangle {
622 + property alias field: ti
623 + property string placeholder: ""
624 + property bool secret: false
626 + width: setupForm.width
627 + height: 30
628 + radius: 10
629 + color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.14) : "transparent"
631 + TextInput {
632 + id: ti
634 + anchors.fill: parent
635 + anchors.leftMargin: 10
636 + anchors.rightMargin: 10
637 + verticalAlignment: TextInput.AlignVCenter
638 + color: root.theme ? root.theme.content.normal : "white"
639 + selectionColor: root.theme ? root.theme.ui.focus : "#ffffff"
640 + selectedTextColor: root.theme ? root.theme.content.backdrop : "black"
641 + font.family: "IBM Plex Sans"
642 + font.pixelSize: 13
643 + echoMode: parent.secret ? TextInput.Password : TextInput.Normal
644 + clip: true
647 + NuguText {
648 + anchors.left: parent.left
649 + anchors.leftMargin: 10
650 + anchors.verticalCenter: parent.verticalCenter
651 + visible: ti.text.length === 0
652 + theme: root.theme
653 + variant: "meta"
654 + text: parent.placeholder
672 658 Component {
678 664 // service handle; identity facts and the live issue ARRAY come straight
679 665 // off Resources.qml (no per-frame JSON parse).
680 666 readonly property var rs: root.resourceService
681 - readonly property var identity: rs ? rs.identity : ({
682 - })
667 + readonly property var identity: rs ? rs.identity : ({})
683 668 // touch the inputs so the band re-evaluates when the slow/rare loops
684 669 // mutate them; issues() itself is a plain function call.
685 670 readonly property var issueList: {
704 689 Component.onCompleted: {
705 690 if (rs)
706 691 rs.popoutOpen = true;
709 693 Component.onDestruction: {
710 694 if (rs)
711 695 rs.popoutOpen = false;
715 698 // ---- two rounded cards: identity | live, split on the golden ratio
752 735 variant: "title"
753 736 text: "machine"
758 740 IdentityRow {
823 805 return s;
831 811 // ===== LIVE STATS =====
855 835 variant: "title"
856 836 text: "live"
861 840 MetricRow {
935 914 const ring = systemPanel.rs.netRing || [];
936 915 let m = 0;
937 - for (let i = 0; i < ring.length; i++) m = Math.max(m, Number(ring[i]) || 0)
916 + for (let i = 0; i < ring.length; i++)
917 + m = Math.max(m, Number(ring[i]) || 0);
938 918 const cur = systemPanel.rs.networkRxRate + systemPanel.rs.networkTxRate;
939 919 return m > 0 ? Math.min(1, cur / m) : 0;
958 938 const ring = systemPanel.rs.diskRing || [];
959 939 let m = 0;
960 - for (let i = 0; i < ring.length; i++) m = Math.max(m, Number(ring[i]) || 0)
940 + for (let i = 0; i < ring.length; i++)
941 + m = Math.max(m, Number(ring[i]) || 0);
961 942 const cur = systemPanel.rs.diskReadRate + systemPanel.rs.diskWriteRate;
962 943 return m > 0 ? Math.min(1, cur / m) : 0;
975 956 variant: "meta"
976 957 text: systemPanel.rs ? `load ${systemPanel.rs.loadOne.toFixed(2)} · ${systemPanel.rs.loadFive.toFixed(2)} · ${systemPanel.rs.loadFifteen.toFixed(2)} (${systemPanel.rs.cores} cores)` : "load —"
985 963 // ---- issues band ----
1016 994 variant: "meta"
1017 995 text: "disk · memory · battery · updates ok"
1024 1000 Repeater {
1099 1075 width: parent.width
1100 1076 text: String(issueCard.modelData.detail || "")
1105 1080 Rectangle {
1135 1110 onClicked: {
1136 1111 if (systemPanel.rs)
1137 1112 systemPanel.rs.runIssueAction(issueCard.modelData.id);
1150 1120 // ---- compact top-processes row (chips) ----
1183 1153 color: root.theme ? root.theme.ui.accent : "white"
1184 1154 text: `${Number(procChip.modelData.cpu || 0).toFixed(0)}%`
1199 1163 Component {
1204 1168 notificationService: root.notificationService
1205 1169 width: parent ? parent.width : 0
1210 1173 Component {
1215 1178 trayService: root.trayService
1216 1179 width: parent ? parent.width : 0
1221 1183 Component {
1226 1188 mediaService: root.mediaService
1227 1189 width: parent ? parent.width : 0
1232 1193 Component {
1237 1198 clipboardService: root.clipboardService
1238 1199 width: parent ? parent.width : 0
1243 1203 Component {
1246 1206 LauncherPanel {
1247 1207 theme: root.theme
1248 1208 launcherService: root.launcherService
1209 + surfaces: root.surfaces
1249 1210 width: parent ? parent.width : 0
1254 1214 Component {
1259 1219 audioService: root.audioService
1260 1220 width: parent ? parent.width : 0
1265 1224 Component {
1270 1229 brightnessService: root.brightnessService
1271 1230 width: parent ? parent.width : 0
1276 1234 Component {
1283 1241 bluetoothService: root.bluetoothService
1284 1242 width: parent ? parent.width : 0
1289 1246 Component {
1294 1251 powerService: root.powerService
1295 1252 width: parent ? parent.width : 0
1300 1256 Component {
1310 1266 width: parent.width
1311 1267 wrapMode: Text.WordWrap
1318 1272 mask: Region {
1322 1276 component NuguText: Text {
1323 - required property QtObject theme
1277 + required property Theme theme
1324 1278 property string variant: "body"
1325 1279 property bool selected: false
1336 1290 duration: root.theme && root.theme.lowPowerMode ? 0 : 180
1337 1291 easing.type: Easing.OutCubic
1342 1295 Behavior on implicitHeight {
1344 1297 duration: root.theme && root.theme.lowPowerMode ? 0 : 180
1345 1298 easing.type: Easing.OutCubic
1350 1302 component IdentityRow: Row {
1351 1303 id: irow
1353 - required property QtObject theme
1305 + required property Theme theme
1354 1306 property string glyph: ""
1355 1307 property string value: ""
1371 1323 text: irow.value
1372 1324 width: Math.max(1, parent.width - 27)
1377 1328 // thin Rectangle sparkline over a ring buffer (no Canvas, no shader). Single
1381 1332 component Sparkline: Item {
1382 1333 id: spark
1384 - required property QtObject theme
1335 + required property Theme theme
1385 1336 property var values: []
1386 1337 property var valuesDown: []
1387 1338 property color barColor: theme ? theme.ui.accent : "white"
1404 1355 return spark.scaleMax;
1405 1356 let m = 0;
1406 1357 const a = spark.slice;
1407 - for (let i = 0; i < a.length; i++) m = Math.max(m, Number(a[i]) || 0)
1358 + for (let i = 0; i < a.length; i++)
1359 + m = Math.max(m, Number(a[i]) || 0);
1408 1360 if (spark.split) {
1409 1361 const b = spark.sliceDown;
1410 - for (let j = 0; j < b.length; j++) m = Math.max(m, Number(b[j]) || 0)
1362 + for (let j = 0; j < b.length; j++)
1363 + m = Math.max(m, Number(b[j]) || 0);
1412 1365 return m;
1438 1391 height: Math.max(spark.split ? 0 : 1, spark.budget * (spark.maxV > 0 ? Math.min(1, (Number(modelData) || 0) / spark.maxV) : 0))
1439 1392 color: spark.barColor
1448 1398 // down series (split only): grows downward from the centerline
1470 1420 height: Math.max(0, spark.budget * (spark.maxV > 0 ? Math.min(1, (Number(modelData) || 0) / spark.maxV) : 0))
1471 1421 color: spark.barColorDown
1482 1428 // one live metric: label · value · rounded fill-bar (track + fill) · sparkline.
1483 1429 component MetricRow: Item {
1484 1430 id: mrow
1486 - required property QtObject theme
1432 + required property Theme theme
1487 1433 property string label: ""
1488 1434 property string value: ""
1489 1435 property real fraction: 0
1561 1507 duration: mrow.theme && mrow.theme.lowPowerMode ? 0 : 160
1562 1508 easing.type: Easing.OutCubic
1573 - component LauncherPanel: Column {
1515 + component LauncherPanel: FocusScope {
1574 1516 id: root
1576 - required property QtObject theme
1577 - required property QtObject launcherService
1518 + required property Theme theme
1519 + required property Launcher launcherService
1520 + required property SurfaceManager surfaces
1578 1521 property string query: ""
1579 - property var state: launcherService ? Util.parseJson(launcherService.search(query), {
1522 + property var panelState: launcherService ? Util.parseJson(launcherService.search(query), {
1580 1523 "results": [],
1581 1524 "selectedIndex": -1,
1582 - "providerIntent": "all",
1525 + "providerIntent": "app",
1583 1526 "query": ""
1584 1527 }) : ({
1585 - "results": [],
1586 - "selectedIndex": -1,
1587 - "providerIntent": "all",
1588 - "query": ""
1589 - })
1590 - readonly property var results: state.results || []
1591 - // fixed row geometry, shared so the programmatic scroll stride can't drift
1592 - readonly property int rowHeight: 54
1593 - readonly property int rowSpacing: 6
1528 + "results": [],
1529 + "selectedIndex": -1,
1530 + "providerIntent": "app",
1531 + "query": ""
1532 + })
1533 + readonly property var results: panelState.results || []
1534 + readonly property int selectedIndex: Math.max(0, Math.min(results.length - 1, Number(panelState.selectedIndex || 0)))
1535 + readonly property var selectedRow: results.length > 0 ? results[selectedIndex] : ({})
1536 + readonly property var selectedActions: selectedRow.actions || []
1537 + readonly property var selectedDetails: selectedRow.details || []
1538 + readonly property int rowHeight: 52
1539 + readonly property int rowSpacing: 4
1594 1540 readonly property int rowStride: rowHeight + rowSpacing
1541 + readonly property int rightWidth: Math.min(300, Math.max(260, Math.round(width * 0.36)))
1597 1543 function refresh() {
1598 1544 if (launcherService)
1599 - state = Util.parseJson(launcherService.search(query), state);
1545 + panelState = Util.parseJson(launcherService.search(query), panelState);
1603 1548 function setQuery(text) {
1605 1550 refresh();
1553 + function close() {
1554 + if (surfaces)
1555 + surfaces.closePopout("launcher-activated");
1558 + function activateSelected() {
1559 + if (!launcherService || results.length === 0)
1560 + return;
1562 + launcherService.activate(JSON.stringify(selectedRow));
1563 + close();
1566 + function activateAction(index) {
1567 + if (!launcherService || results.length === 0 || index < 0 || index >= selectedActions.length)
1568 + return;
1570 + launcherService.activateAction(JSON.stringify(selectedRow), index);
1571 + close();
1608 1574 function select(index) {
1609 1575 if (results.length === 0)
1610 - return ;
1576 + return;
1612 1578 const i = Math.max(0, Math.min(results.length - 1, Number(index)));
1613 - const next = Object.assign({
1614 - }, state);
1579 + const next = Object.assign({}, panelState);
1615 1580 next.selectedIndex = i;
1616 - state = next;
1617 - // keep the chosen row inside the non-interactive Flickable's viewport
1581 + panelState = next;
1618 1582 const top = i * rowStride;
1619 1583 const bottom = top + rowHeight;
1620 1584 if (top < resultsFlick.contentY)
1626 1590 function wheelSelect(deltaY) {
1627 1591 if (results.length <= 1)
1628 - return ;
1592 + return;
1630 - const current = Math.max(0, Math.min(results.length - 1, Number(state.selectedIndex || 0)));
1631 - // wheel up/away (deltaY >= 0) moves selection up, matching the Up arrow.
1632 1594 const direction = Number(deltaY) >= 0 ? -1 : 1;
1633 - const next = Math.max(0, Math.min(results.length - 1, current + direction));
1634 - select(next);
1595 + select(selectedIndex + direction);
1637 - function providerColor(provider) {
1638 - if (!theme)
1639 - return "white";
1641 - if (provider === "calculator")
1642 - return theme.info;
1644 - if (provider === "action")
1645 - return theme.warning;
1647 - if (provider === "clipboard")
1648 - return theme.ui.focus;
1650 - if (provider === "window")
1651 - return theme.content.accent;
1653 - return theme.ui.accent;
1598 + function keyAction(event) {
1599 + if (event.modifiers & Qt.ControlModifier) {
1600 + const n = Number(event.text);
1601 + if (n >= 1 && n <= selectedActions.length) {
1602 + event.accepted = true;
1603 + activateAction(n - 1);
1656 1608 width: parent ? parent.width : 0
1657 - spacing: 10
1609 + height: parent ? parent.height : 0
1610 + focus: true
1611 + Component.onCompleted: Qt.callLater(searchInput.forceActiveFocus)
1612 + onVisibleChanged: if (visible)
1613 + Qt.callLater(searchInput.forceActiveFocus)
1615 + Keys.onUpPressed: event => {
1616 + event.accepted = true;
1617 + select(selectedIndex - 1);
1619 + Keys.onDownPressed: event => {
1620 + event.accepted = true;
1621 + select(selectedIndex + 1);
1623 + Keys.onReturnPressed: event => {
1624 + event.accepted = true;
1625 + activateSelected();
1627 + Keys.onEnterPressed: event => {
1628 + event.accepted = true;
1629 + activateSelected();
1631 + Keys.onPressed: keyAction(event)
1659 1633 WheelHandler {
1660 1634 target: root
1661 - onWheel: (event) => {
1635 + onWheel: event => {
1662 1636 event.accepted = true;
1663 1637 root.wheelSelect(event.angleDelta.y);
1667 - // Full-width scrollable result list. The Flickable is non-interactive:
1668 - // the wheel is owned by the root WheelHandler (-> wheelSelect), and
1669 - // select() drives contentY programmatically to keep the chosen row in view.
1670 - Flickable {
1671 - id: resultsFlick
1672 - objectName: "launcherResultList"
1641 + Rectangle {
1642 + anchors.fill: parent
1643 + radius: 14
1644 + color: root.theme ? root.theme.ui.backdrop : "#242424"
1645 + border.width: 1
1646 + border.color: root.theme ? root.theme.withAlpha(root.theme.ui.normal, 0.34) : "#666666"
1674 - width: parent.width
1675 - // fill the popout budget minus the docked search field (42) + hint
1676 - // (~18) + the two 10px Column gaps; clamped so it never collapses.
1677 - height: Math.max(120, (root.parent ? root.parent.height : 460) - 84)
1678 - contentHeight: resultColumn.implicitHeight
1679 - interactive: false
1680 - clip: true
1681 - boundsBehavior: Flickable.StopAtBounds
1649 + Rectangle {
1650 + anchors.left: parent.left
1651 + anchors.right: parent.right
1652 + anchors.bottom: parent.bottom
1653 + height: 3
1654 + color: root.theme ? root.theme.ui.accent : "#d86dd8"
1683 - Behavior on contentY {
1684 - NumberAnimation {
1685 - duration: root.theme && root.theme.lowPowerMode ? 0 : 140
1686 - easing.type: Easing.OutCubic
1657 + Row {
1658 + anchors.fill: parent
1659 + anchors.margins: 1
1661 + Item {
1662 + width: Math.max(1, parent.width - root.rightWidth)
1663 + height: parent.height
1665 + Rectangle {
1666 + id: searchBox
1668 + anchors.left: parent.left
1669 + anchors.right: parent.right
1670 + anchors.top: parent.top
1671 + height: 66
1672 + color: "transparent"
1674 + Text {
1675 + anchors.left: parent.left
1676 + anchors.leftMargin: 20
1677 + anchors.verticalCenter: parent.verticalCenter
1678 + text: "⌕"
1679 + color: root.theme ? root.theme.ui.accent : "#d86dd8"
1680 + font.pixelSize: 21
1683 + TextInput {
1684 + id: searchInput
1686 + anchors.left: parent.left
1687 + anchors.leftMargin: 60
1688 + anchors.right: parent.right
1689 + anchors.rightMargin: 18
1690 + anchors.verticalCenter: parent.verticalCenter
1691 + color: root.theme ? root.theme.content.normal : "white"
1692 + selectionColor: root.theme ? root.theme.ui.focus : "#ffffff"
1693 + selectedTextColor: root.theme ? root.theme.content.backdrop : "black"
1694 + font.family: "IBM Plex Mono"
1695 + font.pixelSize: 25
1696 + text: root.query
1697 + focus: true
1698 + clip: true
1699 + onTextChanged: {
1700 + if (text !== root.query)
1701 + root.setQuery(text);
1703 + onAccepted: root.activateSelected()
1704 + Keys.onUpPressed: event => {
1705 + event.accepted = true;
1706 + root.select(root.selectedIndex - 1);
1708 + Keys.onDownPressed: event => {
1709 + event.accepted = true;
1710 + root.select(root.selectedIndex + 1);
1712 + Keys.onReturnPressed: event => {
1713 + event.accepted = true;
1714 + root.activateSelected();
1716 + Keys.onEnterPressed: event => {
1717 + event.accepted = true;
1718 + root.activateSelected();
1720 + Keys.onPressed: root.keyAction(event)
1723 + Rectangle {
1724 + anchors.left: parent.left
1725 + anchors.right: parent.right
1726 + anchors.bottom: parent.bottom
1727 + height: 1
1728 + color: root.theme ? root.theme.withAlpha(root.theme.ui.normal, 0.22) : "#444444"
1732 + Flickable {
1733 + id: resultsFlick
1734 + objectName: "launcherResultList"
1736 + anchors.left: parent.left
1737 + anchors.right: parent.right
1738 + anchors.top: searchBox.bottom
1739 + anchors.bottom: parent.bottom
1740 + anchors.margins: 8
1741 + contentHeight: resultColumn.implicitHeight
1742 + interactive: false
1743 + clip: true
1744 + boundsBehavior: Flickable.StopAtBounds
1746 + Behavior on contentY {
1747 + NumberAnimation {
1748 + duration: root.theme && root.theme.lowPowerMode ? 0 : 120
1749 + easing.type: Easing.OutCubic
1753 + Column {
1754 + id: resultColumn
1756 + width: resultsFlick.width
1757 + spacing: root.rowSpacing
1759 + Repeater {
1760 + model: root.results.slice(0, 60)
1762 + delegate: Rectangle {
1763 + id: rrow
1765 + required property int index
1766 + required property var modelData
1767 + readonly property bool isSelected: index === root.selectedIndex
1769 + width: parent.width
1770 + height: root.rowHeight
1771 + radius: 11
1772 + color: root.theme ? (isSelected ? root.theme.ui.focus : "transparent") : (isSelected ? "#9aabae" : "transparent")
1774 + Item {
1775 + id: iconSlot
1777 + anchors.left: parent.left
1778 + anchors.leftMargin: 11
1779 + anchors.verticalCenter: parent.verticalCenter
1780 + width: 30
1781 + height: 30
1783 + Rectangle {
1784 + anchors.fill: parent
1785 + radius: 8
1786 + color: root.theme ? root.theme.content.backdrop : "#121212"
1789 + IconImage {
1790 + id: appIcon
1792 + anchors.fill: parent
1793 + anchors.margins: 4
1794 + visible: appIcon.status === Image.Ready
1795 + source: String(rrow.modelData.icon || "").length > 0 ? Quickshell.iconPath(String(rrow.modelData.icon), true) : ""
1798 + Text {
1799 + anchors.centerIn: parent
1800 + visible: !appIcon.visible
1801 + text: String(rrow.modelData.glyph || "")
1802 + font.family: "Symbols Nerd Font Mono"
1803 + font.pixelSize: 17
1804 + color: root.theme ? root.theme.ui.accent : "#d86dd8"
1808 + Column {
1809 + anchors.left: iconSlot.right
1810 + anchors.leftMargin: 12
1811 + anchors.right: ordinal.left
1812 + anchors.rightMargin: 10
1813 + anchors.verticalCenter: parent.verticalCenter
1814 + spacing: 2
1816 + NuguText {
1817 + theme: root.theme
1818 + selected: rrow.isSelected
1819 + text: rrow.modelData.title || rrow.modelData.id || "app"
1820 + width: parent.width
1823 + NuguText {
1824 + theme: root.theme
1825 + variant: "meta"
1826 + selected: rrow.isSelected
1827 + text: rrow.modelData.subtitle || rrow.modelData.comment || rrow.modelData.desktopId || "app"
1828 + width: parent.width
1829 + opacity: rrow.isSelected ? 0.82 : 0.72
1833 + NuguText {
1834 + id: ordinal
1836 + anchors.right: parent.right
1837 + anchors.rightMargin: 12
1838 + anchors.verticalCenter: parent.verticalCenter
1839 + theme: root.theme
1840 + variant: "mono"
1841 + selected: rrow.isSelected
1842 + text: rrow.index === 0 ? "enter" : String(rrow.index + 1)
1843 + width: 42
1844 + horizontalAlignment: Text.AlignRight
1845 + opacity: rrow.isSelected ? 0.8 : 0.52
1848 + MouseArea {
1849 + anchors.fill: parent
1850 + onClicked: root.select(rrow.index)
1851 + onDoubleClicked: root.activateSelected()
1852 + onWheel: wheel => {
1853 + wheel.accepted = true;
1854 + root.wheelSelect(wheel.angleDelta.y);
1690 - Column {
1691 - id: resultColumn
1863 + Rectangle {
1864 + width: root.rightWidth
1865 + height: parent.height
1866 + color: "transparent"
1867 + border.width: 0
1693 - width: resultsFlick.width
1694 - spacing: root.rowSpacing
1869 + Rectangle {
1870 + anchors.left: parent.left
1871 + anchors.top: parent.top
1872 + anchors.bottom: parent.bottom
1873 + width: 1
1874 + color: root.theme ? root.theme.withAlpha(root.theme.ui.normal, 0.22) : "#444444"
1696 - Repeater {
1697 - model: root.results.slice(0, 60)
1699 - delegate: Rectangle {
1700 - id: rrow
1702 - required property int index
1703 - required property var modelData
1704 - readonly property bool isSelected: index === (root.state.selectedIndex || 0)
1705 - readonly property bool isCalc: modelData.provider === "calculator"
1706 - readonly property color tint: root.providerColor(modelData.provider)
1877 + Column {
1878 + anchors.fill: parent
1879 + anchors.margins: 22
1880 + spacing: 6
1882 + Row {
1708 1883 width: parent.width
1709 - height: root.rowHeight
1710 - radius: 12
1711 - // solid dark card — the popup frame is light, so a translucent
1712 - // tint washes out (white bleeds through). Provider identity is
1713 - // carried by the left accent bar + border; selection by focus.
1714 - color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, rrow.isSelected ? 0.82 : 0.55) : "transparent"
1715 - border.width: rrow.isSelected ? 2 : 1
1716 - border.color: root.theme ? (rrow.isSelected ? root.theme.ui.focus : root.theme.withAlpha(rrow.tint, 0.45)) : "transparent"
1884 + height: 58
1885 + spacing: 14
1718 - // provider-colored left accent bar (identity at a glance)
1719 - Rectangle {
1720 - anchors.left: parent.left
1721 - anchors.top: parent.top
1722 - anchors.bottom: parent.bottom
1723 - anchors.margins: 2
1724 - width: 3
1725 - radius: 2
1726 - color: rrow.tint
1727 - opacity: rrow.isSelected ? 1 : 0.7
1730 - // leading 32px icon slot: real themed app icon, else the
1731 - // provider Nerd Font glyph. Glyph also covers the app
1732 - // fallback when the icon name fails to resolve (status
1733 - // never reaches Image.Ready -> glyph stays visible).
1735 - id: iconSlot
1888 + width: 56
1889 + height: 56
1737 - anchors.left: parent.left
1738 - anchors.leftMargin: 10
1739 - anchors.verticalCenter: parent.verticalCenter
1740 - width: 32
1741 - height: 32
1891 + Rectangle {
1892 + anchors.fill: parent
1893 + radius: 15
1894 + color: root.theme ? root.theme.content.backdrop : "#121212"
1743 1897 IconImage {
1744 - id: appIcon
1898 + id: detailIcon
1746 1900 anchors.fill: parent
1747 - visible: rrow.modelData.provider === "app" && appIcon.status === Image.Ready
1748 - source: (rrow.modelData.provider === "app" && String(rrow.modelData.icon || "").length > 0) ? Quickshell.iconPath(String(rrow.modelData.icon), true) : ""
1901 + anchors.margins: 8
1902 + visible: detailIcon.status === Image.Ready
1903 + source: String(root.selectedRow.icon || "").length > 0 ? Quickshell.iconPath(String(root.selectedRow.icon), true) : ""
1752 1907 anchors.centerIn: parent
1753 - visible: !appIcon.visible
1754 - text: String(rrow.modelData.glyph || "")
1908 + visible: !detailIcon.visible
1909 + text: String(root.selectedRow.glyph || "")
1755 1910 font.family: "Symbols Nerd Font Mono"
1756 - font.pixelSize: 18
1757 - color: rrow.tint
1911 + font.pixelSize: 27
1912 + color: root.theme ? root.theme.ui.accent : "#d86dd8"
1762 - // calculator row: expression small, value large + mono
1763 1916 Column {
1764 - visible: rrow.isCalc
1765 - anchors.left: iconSlot.right
1766 - anchors.leftMargin: 12
1767 - anchors.right: parent.right
1768 - anchors.rightMargin: 12
1917 + width: Math.max(1, parent.width - 70)
1769 1918 anchors.verticalCenter: parent.verticalCenter
1770 - spacing: 1
1919 + spacing: 3
1772 1921 NuguText {
1773 1922 theme: root.theme
1774 - variant: "meta"
1775 - text: rrow.modelData.subtitle || rrow.modelData.id || "expression"
1923 + variant: "title"
1924 + text: root.selectedRow.title || "No apps"
1776 1925 width: parent.width
1777 - opacity: 0.8
1780 - Text {
1781 - width: parent.width
1782 - text: String(rrow.modelData.value || rrow.modelData.title || "0")
1783 - color: rrow.isSelected && root.theme ? root.theme.content.backdrop : (root.theme ? root.theme.content.normal : "white")
1784 - font.family: "IBM Plex Mono"
1785 1926 font.pixelSize: 22
1786 - font.bold: true
1787 - elide: Text.ElideRight
1929 + NuguText {
1930 + theme: root.theme
1931 + variant: "mono"
1932 + text: root.selectedRow.genericName || root.selectedRow.desktopId || "app"
1933 + width: parent.width
1934 + opacity: 0.62
1939 + NuguText {
1940 + theme: root.theme
1941 + variant: "mono"
1942 + text: "actions"
1943 + width: parent.width
1944 + topPadding: 24
1945 + bottomPadding: 8
1946 + opacity: 0.68
1949 + Rectangle {
1950 + width: parent.width
1951 + height: 42
1952 + radius: 11
1953 + color: root.theme ? root.theme.content.backdrop : "#121212"
1955 + NuguText {
1956 + anchors.left: parent.left
1957 + anchors.leftMargin: 12
1958 + anchors.verticalCenter: parent.verticalCenter
1959 + theme: root.theme
1960 + text: "open"
1961 + width: parent.width - 78
1792 - // standard row: title + muted `verb · subtitle` meta
1793 - Column {
1794 - visible: !rrow.isCalc
1795 - anchors.left: iconSlot.right
1796 - anchors.leftMargin: 12
1964 + NuguText {
1797 1965 anchors.right: parent.right
1798 1966 anchors.rightMargin: 12
1799 1967 anchors.verticalCenter: parent.verticalCenter
1800 - spacing: 2
1802 - NuguText {
1803 - theme: root.theme
1804 - selected: rrow.isSelected
1805 - text: rrow.modelData.title || rrow.modelData.id || "result"
1806 - width: parent.width
1809 - NuguText {
1810 - theme: root.theme
1811 - variant: "meta"
1812 - text: `${rrow.modelData.verb || "activate"} · ${rrow.modelData.subtitle || rrow.modelData.provider}`
1813 - width: parent.width
1814 - opacity: 0.78
1968 + theme: root.theme
1969 + variant: "mono"
1970 + text: "enter"
1971 + width: 52
1972 + horizontalAlignment: Text.AlignRight
1973 + opacity: 0.7
1819 1976 MouseArea {
1820 1977 anchors.fill: parent
1821 - onClicked: root.select(rrow.index)
1822 - onWheel: (wheel) => {
1823 - wheel.accepted = true;
1824 - root.wheelSelect(wheel.angleDelta.y);
1978 + onClicked: root.activateSelected()
1982 + Repeater {
1983 + model: root.selectedActions.slice(0, 4)
1985 + delegate: Rectangle {
1986 + required property int index
1987 + required property var modelData
1989 + width: parent.width
1990 + height: 42
1991 + radius: 11
1992 + color: root.theme ? root.theme.content.backdrop : "#121212"
1994 + NuguText {
1995 + anchors.left: parent.left
1996 + anchors.leftMargin: 12
1997 + anchors.verticalCenter: parent.verticalCenter
1998 + theme: root.theme
1999 + text: modelData.title || modelData.id || "action"
2000 + width: parent.width - 78
2003 + NuguText {
2004 + anchors.right: parent.right
2005 + anchors.rightMargin: 12
2006 + anchors.verticalCenter: parent.verticalCenter
2007 + theme: root.theme
2008 + variant: "mono"
2009 + text: "ctrl " + (index + 1)
2010 + width: 52
2011 + horizontalAlignment: Text.AlignRight
2012 + opacity: 0.7
2015 + MouseArea {
2016 + anchors.fill: parent
2017 + onClicked: root.activateAction(index)
2022 + NuguText {
2023 + theme: root.theme
2024 + variant: "mono"
2025 + text: "desktop entry"
2026 + width: parent.width
2027 + topPadding: 24
2028 + bottomPadding: 8
2029 + opacity: 0.68
2032 + Rectangle {
2033 + width: parent.width
2034 + height: detailColumn.implicitHeight + 20
2035 + radius: 11
2036 + color: root.theme ? root.theme.content.backdrop : "#121212"
2038 + Column {
2039 + id: detailColumn
2041 + anchors.left: parent.left
2042 + anchors.right: parent.right
2043 + anchors.top: parent.top
2044 + anchors.margins: 10
2045 + spacing: 6
2047 + Repeater {
2048 + model: root.selectedDetails
2050 + delegate: Row {
2051 + required property var modelData
2053 + width: parent.width
2054 + spacing: 10
2056 + NuguText {
2057 + theme: root.theme
2058 + variant: "meta"
2059 + text: modelData.label || ""
2060 + width: 70
2061 + opacity: 0.62
2064 + NuguText {
2065 + theme: root.theme
2066 + variant: "meta"
2067 + text: modelData.value || "—"
2068 + width: Math.max(1, parent.width - 80)
2069 + horizontalAlignment: Text.AlignRight
1836 - Rectangle {
1837 - objectName: "searchFieldDockedBottom"
1838 - width: parent.width
1839 - height: 42
1840 - radius: 21
1841 - color: root.theme ? root.theme.withAlpha(root.theme.ui.focus, 0.14) : "transparent"
1842 - border.width: 0
1843 - border.color: root.theme ? root.theme.ui.focus : "transparent"
1845 - NuguText {
1846 - anchors.left: parent.left
1847 - anchors.leftMargin: 14
1848 - anchors.verticalCenter: parent.verticalCenter
1849 - theme: root.theme
1850 - variant: "meta"
1851 - text: "search"
1852 - opacity: 0.7
1855 - TextInput {
1856 - anchors.left: parent.left
1857 - anchors.leftMargin: 72
1858 - anchors.right: parent.right
1859 - anchors.rightMargin: 14
1860 - anchors.verticalCenter: parent.verticalCenter
1861 - color: root.theme ? root.theme.content.normal : "white"
1862 - selectionColor: root.theme ? root.theme.ui.focus : "#ffffff"
1863 - selectedTextColor: root.theme ? root.theme.content.backdrop : "black"
1864 - font.family: "IBM Plex Mono"
1865 - text: root.query
1866 - focus: false
1867 - onTextChanged: {
1868 - if (text !== root.query)
1869 - root.setQuery(text);
1872 - Keys.onUpPressed: root.select((root.state.selectedIndex || 0) - 1)
1873 - Keys.onDownPressed: root.select((root.state.selectedIndex || 0) + 1)
1874 - Keys.onReturnPressed: (event) => {
1875 - event.accepted = true;
1877 - Keys.onEnterPressed: (event) => {
1878 - event.accepted = true;
1884 - NuguText {
1885 - objectName: "keyboardNavigation"
1886 - theme: root.theme
1887 - variant: "meta"
1888 - text: "↑↓ select · Enter activate"
1889 - width: parent.width
1890 - elide: Text.ElideRight
1895 2080 component NotificationGroup: Column {
1896 2081 id: root
1898 - required property QtObject theme
1899 - required property QtObject notificationService
1900 - property var state: notificationService ? Util.parseJson(notificationService.stateJson(), {"groups": [], "dnd": false, "activeCount": 0}) : ({"groups": [], "dnd": false, "activeCount": 0})
1901 - readonly property var groups: state.groups || []
2083 + required property Theme theme
2084 + required property Notifications notificationService
2085 + property var panelState: notificationService ? Util.parseJson(notificationService.stateJson(), {
2086 + "groups": [],
2087 + "dnd": false,
2088 + "activeCount": 0
2089 + }) : ({
2090 + "groups": [],
2091 + "dnd": false,
2092 + "activeCount": 0
2093 + })
2094 + readonly property var groups: panelState.groups || []
1903 2096 // mutators trigger side-effects only; never assign to `state` — that
1904 2097 // would destroy the binding above and freeze the open popup, so
1937 2130 anchors.verticalCenter: parent.verticalCenter
1938 2131 theme: root.theme
1939 2132 variant: "title"
1940 - text: `Notifications${root.state.activeCount ? " · " + root.state.activeCount : ""}`
2133 + text: `Notifications${root.panelState.activeCount ? " · " + root.panelState.activeCount : ""}`
1943 2136 anchors.right: parent.right
1947 2140 width: dndLabel.implicitWidth + 18
1948 2141 height: 24
1949 2142 radius: 8
1950 - color: root.theme ? root.theme.withAlpha(root.state.dnd ? root.theme.ui.accent : root.theme.ui.minor, root.state.dnd ? 0.3 : 0.12) : "transparent"
1951 - NuguText { id: dndLabel; anchors.centerIn: parent; theme: root.theme; variant: "meta"; text: root.state.dnd ? "DND on" : "DND" }
1952 - MouseArea { anchors.fill: parent; onClicked: root.toggleDnd() }
2143 + color: root.theme ? root.theme.withAlpha(root.panelState.dnd ? root.theme.ui.accent : root.theme.ui.minor, root.panelState.dnd ? 0.3 : 0.12) : "transparent"
2144 + NuguText {
2145 + id: dndLabel
2146 + anchors.centerIn: parent
2147 + theme: root.theme
2148 + variant: "meta"
2149 + text: root.panelState.dnd ? "DND on" : "DND"
2151 + MouseArea {
2152 + anchors.fill: parent
2153 + onClicked: root.toggleDnd()
1954 2156 Rectangle {
1955 2157 width: clearLabel.implicitWidth + 18
1956 2158 height: 24
1957 2159 radius: 8
1958 - visible: (root.state.activeCount || 0) > 0
2160 + visible: (root.panelState.activeCount || 0) > 0
1959 2161 color: clearArea.containsMouse && root.theme ? root.theme.withAlpha(root.theme.error, 0.24) : (root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.12) : "transparent")
1960 - NuguText { id: clearLabel; anchors.centerIn: parent; theme: root.theme; variant: "meta"; text: "Clear all" }
1961 - MouseArea { id: clearArea; anchors.fill: parent; hoverEnabled: true; onClicked: root.clearAll() }
2162 + NuguText {
2163 + id: clearLabel
2164 + anchors.centerIn: parent
2165 + theme: root.theme
2166 + variant: "meta"
2167 + text: "Clear all"
2169 + MouseArea {
2170 + id: clearArea
2171 + anchors.fill: parent
2172 + hoverEnabled: true
2173 + onClicked: root.clearAll()
1992 2205 Column {
1993 2206 anchors.centerIn: parent
1994 2207 spacing: 8
1995 - NuguText { anchors.horizontalCenter: parent.horizontalCenter; theme: root.theme; variant: "title"; text: "No notifications" }
1996 - NuguText { anchors.horizontalCenter: parent.horizontalCenter; theme: root.theme; variant: "meta"; text: "You're all caught up" }
2208 + NuguText {
2209 + anchors.horizontalCenter: parent.horizontalCenter
2210 + theme: root.theme
2211 + variant: "title"
2212 + text: "No notifications"
2214 + NuguText {
2215 + anchors.horizontalCenter: parent.horizontalCenter
2216 + theme: root.theme
2217 + variant: "meta"
2218 + text: "You're all caught up"
2005 2228 width: root.width
2006 2229 spacing: 6
2008 - // collapsible group header: an obvious interactive pill with a
2009 - // hover background and an explicit "Show N more" / "Show less"
2010 - // label so the collapse affordance reads as a button, not decor.
2011 - Rectangle {
2012 - id: groupHeader
2013 - width: parent.width
2014 - height: (groupDelegate.modelData.count || 0) > 1 ? 26 : 0
2015 - visible: (groupDelegate.modelData.count || 0) > 1
2016 - radius: 8
2017 - color: grpArea.containsMouse && root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.16) : "transparent"
2018 - Behavior on color { ColorAnimation { duration: root.theme && root.theme.lowPowerMode ? 0 : 120 } }
2019 - Row {
2020 - anchors.left: parent.left
2021 - anchors.leftMargin: 8
2022 - anchors.verticalCenter: parent.verticalCenter
2023 - spacing: 6
2024 - NuguText { theme: root.theme; variant: "meta"; text: groupDelegate.modelData.appName || "" }
2025 - NuguText { theme: root.theme; variant: "meta"; text: `· ${groupDelegate.modelData.count}` }
2027 - Row {
2028 - anchors.right: parent.right
2029 - anchors.rightMargin: 8
2030 - anchors.verticalCenter: parent.verticalCenter
2031 - spacing: 4
2032 - NuguText {
2033 - theme: root.theme
2034 - variant: "meta"
2035 - opacity: grpArea.containsMouse ? 1 : 0.7
2036 - text: groupDelegate.modelData.expanded ? "Show less" : `Show ${Math.max(1, (groupDelegate.modelData.count || 1) - (groupDelegate.modelData.previewCount || 1))} more`
2038 - NuguText {
2039 - theme: root.theme
2040 - variant: "mono"
2041 - opacity: grpArea.containsMouse ? 1 : 0.7
2042 - text: groupDelegate.modelData.expanded ? "⌃" : "⌄"
2045 - MouseArea { id: grpArea; anchors.fill: parent; hoverEnabled: true; onClicked: root.toggleGroup(groupDelegate.modelData.appName || "") }
2231 + // collapsible group header: an obvious interactive pill with a
2232 + // hover background and an explicit "Show N more" / "Show less"
2233 + // label so the collapse affordance reads as a button, not decor.
2234 + Rectangle {
2235 + id: groupHeader
2236 + width: parent.width
2237 + height: (groupDelegate.modelData.count || 0) > 1 ? 26 : 0
2238 + visible: (groupDelegate.modelData.count || 0) > 1
2239 + radius: 8
2240 + color: grpArea.containsMouse && root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.16) : "transparent"
2241 + Behavior on color {
2242 + ColorAnimation {
2243 + duration: root.theme && root.theme.lowPowerMode ? 0 : 120
2246 + Row {
2247 + anchors.left: parent.left
2248 + anchors.leftMargin: 8
2249 + anchors.verticalCenter: parent.verticalCenter
2250 + spacing: 6
2251 + NuguText {
2252 + theme: root.theme
2253 + variant: "meta"
2254 + text: groupDelegate.modelData.appName || ""
2256 + NuguText {
2257 + theme: root.theme
2258 + variant: "meta"
2259 + text: `· ${groupDelegate.modelData.count}`
2262 + Row {
2263 + anchors.right: parent.right
2264 + anchors.rightMargin: 8
2265 + anchors.verticalCenter: parent.verticalCenter
2266 + spacing: 4
2267 + NuguText {
2268 + theme: root.theme
2269 + variant: "meta"
2270 + opacity: grpArea.containsMouse ? 1 : 0.7
2271 + text: groupDelegate.modelData.expanded ? "Show less" : `Show ${Math.max(1, (groupDelegate.modelData.count || 1) - (groupDelegate.modelData.previewCount || 1))} more`
2273 + NuguText {
2274 + theme: root.theme
2275 + variant: "mono"
2276 + opacity: grpArea.containsMouse ? 1 : 0.7
2277 + text: groupDelegate.modelData.expanded ? "⌃" : "⌄"
2280 + MouseArea {
2281 + id: grpArea
2282 + anchors.fill: parent
2283 + hoverEnabled: true
2284 + onClicked: root.toggleGroup(groupDelegate.modelData.appName || "")
2048 - Repeater {
2049 - model: groupDelegate.modelData.visibleNotifications || []
2050 - delegate: Item {
2051 - id: cardWrap
2052 - required property var modelData
2053 - width: root.width
2054 - implicitHeight: cardInner.implicitHeight
2055 - height: implicitHeight
2056 - NotificationCard {
2057 - id: cardInner
2058 - width: parent.width
2059 - theme: root.theme
2060 - modelData: cardWrap.modelData
2061 - onDismiss: (id) => root.runAction(id, "close")
2062 - onInvokeAction: (id, actionId) => root.runAction(id, actionId)
2063 - onSendReply: (id, text) => root.sendReply(id, text)
2288 + Repeater {
2289 + model: groupDelegate.modelData.visibleNotifications || []
2290 + delegate: Item {
2291 + id: cardWrap
2292 + required property var modelData
2293 + width: root.width
2294 + implicitHeight: cardInner.implicitHeight
2295 + height: implicitHeight
2296 + NotificationCard {
2297 + id: cardInner
2298 + width: parent.width
2299 + theme: root.theme
2300 + modelData: cardWrap.modelData
2301 + onDismiss: id => root.runAction(id, "close")
2302 + onInvokeAction: (id, actionId) => root.runAction(id, actionId)
2303 + onSendReply: (id, text) => root.sendReply(id, text)
2072 2312 // slim scroll indicator, overlaid (outside the Flickable so it
2073 2313 // doesn't scroll with content); shown only when content overflows.
2096 2336 onActiveChanged: {
2097 2337 if (active)
2098 2338 shake.restart();
2156 2395 duration: root.theme && root.theme.lowPowerMode ? 0 : 30
2157 2396 easing.type: Easing.OutCubic
2162 2400 transform: Translate {
2170 2407 component ClipboardPanel: Column {
2171 2408 id: root
2173 - required property QtObject theme
2174 - required property QtObject clipboardService
2410 + required property Theme theme
2411 + required property Clipboard clipboardService
2175 2412 property string query: ""
2176 - property var state: clipboardService ? Util.parseJson(clipboardService.stateJson(), {
2413 + property var panelState: clipboardService ? Util.parseJson(clipboardService.stateJson(), {
2177 2414 "rows": [],
2178 2415 "privateMode": false,
2179 2416 "privateRole": "ui.accent",
2180 - "lastAction": {
2417 + "lastAction": {}
2182 2418 }) : ({
2183 - "rows": [],
2184 - "privateMode": false,
2185 - "privateRole": "ui.accent",
2186 - "lastAction": {
2188 - })
2189 - readonly property var rows: state.rows || []
2419 + "rows": [],
2420 + "privateMode": false,
2421 + "privateRole": "ui.accent",
2422 + "lastAction": {}
2423 + })
2424 + readonly property var rows: panelState.rows || []
2192 2426 function refreshFrom(text) {
2193 - state = Util.parseJson(text, state);
2427 + panelState = Util.parseJson(text, panelState);
2196 2430 function search(text) {
2197 2431 query = String(text);
2198 2432 if (clipboardService)
2199 2433 refreshFrom(clipboardService.search(query));
2203 2436 function copy(id) {
2204 2437 if (clipboardService)
2205 2438 refreshFrom(clipboardService.copy(id));
2209 2441 function paste(id) {
2210 2442 if (clipboardService)
2211 2443 refreshFrom(clipboardService.paste(id));
2215 2446 function togglePin(id) {
2216 2447 if (clipboardService)
2217 2448 refreshFrom(clipboardService.togglePin(id));
2221 2451 function deleteRow(id) {
2222 2452 if (clipboardService)
2223 2453 refreshFrom(clipboardService.deleteRow(id));
2227 2456 function setPrivateMode(enabled) {
2228 2457 if (clipboardService)
2229 2458 refreshFrom(clipboardService.setPrivateMode(enabled));
2233 2461 spacing: 10
2284 2512 variant: "meta"
2285 2513 text: "search clipboard"
2290 2517 Rectangle {
2292 2519 width: 100
2293 2520 height: 32
2294 2521 radius: 12
2295 - color: root.theme ? root.theme.withAlpha(root.state.privateMode ? root.theme.warning : root.theme.ui.accent, 0.2) : "transparent"
2522 + color: root.theme ? root.theme.withAlpha(root.panelState.privateMode ? root.theme.warning : root.theme.ui.accent, 0.2) : "transparent"
2296 2523 border.width: 0
2297 - border.color: root.theme ? (root.state.privateMode ? root.theme.warning : root.theme.ui.accent) : "transparent"
2524 + border.color: root.theme ? (root.panelState.privateMode ? root.theme.warning : root.theme.ui.accent) : "transparent"
2300 2527 anchors.centerIn: parent
2304 2531 anchors.verticalCenter: parent.verticalCenter
2305 - text: root.state.privateMode ? "" : ""
2306 - color: root.theme ? (root.state.privateMode ? root.theme.warning : root.theme.ui.accent) : "white"
2532 + text: root.panelState.privateMode ? "" : ""
2533 + color: root.theme ? (root.panelState.privateMode ? root.theme.warning : root.theme.ui.accent) : "white"
2307 2534 font.family: "Symbols Nerd Font Mono"
2308 2535 font.pixelSize: 13
2312 2539 anchors.verticalCenter: parent.verticalCenter
2313 2540 theme: root.theme
2314 2541 variant: "meta"
2315 - text: root.state.privateMode ? "private" : "normal"
2542 + text: root.panelState.privateMode ? "private" : "normal"
2320 2546 MouseArea {
2321 2547 anchors.fill: parent
2322 - onClicked: root.setPrivateMode(!root.state.privateMode)
2548 + onClicked: root.setPrivateMode(!root.panelState.privateMode)
2329 2553 Rectangle {
2425 2649 font.family: "Symbols Nerd Font Mono"
2426 2650 font.pixelSize: 18
2431 2654 Column {
2450 2673 width: parent.width
2451 2674 elide: Text.ElideRight
2456 2678 // Pin badge, hidden while the action rail is revealed.
2483 2705 duration: root.theme && root.theme.lowPowerMode ? 0 : 120
2484 2706 easing.type: Easing.OutCubic
2489 2710 Repeater {
2527 2748 root.deleteRow(clipRow.modelData.id);
2549 2761 component BrightnessPanel: Column {
2550 2762 id: root
2552 - required property QtObject theme
2553 - required property QtObject brightnessService
2554 - property var state: brightnessService ? Util.parseJson(brightnessService.stateJson(), {
2764 + required property Theme theme
2765 + required property Brightness brightnessService
2766 + property var panelState: brightnessService ? Util.parseJson(brightnessService.stateJson(), {
2555 2767 "level": 0,
2556 2768 "compact": {
2557 2769 "label": "Bright",
2558 2770 "role": "ui.accent"
2560 2772 }) : ({
2561 - "level": 0,
2562 - "compact": {
2563 - "label": "Bright",
2564 - "role": "ui.accent"
2566 - })
2773 + "level": 0,
2774 + "compact": {
2775 + "label": "Bright",
2776 + "role": "ui.accent"
2778 + })
2568 - readonly property real level: Math.max(0, Math.min(1, Number(root.state.level || 0)))
2780 + readonly property real level: Math.max(0, Math.min(1, Number(root.panelState.level || 0)))
2569 2781 function roleColor(role) {
2570 2782 if (!root.theme)
2571 2783 return "white";
2576 2788 return root.theme.ui.accent;
2578 2790 function applyAt(x, width) {
2579 - root.state = Util.parseJson(root.brightnessService.setLevel(Math.max(0, Math.min(1, x / width))), root.state);
2791 + root.panelState = Util.parseJson(root.brightnessService.setLevel(Math.max(0, Math.min(1, x / width))), root.panelState);
2582 2794 spacing: 12
2598 2810 anchors.margins: 2
2599 2811 width: Math.max(0, (parent.width - 4) * root.level)
2600 2812 radius: parent.radius - 2
2601 - color: root.theme ? root.theme.withAlpha(root.roleColor(root.state.compact ? root.state.compact.role : "ui.accent"), 0.6) : "white"
2813 + color: root.theme ? root.theme.withAlpha(root.roleColor(root.panelState.compact ? root.panelState.compact.role : "ui.accent"), 0.6) : "white"
2612 2824 MouseArea {
2613 2825 anchors.fill: parent
2614 2826 onPressed: mouse => root.applyAt(mouse.x, width)
2615 - onPositionChanged: mouse => { if (pressed) root.applyAt(mouse.x, width); }
2827 + onPositionChanged: mouse => {
2828 + if (pressed)
2829 + root.applyAt(mouse.x, width);
2645 2859 MouseArea {
2646 2860 anchors.fill: parent
2647 - onClicked: root.state = Util.parseJson(root.brightnessService.setLevel(parent.modelData), root.state)
2861 + onClicked: root.panelState = Util.parseJson(root.brightnessService.setLevel(parent.modelData), root.panelState)
2658 2868 component ConnectivityPanel: Column {
2659 2869 id: root
2661 - required property QtObject theme
2662 - required property QtObject resourceService
2663 - required property QtObject networkService
2664 - required property QtObject bluetoothService
2871 + required property Theme theme
2872 + required property Resources resourceService
2873 + required property Network networkService
2874 + required property Bluetooth bluetoothService
2665 2875 property var networkState: networkService ? Util.parseJson(networkService.stateJson(), {
2666 2876 "networks": [],
2667 2877 "knownNetworks": [],
2668 - "wifi": {
2669 - },
2670 - "compact": {
2878 + "wifi": {},
2879 + "compact": {}
2672 2880 }) : ({
2673 - "networks": [],
2674 - "knownNetworks": [],
2675 - "wifi": {
2676 - },
2677 - "compact": {
2679 - })
2881 + "networks": [],
2882 + "knownNetworks": [],
2883 + "wifi": {},
2884 + "compact": {}
2885 + })
2680 2886 property var bluetoothState: bluetoothService ? Util.parseJson(bluetoothService.stateJson(), {
2681 2887 "devices": [],
2682 - "adapter": {
2888 + "adapter": {}
2684 2889 }) : ({
2685 - "devices": [],
2686 - "adapter": {
2688 - })
2890 + "devices": [],
2891 + "adapter": {}
2892 + })
2689 2893 // ssid whose inline passphrase field is currently revealed ("" = none).
2690 2894 // Holds only an ssid (not a secret); the passphrase lives solely in the
2691 2895 // TextInput.text and is cleared on submit, never bound into networkState.
2702 2906 function toggleWifi() {
2703 2907 if (networkService)
2704 2908 refreshNetwork(networkService.toggleWifi(!(networkState.wifi && networkState.wifi.enabled)));
2708 2911 function scanWifi() {
2709 2912 if (networkService)
2710 2913 refreshNetwork(networkService.scan());
2714 2916 function selectNetwork(id) {
2715 2917 if (networkService)
2716 2918 refreshNetwork(networkService.select(id));
2720 2921 function forgetNetwork(id) {
2721 2922 if (networkService)
2722 2923 refreshNetwork(networkService.forget(id));
2726 2926 // Secured-connect for a new network: connect(ssid, passphrase) is the
2729 2929 function connectSecured(ssid, passphrase) {
2730 2930 if (networkService)
2731 2931 refreshNetwork(networkService.connect(ssid, passphrase));
2735 2934 function disconnectNetwork() {
2736 2935 if (networkService)
2737 2936 refreshNetwork(networkService.disconnect());
2741 2939 // Toggle a row's detail drawer. Opening the CONNECTED row triggers a
2745 2943 expandedSsid = willOpen ? row.ssid : "";
2746 2944 if (willOpen && row.connected && networkService)
2747 2945 refreshNetwork(networkService.diagnostics());
2751 2948 function toggleBluetooth() {
2752 2949 if (bluetoothService)
2753 2950 refreshBluetooth(bluetoothService.toggle(!(bluetoothState.adapter && bluetoothState.adapter.state === "powered")));
2757 2953 function scanBluetooth() {
2758 2954 if (bluetoothService)
2759 2955 refreshBluetooth(bluetoothService.scan());
2763 2958 function bluetoothAction(kind, id) {
2764 2959 if (bluetoothService)
2765 2960 refreshBluetooth(bluetoothService.deviceAction(kind, id));
2769 2963 function roleColor(role) {
2797 2991 function onRefreshed() {
2798 2992 if (root.networkService)
2799 2993 root.refreshNetwork(root.networkService.stateJson());
2814 3007 boundsBehavior: Flickable.StopAtBounds
2815 3008 flickableDirection: Flickable.VerticalFlick
2817 - Column {
2818 - id: panelCol
2820 - width: parent.width
2821 - spacing: 10
2823 - Row {
2824 - objectName: "networkRateRow"
2825 - width: parent.width
2826 - spacing: 8
2828 - NuguText {
2829 - theme: root.theme
2830 - text: root.resourceService ? `↓ ${Sys.formatRate(root.resourceService.networkRxRate)}` : "↓ 0 B/s"
2831 - color: root.theme ? root.theme.ui.accent : "white"
2834 - NuguText {
2835 - theme: root.theme
2836 - text: root.resourceService ? `↑ ${Sys.formatRate(root.resourceService.networkTxRate)}` : "↑ 0 B/s"
2837 - color: root.theme ? root.theme.ui.focus : "white"
2842 - Column {
2843 - objectName: "wifiToggleScanList"
2844 - width: parent.width
2845 - spacing: 6
2847 - Row {
2848 - width: parent.width
2849 - spacing: 6
2851 - NuguText {
2852 - theme: root.theme
2853 - variant: "title"
2854 - text: "wireless"
2855 - width: parent.width - 132
2858 - Rectangle {
2859 - width: 58
2860 - height: 26
2861 - radius: 9
2862 - color: root.theme ? root.theme.withAlpha(root.networkState.wifi && root.networkState.wifi.enabled ? root.theme.ui.focus : root.theme.ui.minor, 0.22) : "transparent"
2863 - border.width: 0
2864 - border.color: root.roleColor(root.networkState.compact ? root.networkState.compact.role : "ui.minor")
2866 - NuguText {
2867 - anchors.centerIn: parent
2868 - theme: root.theme
2869 - variant: "meta"
2870 - text: root.networkState.wifi && root.networkState.wifi.enabled ? "on" : "off"
2873 - MouseArea {
2874 - anchors.fill: parent
2875 - onClicked: root.toggleWifi()
2880 - Rectangle {
2881 - width: 58
2882 - height: 26
2883 - radius: 9
2884 - color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, root.networkState.scanning ? 0.32 : 0.16) : "transparent"
2885 - border.width: 0
2886 - border.color: root.theme ? root.theme.ui.accent : "transparent"
2888 - NuguText {
2889 - anchors.centerIn: parent
2890 - theme: root.theme
2891 - variant: "meta"
2892 - text: root.networkState.scanning ? "scan…" : "scan"
2895 - MouseArea {
2896 - anchors.fill: parent
2897 - onClicked: root.scanWifi()
2904 3010 Column {
3011 + id: panelCol
2905 3013 width: parent.width
2906 - spacing: 6
3014 + spacing: 10
2908 - Repeater {
2909 - model: root.networkState.networks || []
2911 - delegate: Column {
2912 - id: wifiRow
2914 - required property var modelData
2915 - readonly property bool active: modelData.connected === true
2916 - readonly property bool revealed: root.expandedSsid === modelData.ssid
2917 - readonly property var detail: root.networkState.connectionDetail || ({})
2919 - width: parent.width
2920 - spacing: 4
2922 - // --- washout-fixed card: solid dark base, identity via thin
2923 - // accent bar + border; whole card taps to open its drawer.
2924 - Rectangle {
2925 - width: parent.width
2926 - height: 40
2927 - radius: 12
2928 - color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, wifiRow.active ? 0.82 : 0.55) : "#333333"
2929 - border.width: (wifiRow.active || wifiRow.revealed) ? 2 : 1
2930 - border.color: root.theme ? (wifiRow.active ? root.theme.ui.accent : (wifiRow.modelData.state === "connecting" ? root.roleColor("warning") : (wifiRow.revealed ? root.theme.withAlpha(root.theme.ui.accent, 0.6) : root.theme.withAlpha(root.theme.ui.minor, 0.45)))) : "white"
2932 - // left accent bar — only on the connected network
2933 - Rectangle {
2934 - anchors.left: parent.left
2935 - anchors.top: parent.top
2936 - anchors.bottom: parent.bottom
2937 - anchors.margins: 2
2938 - width: 3
2939 - radius: 2
2940 - color: root.theme ? root.theme.ui.accent : "transparent"
2941 - opacity: wifiRow.active ? 1 : 0
2944 - Text {
2945 - id: wifiGlyph
2947 - anchors.left: parent.left
2948 - anchors.leftMargin: 12
2949 - anchors.verticalCenter: parent.verticalCenter
2950 - font.family: "Symbols Nerd Font Mono"
2951 - font.pixelSize: 18
2952 - text: wifiRow.modelData.signalGlyph || ""
2953 - color: root.roleColor(wifiRow.modelData.signalRole || "ui.minor")
2956 - // chevron hints the row expands; rotates when open
2957 - Text {
2958 - id: wifiChevron
2960 - anchors.right: parent.right
2961 - anchors.rightMargin: 12
2962 - anchors.verticalCenter: parent.verticalCenter
2963 - font.family: "Symbols Nerd Font Mono"
2964 - font.pixelSize: 16
2965 - text: ""
2966 - rotation: wifiRow.revealed ? 90 : 0
2967 - color: root.roleColor(wifiRow.active ? "content.accent" : "ui.minor")
2970 - NuguText {
2971 - id: wifiLabel
2973 - anchors.right: wifiChevron.left
2974 - anchors.rightMargin: 10
2975 - anchors.verticalCenter: parent.verticalCenter
2976 - theme: root.theme
2977 - variant: "meta"
2978 - text: wifiRow.active ? "connected" : (wifiRow.modelData.securityLabel || "")
2979 - color: root.roleColor(wifiRow.active ? "content.accent" : "ui.minor")
2982 - NuguText {
2983 - anchors.left: wifiGlyph.right
2984 - anchors.leftMargin: 10
2985 - anchors.right: wifiLabel.left
2986 - anchors.rightMargin: 10
2987 - anchors.verticalCenter: parent.verticalCenter
2988 - theme: root.theme
2989 - text: wifiRow.modelData.ssid
2990 - elide: Text.ElideRight
2993 - MouseArea {
2994 - anchors.fill: parent
2995 - onClicked: root.expandRow(wifiRow.modelData)
3016 + Row {
3017 + objectName: "networkRateRow"
3018 + width: parent.width
3019 + spacing: 8
3021 + NuguText {
3022 + theme: root.theme
3023 + text: root.resourceService ? `↓ ${Sys.formatRate(root.resourceService.networkRxRate)}` : "↓ 0 B/s"
3024 + color: root.theme ? root.theme.ui.accent : "white"
3000 - // --- detail + actions drawer (revealed on tap) -----------
3001 - Rectangle {
3002 - id: wifiDrawer
3027 + NuguText {
3028 + theme: root.theme
3029 + text: root.resourceService ? `↑ ${Sys.formatRate(root.resourceService.networkTxRate)}` : "↑ 0 B/s"
3030 + color: root.theme ? root.theme.ui.focus : "white"
3004 - visible: wifiRow.revealed
3034 + Column {
3035 + objectName: "wifiToggleScanList"
3036 + width: parent.width
3037 + spacing: 6
3039 + Row {
3005 3040 width: parent.width
3006 - height: visible ? drawerCol.height + 16 : 0
3007 - radius: 10
3008 - color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.55) : "#333333"
3009 - border.width: 1
3010 - border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.4) : "white"
3011 - clip: true
3041 + spacing: 6
3013 - Column {
3014 - id: drawerCol
3043 + NuguText {
3044 + theme: root.theme
3045 + variant: "title"
3046 + text: "wireless"
3047 + width: parent.width - 132
3016 - x: 12
3017 - y: 8
3018 - width: parent.width - 24
3019 - spacing: 6
3050 + Rectangle {
3051 + width: 58
3052 + height: 26
3053 + radius: 9
3054 + color: root.theme ? root.theme.withAlpha(root.networkState.wifi && root.networkState.wifi.enabled ? root.theme.ui.focus : root.theme.ui.minor, 0.22) : "transparent"
3055 + border.width: 0
3056 + border.color: root.roleColor(root.networkState.compact ? root.networkState.compact.role : "ui.minor")
3021 - // signal + security — available for every row
3022 3058 NuguText {
3059 + anchors.centerIn: parent
3023 3060 theme: root.theme
3024 3061 variant: "meta"
3025 - text: {
3026 - const dbm = wifiRow.modelData.signalDbm;
3027 - const sig = (dbm === null || dbm === undefined) ? `${wifiRow.modelData.signal}/4 bars` : `${dbm} dBm`;
3028 - return `${wifiRow.modelData.securityLabel || "Open"} · ${sig}`;
3030 - color: root.theme ? root.theme.content.normal : "white"
3062 + text: root.networkState.wifi && root.networkState.wifi.enabled ? "on" : "off"
3033 - // connected-only BSS detail (StationDiagnostic)
3034 - Column {
3035 - visible: wifiRow.active && !!wifiRow.detail.bssid
3065 + MouseArea {
3066 + anchors.fill: parent
3067 + onClicked: root.toggleWifi()
3071 + Rectangle {
3072 + width: 58
3073 + height: 26
3074 + radius: 9
3075 + color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, root.networkState.scanning ? 0.32 : 0.16) : "transparent"
3076 + border.width: 0
3077 + border.color: root.theme ? root.theme.ui.accent : "transparent"
3079 + NuguText {
3080 + anchors.centerIn: parent
3081 + theme: root.theme
3082 + variant: "meta"
3083 + text: root.networkState.scanning ? "scan…" : "scan"
3086 + MouseArea {
3087 + anchors.fill: parent
3088 + onClicked: root.scanWifi()
3093 + Column {
3094 + width: parent.width
3095 + spacing: 6
3097 + Repeater {
3098 + model: root.networkState.networks || []
3100 + delegate: Column {
3101 + id: wifiRow
3103 + required property var modelData
3104 + readonly property bool active: modelData.connected === true
3105 + readonly property bool revealed: root.expandedSsid === modelData.ssid
3106 + readonly property var detail: root.networkState.connectionDetail || ({})
3036 3108 width: parent.width
3037 - spacing: 2
3039 - NuguText {
3040 - theme: root.theme
3041 - variant: "meta"
3042 - text: `${wifiRow.detail.band || "?"}${wifiRow.detail.channel ? " · ch " + wifiRow.detail.channel : ""}${wifiRow.detail.mode ? " · " + wifiRow.detail.mode : ""}`
3043 - opacity: 0.8
3046 - NuguText {
3047 - theme: root.theme
3048 - variant: "meta"
3049 - visible: !!wifiRow.detail.rxRate || !!wifiRow.detail.txRate
3050 - text: `↓ ${wifiRow.detail.rxRate || "?"} ↑ ${wifiRow.detail.txRate || "?"}`
3051 - opacity: 0.8
3054 - NuguText {
3055 - theme: root.theme
3056 - variant: "meta"
3057 - text: wifiRow.detail.bssid
3058 - opacity: 0.6
3063 - // action pills — hidden when a passphrase is needed
3064 - Row {
3065 - visible: !wifiRow.modelData.needsPassphrase
3066 - spacing: 8
3109 + spacing: 4
3111 + // --- washout-fixed card: solid dark base, identity via thin
3112 + // accent bar + border; whole card taps to open its drawer.
3068 3113 Rectangle {
3069 - visible: !wifiRow.active
3070 - width: 96
3071 - height: 28
3072 - radius: 9
3073 - color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.18) : "transparent"
3074 - border.width: 1
3075 - border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.7) : "white"
3114 + width: parent.width
3115 + height: 40
3116 + radius: 12
3117 + color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, wifiRow.active ? 0.82 : 0.55) : "#333333"
3118 + border.width: (wifiRow.active || wifiRow.revealed) ? 2 : 1
3119 + border.color: root.theme ? (wifiRow.active ? root.theme.ui.accent : (wifiRow.modelData.state === "connecting" ? root.roleColor("warning") : (wifiRow.revealed ? root.theme.withAlpha(root.theme.ui.accent, 0.6) : root.theme.withAlpha(root.theme.ui.minor, 0.45)))) : "white"
3121 + // left accent bar — only on the connected network
3122 + Rectangle {
3123 + anchors.left: parent.left
3124 + anchors.top: parent.top
3125 + anchors.bottom: parent.bottom
3126 + anchors.margins: 2
3127 + width: 3
3128 + radius: 2
3129 + color: root.theme ? root.theme.ui.accent : "transparent"
3130 + opacity: wifiRow.active ? 1 : 0
3133 + Text {
3134 + id: wifiGlyph
3136 + anchors.left: parent.left
3137 + anchors.leftMargin: 12
3138 + anchors.verticalCenter: parent.verticalCenter
3139 + font.family: "Symbols Nerd Font Mono"
3140 + font.pixelSize: 18
3141 + text: wifiRow.modelData.signalGlyph || ""
3142 + color: root.roleColor(wifiRow.modelData.signalRole || "ui.minor")
3145 + // chevron hints the row expands; rotates when open
3146 + Text {
3147 + id: wifiChevron
3149 + anchors.right: parent.right
3150 + anchors.rightMargin: 12
3151 + anchors.verticalCenter: parent.verticalCenter
3152 + font.family: "Symbols Nerd Font Mono"
3153 + font.pixelSize: 16
3154 + text: ""
3155 + rotation: wifiRow.revealed ? 90 : 0
3156 + color: root.roleColor(wifiRow.active ? "content.accent" : "ui.minor")
3077 3159 NuguText {
3078 - anchors.centerIn: parent
3160 + id: wifiLabel
3162 + anchors.right: wifiChevron.left
3163 + anchors.rightMargin: 10
3164 + anchors.verticalCenter: parent.verticalCenter
3079 3165 theme: root.theme
3080 3166 variant: "meta"
3081 - text: "connect"
3167 + text: wifiRow.active ? "connected" : (wifiRow.modelData.securityLabel || "")
3168 + color: root.roleColor(wifiRow.active ? "content.accent" : "ui.minor")
3171 + NuguText {
3172 + anchors.left: wifiGlyph.right
3173 + anchors.leftMargin: 10
3174 + anchors.right: wifiLabel.left
3175 + anchors.rightMargin: 10
3176 + anchors.verticalCenter: parent.verticalCenter
3177 + theme: root.theme
3178 + text: wifiRow.modelData.ssid
3179 + elide: Text.ElideRight
3084 3182 MouseArea {
3085 3183 anchors.fill: parent
3086 - onClicked: {
3087 - root.expandedSsid = "";
3088 - root.selectNetwork(wifiRow.modelData.id);
3184 + onClicked: root.expandRow(wifiRow.modelData)
3188 + // --- detail + actions drawer (revealed on tap) -----------
3094 3189 Rectangle {
3095 - visible: wifiRow.active
3096 - width: 96
3097 - height: 28
3098 - radius: 9
3099 - color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.18) : "transparent"
3190 + id: wifiDrawer
3192 + visible: wifiRow.revealed
3193 + width: parent.width
3194 + height: visible ? drawerCol.height + 16 : 0
3195 + radius: 10
3196 + color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.55) : "#333333"
3100 3197 border.width: 1
3101 - border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.7) : "white"
3103 - NuguText {
3104 - anchors.centerIn: parent
3105 - theme: root.theme
3106 - variant: "meta"
3107 - text: "disconnect"
3110 - MouseArea {
3111 - anchors.fill: parent
3112 - onClicked: {
3113 - root.expandedSsid = "";
3114 - root.disconnectNetwork();
3120 - Rectangle {
3121 - visible: wifiRow.active || wifiRow.modelData.known
3122 - width: 96
3123 - height: 28
3124 - radius: 9
3125 - color: root.theme ? root.theme.withAlpha(root.theme.error, 0.18) : "transparent"
3126 - border.width: 1
3127 - border.color: root.theme ? root.theme.withAlpha(root.theme.error, 0.7) : "white"
3129 - NuguText {
3130 - anchors.centerIn: parent
3131 - theme: root.theme
3132 - variant: "meta"
3133 - text: "forget"
3136 - MouseArea {
3137 - anchors.fill: parent
3138 - onClicked: {
3139 - root.expandedSsid = "";
3140 - root.forgetNetwork(wifiRow.modelData.id);
3148 - // --- inline passphrase entry for a NEW secured network.
3149 - // echoMode Password; text lives only here, cleared on
3150 - // submit, never bound into networkState / any logged field.
3151 - Rectangle {
3152 - id: wifiPpRow
3154 - function submit() {
3155 - root.connectSecured(wifiRow.modelData.ssid, wifiPp.text);
3156 - wifiPp.text = "";
3157 - root.expandedSsid = "";
3160 - visible: wifiRow.modelData.needsPassphrase
3161 - width: parent.width
3162 - height: visible ? 34 : 0
3163 - radius: 10
3164 - color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.7) : "#333333"
3165 - border.width: 1
3166 - border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.6) : "white"
3167 - onVisibleChanged: {
3168 - if (visible && wifiRow.revealed)
3169 - Qt.callLater(function() {
3170 - wifiPp.forceActiveFocus();
3171 - });
3174 - TextInput {
3175 - id: wifiPp
3177 - anchors.left: parent.left
3178 - anchors.leftMargin: 12
3179 - anchors.right: wifiPpConfirm.left
3180 - anchors.rightMargin: 10
3181 - anchors.verticalCenter: parent.verticalCenter
3182 - verticalAlignment: TextInput.AlignVCenter
3183 - color: root.theme ? root.theme.content.normal : "white"
3184 - selectionColor: root.theme ? root.theme.ui.focus : "#ffffff"
3185 - selectedTextColor: root.theme ? root.theme.content.backdrop : "black"
3186 - font.family: "IBM Plex Sans"
3187 - font.pixelSize: 13
3188 - echoMode: TextInput.Password
3198 + border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.4) : "white"
3189 3199 clip: true
3190 - onAccepted: wifiPpRow.submit()
3191 - Keys.onReturnPressed: (event) => {
3192 - event.accepted = true;
3193 - wifiPpRow.submit();
3195 - Keys.onEnterPressed: (event) => {
3196 - event.accepted = true;
3197 - wifiPpRow.submit();
3199 - Keys.onEscapePressed: (event) => {
3200 - event.accepted = true;
3201 - wifiPp.text = "";
3202 - root.expandedSsid = "";
3201 + Column {
3202 + id: drawerCol
3204 + x: 12
3205 + y: 8
3206 + width: parent.width - 24
3207 + spacing: 6
3209 + // signal + security — available for every row
3210 + NuguText {
3211 + theme: root.theme
3212 + variant: "meta"
3213 + text: {
3214 + const dbm = wifiRow.modelData.signalDbm;
3215 + const sig = (dbm === null || dbm === undefined) ? `${wifiRow.modelData.signal}/4 bars` : `${dbm} dBm`;
3216 + return `${wifiRow.modelData.securityLabel || "Open"} · ${sig}`;
3218 + color: root.theme ? root.theme.content.normal : "white"
3221 + // connected-only BSS detail (StationDiagnostic)
3222 + Column {
3223 + visible: wifiRow.active && !!wifiRow.detail.bssid
3224 + width: parent.width
3225 + spacing: 2
3227 + NuguText {
3228 + theme: root.theme
3229 + variant: "meta"
3230 + text: `${wifiRow.detail.band || "?"}${wifiRow.detail.channel ? " · ch " + wifiRow.detail.channel : ""}${wifiRow.detail.mode ? " · " + wifiRow.detail.mode : ""}`
3231 + opacity: 0.8
3234 + NuguText {
3235 + theme: root.theme
3236 + variant: "meta"
3237 + visible: !!wifiRow.detail.rxRate || !!wifiRow.detail.txRate
3238 + text: `↓ ${wifiRow.detail.rxRate || "?"} ↑ ${wifiRow.detail.txRate || "?"}`
3239 + opacity: 0.8
3242 + NuguText {
3243 + theme: root.theme
3244 + variant: "meta"
3245 + text: wifiRow.detail.bssid
3246 + opacity: 0.6
3250 + // action pills — hidden when a passphrase is needed
3251 + Row {
3252 + visible: !wifiRow.modelData.needsPassphrase
3253 + spacing: 8
3255 + Rectangle {
3256 + visible: !wifiRow.active
3257 + width: 96
3258 + height: 28
3259 + radius: 9
3260 + color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.18) : "transparent"
3261 + border.width: 1
3262 + border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.7) : "white"
3264 + NuguText {
3265 + anchors.centerIn: parent
3266 + theme: root.theme
3267 + variant: "meta"
3268 + text: "connect"
3271 + MouseArea {
3272 + anchors.fill: parent
3273 + onClicked: {
3274 + root.expandedSsid = "";
3275 + root.selectNetwork(wifiRow.modelData.id);
3280 + Rectangle {
3281 + visible: wifiRow.active
3282 + width: 96
3283 + height: 28
3284 + radius: 9
3285 + color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.18) : "transparent"
3286 + border.width: 1
3287 + border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.7) : "white"
3289 + NuguText {
3290 + anchors.centerIn: parent
3291 + theme: root.theme
3292 + variant: "meta"
3293 + text: "disconnect"
3296 + MouseArea {
3297 + anchors.fill: parent
3298 + onClicked: {
3299 + root.expandedSsid = "";
3300 + root.disconnectNetwork();
3305 + Rectangle {
3306 + visible: wifiRow.active || wifiRow.modelData.known
3307 + width: 96
3308 + height: 28
3309 + radius: 9
3310 + color: root.theme ? root.theme.withAlpha(root.theme.error, 0.18) : "transparent"
3311 + border.width: 1
3312 + border.color: root.theme ? root.theme.withAlpha(root.theme.error, 0.7) : "white"
3314 + NuguText {
3315 + anchors.centerIn: parent
3316 + theme: root.theme
3317 + variant: "meta"
3318 + text: "forget"
3321 + MouseArea {
3322 + anchors.fill: parent
3323 + onClicked: {
3324 + root.expandedSsid = "";
3325 + root.forgetNetwork(wifiRow.modelData.id);
3331 + // --- inline passphrase entry for a NEW secured network.
3332 + // echoMode Password; text lives only here, cleared on
3333 + // submit, never bound into networkState / any logged field.
3334 + Rectangle {
3335 + id: wifiPpRow
3337 + function submit() {
3338 + root.connectSecured(wifiRow.modelData.ssid, wifiPp.text);
3339 + wifiPp.text = "";
3340 + root.expandedSsid = "";
3343 + visible: wifiRow.modelData.needsPassphrase
3344 + width: parent.width
3345 + height: visible ? 34 : 0
3346 + radius: 10
3347 + color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.7) : "#333333"
3348 + border.width: 1
3349 + border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.6) : "white"
3350 + onVisibleChanged: {
3351 + if (visible && wifiRow.revealed)
3352 + Qt.callLater(function () {
3353 + wifiPp.forceActiveFocus();
3354 + });
3357 + TextInput {
3358 + id: wifiPp
3360 + anchors.left: parent.left
3361 + anchors.leftMargin: 12
3362 + anchors.right: wifiPpConfirm.left
3363 + anchors.rightMargin: 10
3364 + anchors.verticalCenter: parent.verticalCenter
3365 + verticalAlignment: TextInput.AlignVCenter
3366 + color: root.theme ? root.theme.content.normal : "white"
3367 + selectionColor: root.theme ? root.theme.ui.focus : "#ffffff"
3368 + selectedTextColor: root.theme ? root.theme.content.backdrop : "black"
3369 + font.family: "IBM Plex Sans"
3370 + font.pixelSize: 13
3371 + echoMode: TextInput.Password
3372 + clip: true
3373 + onAccepted: wifiPpRow.submit()
3374 + Keys.onReturnPressed: event => {
3375 + event.accepted = true;
3376 + wifiPpRow.submit();
3378 + Keys.onEnterPressed: event => {
3379 + event.accepted = true;
3380 + wifiPpRow.submit();
3382 + Keys.onEscapePressed: event => {
3383 + event.accepted = true;
3384 + wifiPp.text = "";
3385 + root.expandedSsid = "";
3389 + NuguText {
3390 + anchors.left: parent.left
3391 + anchors.leftMargin: 12
3392 + anchors.verticalCenter: parent.verticalCenter
3393 + visible: wifiPp.text.length === 0
3394 + theme: root.theme
3395 + variant: "meta"
3396 + text: "passphrase"
3397 + opacity: 0.7
3400 + Rectangle {
3401 + id: wifiPpConfirm
3403 + anchors.right: parent.right
3404 + anchors.rightMargin: 6
3405 + anchors.verticalCenter: parent.verticalCenter
3406 + width: 56
3407 + height: 24
3408 + radius: 8
3409 + color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.22) : "transparent"
3410 + border.width: 1
3411 + border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.7) : "white"
3413 + NuguText {
3414 + anchors.centerIn: parent
3415 + theme: root.theme
3416 + variant: "meta"
3417 + text: "join"
3420 + MouseArea {
3421 + anchors.fill: parent
3422 + onClicked: wifiPpRow.submit()
3432 + NuguText {
3433 + visible: !!(root.networkState.wifi && root.networkState.wifi.enabled) && (!root.networkState.networks || root.networkState.networks.length === 0)
3434 + theme: root.theme
3435 + variant: "meta"
3436 + text: root.networkState.scanning ? "scanning…" : "no networks"
3437 + opacity: 0.7
3441 + Rectangle {
3442 + width: parent.width
3443 + height: 1
3444 + color: root.theme ? root.theme.ui.accent : "transparent"
3447 + Column {
3448 + objectName: "bluetoothToggleScanList"
3449 + width: parent.width
3450 + spacing: 6
3452 + Row {
3453 + width: parent.width
3454 + spacing: 6
3456 + NuguText {
3457 + theme: root.theme
3458 + variant: "title"
3459 + text: "bluetooth"
3460 + width: parent.width - 132
3463 + Rectangle {
3464 + width: 58
3465 + height: 26
3466 + radius: 9
3467 + 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"
3468 + border.width: 0
3469 + border.color: root.roleColor(root.bluetoothState.compact ? root.bluetoothState.compact.role : "ui.minor")
3471 + NuguText {
3472 + anchors.centerIn: parent
3473 + theme: root.theme
3474 + variant: "meta"
3475 + text: root.bluetoothState.adapter && root.bluetoothState.adapter.state === "powered" ? "on" : "off"
3478 + MouseArea {
3479 + anchors.fill: parent
3480 + onClicked: root.toggleBluetooth()
3484 + Rectangle {
3485 + width: 58
3486 + height: 26
3487 + radius: 9
3488 + color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, root.bluetoothState.adapter && root.bluetoothState.adapter.discovering ? 0.32 : 0.16) : "transparent"
3489 + border.width: 0
3490 + border.color: root.theme ? root.theme.ui.accent : "transparent"
3492 + NuguText {
3493 + anchors.centerIn: parent
3494 + theme: root.theme
3495 + variant: "meta"
3496 + text: root.bluetoothState.adapter && root.bluetoothState.adapter.discovering ? "scan…" : "scan"
3499 + MouseArea {
3500 + anchors.fill: parent
3501 + onClicked: root.scanBluetooth()
3506 + Column {
3507 + width: parent.width
3508 + spacing: 6
3510 + Repeater {
3511 + model: root.bluetoothState.devices || []
3513 + delegate: Rectangle {
3514 + id: deviceRow
3516 + required property var modelData
3518 + width: root.width
3519 + height: 36
3520 + radius: 10
3521 + color: root.theme ? root.theme.withAlpha(modelData.connected ? root.theme.ui.focus : root.theme.ui.minor, modelData.connected ? 0.24 : 0.1) : "transparent"
3522 + border.width: 0
3523 + border.color: root.roleColor(modelData.blocked ? "error" : modelData.connected ? "ui.accent" : "ui.minor")
3206 3525 NuguText {
3207 3526 anchors.left: parent.left
3208 - anchors.leftMargin: 12
3527 + anchors.leftMargin: 8
3528 + anchors.verticalCenter: parent.verticalCenter
3529 + theme: root.theme
3530 + text: deviceRow.modelData.name
3531 + width: parent.width - 136
3532 + elide: Text.ElideRight
3535 + NuguText {
3536 + objectName: "batteryBadges"
3537 + anchors.right: parent.right
3538 + anchors.rightMargin: 8
3209 3539 anchors.verticalCenter: parent.verticalCenter
3210 - visible: wifiPp.text.length === 0
3211 3540 theme: root.theme
3212 3541 variant: "meta"
3213 - text: "passphrase"
3214 - opacity: 0.7
3542 + text: deviceRow.modelData.battery >= 0 ? `${deviceRow.modelData.battery}%` : "--"
3217 - Rectangle {
3218 - id: wifiPpConfirm
3220 - anchors.right: parent.right
3221 - anchors.rightMargin: 6
3222 - anchors.verticalCenter: parent.verticalCenter
3223 - width: 56
3224 - height: 24
3225 - radius: 8
3226 - color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.22) : "transparent"
3227 - border.width: 1
3228 - border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.7) : "white"
3230 - NuguText {
3231 - anchors.centerIn: parent
3232 - theme: root.theme
3233 - variant: "meta"
3234 - text: "join"
3545 + MouseArea {
3546 + anchors.fill: parent
3547 + acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
3548 + onClicked: event => {
3549 + if (event.button === Qt.MiddleButton)
3550 + root.bluetoothAction("forget", deviceRow.modelData.id);
3551 + else if (event.button === Qt.RightButton)
3552 + root.bluetoothAction(deviceRow.modelData.trusted ? "block" : "trust", deviceRow.modelData.id);
3553 + else
3554 + root.bluetoothAction(deviceRow.modelData.connected ? "disconnect" : "connect", deviceRow.modelData.id);
3237 - MouseArea {
3238 - anchors.fill: parent
3239 - onClicked: wifiPpRow.submit()
3256 - NuguText {
3257 - visible: !!(root.networkState.wifi && root.networkState.wifi.enabled) && (!root.networkState.networks || root.networkState.networks.length === 0)
3258 - theme: root.theme
3259 - variant: "meta"
3260 - text: root.networkState.scanning ? "scanning…" : "no networks"
3261 - opacity: 0.7
3266 - Rectangle {
3267 - width: parent.width
3268 - height: 1
3269 - color: root.theme ? root.theme.ui.accent : "transparent"
3272 - Column {
3273 - objectName: "bluetoothToggleScanList"
3274 - width: parent.width
3275 - spacing: 6
3277 - Row {
3278 - width: parent.width
3279 - spacing: 6
3281 - NuguText {
3282 - theme: root.theme
3283 - variant: "title"
3284 - text: "bluetooth"
3285 - width: parent.width - 132
3288 - Rectangle {
3289 - width: 58
3290 - height: 26
3291 - radius: 9
3292 - 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"
3293 - border.width: 0
3294 - border.color: root.roleColor(root.bluetoothState.compact ? root.bluetoothState.compact.role : "ui.minor")
3296 - NuguText {
3297 - anchors.centerIn: parent
3298 - theme: root.theme
3299 - variant: "meta"
3300 - text: root.bluetoothState.adapter && root.bluetoothState.adapter.state === "powered" ? "on" : "off"
3303 - MouseArea {
3304 - anchors.fill: parent
3305 - onClicked: root.toggleBluetooth()
3310 - Rectangle {
3311 - width: 58
3312 - height: 26
3313 - radius: 9
3314 - color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, root.bluetoothState.adapter && root.bluetoothState.adapter.discovering ? 0.32 : 0.16) : "transparent"
3315 - border.width: 0
3316 - border.color: root.theme ? root.theme.ui.accent : "transparent"
3318 - NuguText {
3319 - anchors.centerIn: parent
3320 - theme: root.theme
3321 - variant: "meta"
3322 - text: root.bluetoothState.adapter && root.bluetoothState.adapter.discovering ? "scan…" : "scan"
3325 - MouseArea {
3326 - anchors.fill: parent
3327 - onClicked: root.scanBluetooth()
3334 - Column {
3335 - width: parent.width
3336 - spacing: 6
3338 - Repeater {
3339 - model: root.bluetoothState.devices || []
3341 - delegate: Rectangle {
3342 - id: deviceRow
3344 - required property var modelData
3346 - width: root.width
3347 - height: 36
3348 - radius: 10
3349 - color: root.theme ? root.theme.withAlpha(modelData.connected ? root.theme.ui.focus : root.theme.ui.minor, modelData.connected ? 0.24 : 0.1) : "transparent"
3350 - border.width: 0
3351 - border.color: root.roleColor(modelData.blocked ? "error" : modelData.connected ? "ui.accent" : "ui.minor")
3353 - NuguText {
3354 - anchors.left: parent.left
3355 - anchors.leftMargin: 8
3356 - anchors.verticalCenter: parent.verticalCenter
3357 - theme: root.theme
3358 - text: deviceRow.modelData.name
3359 - width: parent.width - 136
3360 - elide: Text.ElideRight
3363 - NuguText {
3364 - objectName: "batteryBadges"
3365 - anchors.right: parent.right
3366 - anchors.rightMargin: 8
3367 - anchors.verticalCenter: parent.verticalCenter
3368 - theme: root.theme
3369 - variant: "meta"
3370 - text: deviceRow.modelData.battery >= 0 ? `${deviceRow.modelData.battery}%` : "--"
3373 - MouseArea {
3374 - anchors.fill: parent
3375 - acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
3376 - onClicked: (event) => {
3377 - if (event.button === Qt.MiddleButton)
3378 - root.bluetoothAction("forget", deviceRow.modelData.id);
3379 - else if (event.button === Qt.RightButton)
3380 - root.bluetoothAction(deviceRow.modelData.trusted ? "block" : "trust", deviceRow.modelData.id);
3381 - else
3382 - root.bluetoothAction(deviceRow.modelData.connected ? "disconnect" : "connect", deviceRow.modelData.id);
3400 3565 component TrayPanel: Column {
3401 3566 id: root
3403 - required property QtObject theme
3404 - required property QtObject trayService
3405 - property var state: trayService ? Util.parseJson(trayService.stateJson(), {
3568 + required property Theme theme
3569 + required property Tray trayService
3570 + property var panelState: trayService ? Util.parseJson(trayService.stateJson(), {
3406 3571 "items": []
3407 3572 }) : ({
3408 - "items": []
3409 - })
3410 - readonly property var items: state.items || []
3573 + "items": []
3574 + })
3575 + readonly property var items: panelState.items || []
3411 3576 readonly property bool hasItems: items.length > 0
3413 3578 function refreshFrom(text) {
3414 - state = Util.parseJson(text, state);
3579 + panelState = Util.parseJson(text, panelState);
3417 3582 function activate(id) {
3418 3583 if (trayService)
3419 3584 refreshFrom(trayService.activateRow(id));
3423 3587 spacing: 10
3471 3635 width: parent.width - 34
3472 3636 elide: Text.ElideRight
3477 3640 MouseArea {
3478 3641 anchors.fill: parent
3479 3642 onClicked: root.activate(itemCell.modelData.id)
3509 3669 selected: true
3510 3670 text: "⌁"
3515 3674 NuguText {
3525 3684 variant: "meta"
3526 3685 text: "Background apps show up here"
3535 3691 component PowerPanel: Column {
3536 3692 id: root
3538 - required property QtObject theme
3539 - required property QtObject powerService
3540 - property var state: powerService ? Util.parseJson(powerService.stateJson(), {
3541 - "battery": {
3542 - },
3694 + required property Theme theme
3695 + required property Power powerService
3696 + property var panelState: powerService ? Util.parseJson(powerService.stateJson(), {
3697 + "battery": {},
3543 3698 "externalDevices": []
3544 3699 }) : ({
3545 - "battery": {
3546 - },
3547 - "externalDevices": []
3548 - })
3549 - readonly property var battery: state.battery || ({
3550 - })
3551 - readonly property var devices: state.externalDevices || []
3552 - readonly property var sessionActions: state.sessionActions || ["lock", "suspend", "monitor-off", "monitor-on", "logout", "reboot", "poweroff"]
3700 + "battery": {},
3701 + "externalDevices": []
3702 + })
3703 + readonly property var battery: panelState.battery || ({})
3704 + readonly property var devices: panelState.externalDevices || []
3705 + readonly property var sessionActions: panelState.sessionActions || ["lock", "suspend", "monitor-off", "monitor-on", "logout", "reboot", "poweroff"]
3555 3707 function refreshFrom(text) {
3556 - state = Util.parseJson(text, state);
3708 + panelState = Util.parseJson(text, panelState);
3559 3711 function runSession(action) {
3560 3712 if (powerService)
3561 3713 refreshFrom(powerService.sessionAction(action));
3565 3716 function confirm(action) {
3566 3717 if (powerService)
3567 3718 refreshFrom(powerService.confirmAction(action));
3571 3721 function cancel() {
3572 3722 if (powerService)
3573 3723 refreshFrom(powerService.cancelAction());
3577 3726 function roleColor(role) {
3607 3756 width: parent ? parent.width : 0
3608 3757 focus: true
3609 3758 Keys.onEscapePressed: root.cancel()
3610 - Keys.onReturnPressed: root.state.pendingConfirmation ? root.confirm(root.state.pendingConfirmation) : root.runSession("lock")
3611 - Keys.onEnterPressed: root.state.pendingConfirmation ? root.confirm(root.state.pendingConfirmation) : root.runSession("lock")
3759 + Keys.onReturnPressed: root.panelState.pendingConfirmation ? root.confirm(root.panelState.pendingConfirmation) : root.runSession("lock")
3760 + Keys.onEnterPressed: root.panelState.pendingConfirmation ? root.confirm(root.panelState.pendingConfirmation) : root.runSession("lock")
3613 3762 Rectangle {
3614 3763 objectName: "batteryHero"
3642 3791 width: 110
3643 3792 horizontalAlignment: Text.AlignRight
3648 3796 Rectangle {
3659 3807 radius: parent.radius
3660 3808 color: root.roleColor(root.battery.role || "ui.accent")
3681 3828 width: 88
3682 3829 horizontalAlignment: Text.AlignRight
3691 3835 Column {
3727 3871 variant: "meta"
3728 3872 text: `${deviceRow.modelData.percent}%`
3751 3892 required property string modelData
3752 3893 readonly property bool destructive: ["logout", "reboot", "poweroff"].indexOf(modelData) >= 0
3753 - readonly property bool pending: root.state.pendingConfirmation === modelData
3894 + readonly property bool pending: root.panelState.pendingConfirmation === modelData
3755 3896 readonly property color accent: root.theme ? (pending ? root.theme.warning : destructive ? root.theme.error : root.theme.ui.accent) : "transparent"
3756 3897 width: Math.floor((root.width - 18) / 4)
3772 3913 anchors.fill: parent
3773 3914 onClicked: root.runSession(actionButton.modelData)
3782 3920 Rectangle {
3783 3921 objectName: "confirmationStrip"
3784 3922 width: parent.width
3785 - height: root.state.pendingConfirmation ? 36 : 26
3923 + height: root.panelState.pendingConfirmation ? 36 : 26
3786 3924 radius: 11
3787 3925 color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.55) : "transparent"
3788 3926 border.width: 1
3789 - border.color: root.theme ? root.theme.withAlpha(root.state.pendingConfirmation ? root.theme.warning : root.theme.ui.minor, 0.6) : "transparent"
3927 + border.color: root.theme ? root.theme.withAlpha(root.panelState.pendingConfirmation ? root.theme.warning : root.theme.ui.minor, 0.6) : "transparent"
3791 3929 NuguText {
3792 3930 anchors.left: parent.left
3794 3932 anchors.verticalCenter: parent.verticalCenter
3795 3933 theme: root.theme
3796 3934 variant: "meta"
3797 - text: root.state.pendingConfirmation ? `Confirm ${root.state.pendingConfirmation}? · Enter` : "Enter locks · Esc closes"
3798 - width: parent.width - (root.state.pendingConfirmation ? 128 : 16)
3935 + text: root.panelState.pendingConfirmation ? `Confirm ${root.panelState.pendingConfirmation}? · Enter` : "Enter locks · Esc closes"
3936 + width: parent.width - (root.panelState.pendingConfirmation ? 128 : 16)
3799 3937 elide: Text.ElideRight
3804 3942 anchors.rightMargin: 6
3805 3943 anchors.verticalCenter: parent.verticalCenter
3806 3944 spacing: 5
3807 - visible: !!root.state.pendingConfirmation
3945 + visible: !!root.panelState.pendingConfirmation
3809 3947 Rectangle {
3810 3948 width: 56
3824 3962 MouseArea {
3825 3963 anchors.fill: parent
3826 - onClicked: root.confirm(root.state.pendingConfirmation)
3964 + onClicked: root.confirm(root.panelState.pendingConfirmation)
3831 3968 Rectangle {
3847 3984 anchors.fill: parent
3848 3985 onClicked: root.cancel()
3859 3992 component AudioPanel: Column {
3860 3993 id: root
3862 - required property QtObject theme
3863 - required property QtObject audioService
3864 - property var state: audioService ? Util.parseJson(audioService.stateJson(), {
3995 + required property Theme theme
3996 + required property Audio audioService
3997 + property var panelState: audioService ? Util.parseJson(audioService.stateJson(), {
3865 3998 "sinks": [],
3866 3999 "sources": [],
3867 4000 "streams": [],
3868 - "defaults": {
4001 + "defaults": {}
3870 4002 }) : ({
3871 - "sinks": [],
3872 - "sources": [],
3873 - "streams": [],
3874 - "defaults": {
3876 - })
3877 - readonly property var sinks: state.sinks || []
3878 - readonly property var sources: state.sources || []
3879 - readonly property var streams: state.streams || []
4003 + "sinks": [],
4004 + "sources": [],
4005 + "streams": [],
4006 + "defaults": {}
4007 + })
4008 + readonly property var sinks: panelState.sinks || []
4009 + readonly property var sources: panelState.sources || []
4010 + readonly property var streams: panelState.streams || []
3880 4011 // device id whose options drawer is open ("" = none), per section.
3881 4012 property string expandedSink: ""
3882 4013 property string expandedSource: ""
3885 4015 function refreshFrom(text) {
3886 - state = Util.parseJson(text, state);
4016 + panelState = Util.parseJson(text, panelState);
3889 4019 function setVolume(id, ratio) {
3890 4020 if (audioService)
3891 4021 refreshFrom(audioService.setVolume(id, Math.max(0, Math.min(1.5, ratio))));
3895 4024 function toggleMute(id) {
3896 4025 if (audioService)
3897 4026 refreshFrom(audioService.toggleMute(id));
3901 4029 function selectSink(id) {
3902 4030 if (audioService)
3903 4031 refreshFrom(audioService.setDefaultSink(id));
3907 4034 function selectSource(id) {
3908 4035 if (audioService)
3909 4036 refreshFrom(audioService.setDefaultSource(id));
3913 4039 function roleColor(role) {
3942 4068 boundsBehavior: Flickable.StopAtBounds
3943 4069 flickableDirection: Flickable.VerticalFlick
3945 - Column {
3946 - id: audioCol
3948 - width: parent.width
3949 - spacing: 10
3951 - // output devices (sinks). solid-dark cards — the popup frame is light,
3952 - // so a translucent tint fill washes to near-white. Identity is carried
3953 - // by the left accent bar + border; default = ui.accent.
3954 - Column {
3955 - objectName: "outputSection"
3956 - width: parent.width
3957 - spacing: 6
3959 - NuguText {
3960 - theme: root.theme
3961 - variant: "title"
3962 - text: "output"
3965 4071 Column {
4072 + id: audioCol
3966 4074 width: parent.width
3967 - spacing: 6
4075 + spacing: 10
3969 - Repeater {
3970 - model: root.sinks
3972 - delegate: Column {
3973 - id: sinkRow
3975 - required property var modelData
3976 - readonly property bool revealed: root.expandedSink === modelData.id
3978 - width: parent.width
3979 - spacing: 4
3981 - Rectangle {
4077 + // output devices (sinks). solid-dark cards — the popup frame is light,
4078 + // so a translucent tint fill washes to near-white. Identity is carried
4079 + // by the left accent bar + border; default = ui.accent.
4080 + Column {
4081 + objectName: "outputSection"
3982 4082 width: parent.width
3983 - height: 48
3984 - radius: 12
3985 - color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, sinkRow.modelData.isDefault ? 0.82 : 0.55) : "transparent"
3986 - border.width: (sinkRow.modelData.isDefault || sinkRow.revealed) ? 2 : 1
3987 - border.color: root.theme ? (sinkRow.modelData.isDefault ? root.theme.ui.accent : (sinkRow.revealed ? root.theme.withAlpha(root.theme.ui.accent, 0.6) : root.theme.withAlpha(root.theme.ui.minor, 0.45))) : "transparent"
3989 - // tap the device (glyph/name area) opens its options drawer;
3990 - // the slider-track MouseArea (later sibling, higher z) wins on
3991 - // the track region so dragging volume never opens the drawer.
3992 - MouseArea {
3993 - anchors.fill: parent
3994 - onClicked: root.expandedSink = sinkRow.revealed ? "" : sinkRow.modelData.id
3997 - // left accent bar — only on the default device
3998 - Rectangle {
3999 - anchors.left: parent.left
4000 - anchors.top: parent.top
4001 - anchors.bottom: parent.bottom
4002 - anchors.margins: 2
4003 - width: 3
4004 - radius: 2
4005 - color: root.theme ? root.theme.ui.accent : "transparent"
4006 - opacity: sinkRow.modelData.isDefault ? 1 : 0
4009 - Text {
4010 - id: sinkGlyph
4012 - anchors.left: parent.left
4013 - anchors.leftMargin: 12
4014 - anchors.verticalCenter: parent.verticalCenter
4015 - font.family: "Symbols Nerd Font Mono"
4016 - font.pixelSize: 18
4017 - text: sinkRow.modelData.glyph
4018 - color: root.roleColor(sinkRow.modelData.role)
4019 - opacity: sinkRow.modelData.muted ? 0.5 : 1
4083 + spacing: 6
4022 4085 NuguText {
4023 4086 theme: root.theme
4024 - text: sinkRow.modelData.name
4025 - anchors.left: sinkGlyph.right
4026 - anchors.leftMargin: 10
4027 - anchors.right: sinkTrack.left
4028 - anchors.rightMargin: 10
4029 - anchors.verticalCenter: parent.verticalCenter
4030 - elide: Text.ElideRight
4031 - opacity: sinkRow.modelData.muted ? 0.5 : 1
4087 + variant: "title"
4088 + text: "output"
4034 - NuguText {
4035 - id: sinkTrailing
4037 - anchors.right: parent.right
4038 - anchors.rightMargin: 12
4039 - anchors.verticalCenter: parent.verticalCenter
4040 - theme: root.theme
4041 - variant: "meta"
4042 - text: sinkRow.modelData.muted ? "muted" : `${sinkRow.modelData.percent}%`
4043 - color: root.roleColor(sinkRow.modelData.muted ? "ui.minor" : sinkRow.modelData.role)
4046 - // inline slider: 0..1.5 volume mapped onto the track (percent/150)
4047 - Rectangle {
4048 - id: sinkTrack
4050 - anchors.right: sinkTrailing.left
4051 - anchors.rightMargin: 10
4052 - anchors.verticalCenter: parent.verticalCenter
4053 - width: 96
4054 - height: 8
4055 - radius: 4
4056 - color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.28) : "transparent"
4058 - Rectangle {
4059 - anchors.left: parent.left
4060 - anchors.top: parent.top
4061 - anchors.bottom: parent.bottom
4062 - width: parent.width * (sinkRow.modelData.percent / 150)
4063 - radius: parent.radius
4064 - color: root.roleColor(sinkRow.modelData.role)
4065 - visible: !sinkRow.modelData.muted
4068 - MouseArea {
4069 - anchors.fill: parent
4070 - onClicked: (event) => {
4071 - return root.setVolume(sinkRow.modelData.id, event.x / Math.max(1, width) * 1.5);
4073 - onPositionChanged: (event) => {
4074 - if (pressed)
4075 - root.setVolume(sinkRow.modelData.id, event.x / Math.max(1, width) * 1.5);
4083 - // device options drawer: set-default + mute. PipeWire
4084 - // exposes no port/profile routing, so those aren't offered.
4085 - Rectangle {
4086 - visible: sinkRow.revealed
4091 + Column {
4087 4092 width: parent.width
4088 - height: visible ? sinkOpts.height + 16 : 0
4089 - radius: 10
4090 - color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.55) : "#333333"
4091 - border.width: 1
4092 - border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.4) : "white"
4093 - clip: true
4093 + spacing: 6
4095 - Row {
4096 - id: sinkOpts
4095 + Repeater {
4096 + model: root.sinks
4098 - x: 12
4099 - y: 8
4100 - spacing: 8
4098 + delegate: Column {
4099 + id: sinkRow
4102 - Rectangle {
4103 - visible: !sinkRow.modelData.isDefault
4104 - width: 110
4105 - height: 28
4106 - radius: 9
4107 - color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.18) : "transparent"
4108 - border.width: 1
4109 - border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.7) : "white"
4101 + required property var modelData
4102 + readonly property bool revealed: root.expandedSink === modelData.id
4111 - NuguText {
4112 - anchors.centerIn: parent
4113 - theme: root.theme
4114 - variant: "meta"
4115 - text: "set default"
4104 + width: parent.width
4105 + spacing: 4
4118 - MouseArea {
4119 - anchors.fill: parent
4120 - onClicked: {
4121 - root.expandedSink = "";
4122 - root.selectSink(sinkRow.modelData.id);
4107 + Rectangle {
4108 + width: parent.width
4109 + height: 48
4110 + radius: 12
4111 + color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, sinkRow.modelData.isDefault ? 0.82 : 0.55) : "transparent"
4112 + border.width: (sinkRow.modelData.isDefault || sinkRow.revealed) ? 2 : 1
4113 + border.color: root.theme ? (sinkRow.modelData.isDefault ? root.theme.ui.accent : (sinkRow.revealed ? root.theme.withAlpha(root.theme.ui.accent, 0.6) : root.theme.withAlpha(root.theme.ui.minor, 0.45))) : "transparent"
4115 + // tap the device (glyph/name area) opens its options drawer;
4116 + // the slider-track MouseArea (later sibling, higher z) wins on
4117 + // the track region so dragging volume never opens the drawer.
4118 + MouseArea {
4119 + anchors.fill: parent
4120 + onClicked: root.expandedSink = sinkRow.revealed ? "" : sinkRow.modelData.id
4123 + // left accent bar — only on the default device
4124 + Rectangle {
4125 + anchors.left: parent.left
4126 + anchors.top: parent.top
4127 + anchors.bottom: parent.bottom
4128 + anchors.margins: 2
4129 + width: 3
4130 + radius: 2
4131 + color: root.theme ? root.theme.ui.accent : "transparent"
4132 + opacity: sinkRow.modelData.isDefault ? 1 : 0
4135 + Text {
4136 + id: sinkGlyph
4138 + anchors.left: parent.left
4139 + anchors.leftMargin: 12
4140 + anchors.verticalCenter: parent.verticalCenter
4141 + font.family: "Symbols Nerd Font Mono"
4142 + font.pixelSize: 18
4143 + text: sinkRow.modelData.glyph
4144 + color: root.roleColor(sinkRow.modelData.role)
4145 + opacity: sinkRow.modelData.muted ? 0.5 : 1
4148 + NuguText {
4149 + theme: root.theme
4150 + text: sinkRow.modelData.name
4151 + anchors.left: sinkGlyph.right
4152 + anchors.leftMargin: 10
4153 + anchors.right: sinkTrack.left
4154 + anchors.rightMargin: 10
4155 + anchors.verticalCenter: parent.verticalCenter
4156 + elide: Text.ElideRight
4157 + opacity: sinkRow.modelData.muted ? 0.5 : 1
4160 + NuguText {
4161 + id: sinkTrailing
4163 + anchors.right: parent.right
4164 + anchors.rightMargin: 12
4165 + anchors.verticalCenter: parent.verticalCenter
4166 + theme: root.theme
4167 + variant: "meta"
4168 + text: sinkRow.modelData.muted ? "muted" : `${sinkRow.modelData.percent}%`
4169 + color: root.roleColor(sinkRow.modelData.muted ? "ui.minor" : sinkRow.modelData.role)
4172 + // inline slider: 0..1.5 volume mapped onto the track (percent/150)
4173 + Rectangle {
4174 + id: sinkTrack
4176 + anchors.right: sinkTrailing.left
4177 + anchors.rightMargin: 10
4178 + anchors.verticalCenter: parent.verticalCenter
4179 + width: 96
4180 + height: 8
4181 + radius: 4
4182 + color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.28) : "transparent"
4184 + Rectangle {
4185 + anchors.left: parent.left
4186 + anchors.top: parent.top
4187 + anchors.bottom: parent.bottom
4188 + width: parent.width * (sinkRow.modelData.percent / 150)
4189 + radius: parent.radius
4190 + color: root.roleColor(sinkRow.modelData.role)
4191 + visible: !sinkRow.modelData.muted
4194 + MouseArea {
4195 + anchors.fill: parent
4196 + onClicked: event => {
4197 + return root.setVolume(sinkRow.modelData.id, event.x / Math.max(1, width) * 1.5);
4199 + onPositionChanged: event => {
4200 + if (pressed)
4201 + root.setVolume(sinkRow.modelData.id, event.x / Math.max(1, width) * 1.5);
4207 + // device options drawer: set-default + mute. PipeWire
4208 + // exposes no port/profile routing, so those aren't offered.
4209 + Rectangle {
4210 + visible: sinkRow.revealed
4211 + width: parent.width
4212 + height: visible ? sinkOpts.height + 16 : 0
4213 + radius: 10
4214 + color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.55) : "#333333"
4215 + border.width: 1
4216 + border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.4) : "white"
4217 + clip: true
4128 - Rectangle {
4129 - width: 92
4130 - height: 28
4131 - radius: 9
4132 - color: root.theme ? root.theme.withAlpha(sinkRow.modelData.muted ? root.theme.warning : root.theme.ui.accent, 0.18) : "transparent"
4133 - border.width: 1
4134 - border.color: root.theme ? root.theme.withAlpha(sinkRow.modelData.muted ? root.theme.warning : root.theme.ui.accent, 0.7) : "white"
4219 + Row {
4220 + id: sinkOpts
4136 - NuguText {
4137 - anchors.centerIn: parent
4138 - theme: root.theme
4139 - variant: "meta"
4140 - text: sinkRow.modelData.muted ? "unmute" : "mute"
4222 + x: 12
4223 + y: 8
4224 + spacing: 8
4226 + Rectangle {
4227 + visible: !sinkRow.modelData.isDefault
4228 + width: 110
4229 + height: 28
4230 + radius: 9
4231 + color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.18) : "transparent"
4232 + border.width: 1
4233 + border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.7) : "white"
4235 + NuguText {
4236 + anchors.centerIn: parent
4237 + theme: root.theme
4238 + variant: "meta"
4239 + text: "set default"
4242 + MouseArea {
4243 + anchors.fill: parent
4244 + onClicked: {
4245 + root.expandedSink = "";
4246 + root.selectSink(sinkRow.modelData.id);
4251 + Rectangle {
4252 + width: 92
4253 + height: 28
4254 + radius: 9
4255 + color: root.theme ? root.theme.withAlpha(sinkRow.modelData.muted ? root.theme.warning : root.theme.ui.accent, 0.18) : "transparent"
4256 + border.width: 1
4257 + border.color: root.theme ? root.theme.withAlpha(sinkRow.modelData.muted ? root.theme.warning : root.theme.ui.accent, 0.7) : "white"
4259 + NuguText {
4260 + anchors.centerIn: parent
4261 + theme: root.theme
4262 + variant: "meta"
4263 + text: sinkRow.modelData.muted ? "unmute" : "mute"
4266 + MouseArea {
4267 + anchors.fill: parent
4268 + onClicked: root.toggleMute(sinkRow.modelData.id)
4143 - MouseArea {
4144 - anchors.fill: parent
4145 - onClicked: root.toggleMute(sinkRow.modelData.id)
4162 - // input devices (sources)
4163 - Column {
4164 - objectName: "inputSection"
4165 - width: parent.width
4166 - spacing: 6
4168 - NuguText {
4169 - theme: root.theme
4170 - variant: "title"
4171 - text: "input"
4174 - Column {
4175 - width: parent.width
4176 - spacing: 6
4178 - Repeater {
4179 - model: root.sources
4181 - delegate: Column {
4182 - id: sourceRow
4184 - required property var modelData
4185 - readonly property bool revealed: root.expandedSource === modelData.id
4187 - width: parent.width
4188 - spacing: 4
4190 - Rectangle {
4278 + // input devices (sources)
4279 + Column {
4280 + objectName: "inputSection"
4191 4281 width: parent.width
4192 - height: 48
4193 - radius: 12
4194 - color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, sourceRow.modelData.isDefault ? 0.82 : 0.55) : "transparent"
4195 - border.width: (sourceRow.modelData.isDefault || sourceRow.revealed) ? 2 : 1
4196 - border.color: root.theme ? (sourceRow.modelData.isDefault ? root.theme.ui.accent : (sourceRow.revealed ? root.theme.withAlpha(root.theme.ui.accent, 0.6) : root.theme.withAlpha(root.theme.ui.minor, 0.45))) : "transparent"
4198 - MouseArea {
4199 - anchors.fill: parent
4200 - onClicked: root.expandedSource = sourceRow.revealed ? "" : sourceRow.modelData.id
4203 - Rectangle {
4204 - anchors.left: parent.left
4205 - anchors.top: parent.top
4206 - anchors.bottom: parent.bottom
4207 - anchors.margins: 2
4208 - width: 3
4209 - radius: 2
4210 - color: root.theme ? root.theme.ui.accent : "transparent"
4211 - opacity: sourceRow.modelData.isDefault ? 1 : 0
4214 - Text {
4215 - id: sourceGlyph
4217 - anchors.left: parent.left
4218 - anchors.leftMargin: 12
4219 - anchors.verticalCenter: parent.verticalCenter
4220 - font.family: "Symbols Nerd Font Mono"
4221 - font.pixelSize: 18
4222 - text: sourceRow.modelData.glyph
4223 - color: root.roleColor(sourceRow.modelData.role)
4224 - opacity: sourceRow.modelData.muted ? 0.5 : 1
4282 + spacing: 6
4227 4284 NuguText {
4228 4285 theme: root.theme
4229 - text: sourceRow.modelData.name
4230 - anchors.left: sourceGlyph.right
4231 - anchors.leftMargin: 10
4232 - anchors.right: sourceTrack.left
4233 - anchors.rightMargin: 10
4234 - anchors.verticalCenter: parent.verticalCenter
4235 - elide: Text.ElideRight
4236 - opacity: sourceRow.modelData.muted ? 0.5 : 1
4286 + variant: "title"
4287 + text: "input"
4239 - NuguText {
4240 - id: sourceTrailing
4242 - anchors.right: parent.right
4243 - anchors.rightMargin: 12
4244 - anchors.verticalCenter: parent.verticalCenter
4245 - theme: root.theme
4246 - variant: "meta"
4247 - text: sourceRow.modelData.muted ? "muted" : `${sourceRow.modelData.percent}%`
4248 - color: root.roleColor(sourceRow.modelData.muted ? "ui.minor" : sourceRow.modelData.role)
4251 - Rectangle {
4252 - id: sourceTrack
4254 - anchors.right: sourceTrailing.left
4255 - anchors.rightMargin: 10
4256 - anchors.verticalCenter: parent.verticalCenter
4257 - width: 96
4258 - height: 8
4259 - radius: 4
4260 - color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.28) : "transparent"
4262 - Rectangle {
4263 - anchors.left: parent.left
4264 - anchors.top: parent.top
4265 - anchors.bottom: parent.bottom
4266 - width: parent.width * (sourceRow.modelData.percent / 150)
4267 - radius: parent.radius
4268 - color: root.roleColor(sourceRow.modelData.role)
4269 - visible: !sourceRow.modelData.muted
4272 - MouseArea {
4273 - anchors.fill: parent
4274 - onClicked: (event) => {
4275 - return root.setVolume(sourceRow.modelData.id, event.x / Math.max(1, width) * 1.5);
4277 - onPositionChanged: (event) => {
4278 - if (pressed)
4279 - root.setVolume(sourceRow.modelData.id, event.x / Math.max(1, width) * 1.5);
4287 - // device options drawer: set-default + mute. PipeWire
4288 - // exposes no port/profile routing, so those aren't offered.
4289 - Rectangle {
4290 - visible: sourceRow.revealed
4290 + Column {
4291 4291 width: parent.width
4292 - height: visible ? sourceOpts.height + 16 : 0
4293 - radius: 10
4294 - color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.55) : "#333333"
4295 - border.width: 1
4296 - border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.4) : "white"
4297 - clip: true
4292 + spacing: 6
4299 - Row {
4300 - id: sourceOpts
4294 + Repeater {
4295 + model: root.sources
4302 - x: 12
4303 - y: 8
4304 - spacing: 8
4297 + delegate: Column {
4298 + id: sourceRow
4306 - Rectangle {
4307 - visible: !sourceRow.modelData.isDefault
4308 - width: 110
4309 - height: 28
4310 - radius: 9
4311 - color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.18) : "transparent"
4312 - border.width: 1
4313 - border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.7) : "white"
4300 + required property var modelData
4301 + readonly property bool revealed: root.expandedSource === modelData.id
4315 - NuguText {
4316 - anchors.centerIn: parent
4317 - theme: root.theme
4318 - variant: "meta"
4319 - text: "set default"
4303 + width: parent.width
4304 + spacing: 4
4322 - MouseArea {
4323 - anchors.fill: parent
4324 - onClicked: {
4325 - root.expandedSource = "";
4326 - root.selectSource(sourceRow.modelData.id);
4306 + Rectangle {
4307 + width: parent.width
4308 + height: 48
4309 + radius: 12
4310 + color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, sourceRow.modelData.isDefault ? 0.82 : 0.55) : "transparent"
4311 + border.width: (sourceRow.modelData.isDefault || sourceRow.revealed) ? 2 : 1
4312 + border.color: root.theme ? (sourceRow.modelData.isDefault ? root.theme.ui.accent : (sourceRow.revealed ? root.theme.withAlpha(root.theme.ui.accent, 0.6) : root.theme.withAlpha(root.theme.ui.minor, 0.45))) : "transparent"
4314 + MouseArea {
4315 + anchors.fill: parent
4316 + onClicked: root.expandedSource = sourceRow.revealed ? "" : sourceRow.modelData.id
4319 + Rectangle {
4320 + anchors.left: parent.left
4321 + anchors.top: parent.top
4322 + anchors.bottom: parent.bottom
4323 + anchors.margins: 2
4324 + width: 3
4325 + radius: 2
4326 + color: root.theme ? root.theme.ui.accent : "transparent"
4327 + opacity: sourceRow.modelData.isDefault ? 1 : 0
4330 + Text {
4331 + id: sourceGlyph
4333 + anchors.left: parent.left
4334 + anchors.leftMargin: 12
4335 + anchors.verticalCenter: parent.verticalCenter
4336 + font.family: "Symbols Nerd Font Mono"
4337 + font.pixelSize: 18
4338 + text: sourceRow.modelData.glyph
4339 + color: root.roleColor(sourceRow.modelData.role)
4340 + opacity: sourceRow.modelData.muted ? 0.5 : 1
4343 + NuguText {
4344 + theme: root.theme
4345 + text: sourceRow.modelData.name
4346 + anchors.left: sourceGlyph.right
4347 + anchors.leftMargin: 10
4348 + anchors.right: sourceTrack.left
4349 + anchors.rightMargin: 10
4350 + anchors.verticalCenter: parent.verticalCenter
4351 + elide: Text.ElideRight
4352 + opacity: sourceRow.modelData.muted ? 0.5 : 1
4355 + NuguText {
4356 + id: sourceTrailing
4358 + anchors.right: parent.right
4359 + anchors.rightMargin: 12
4360 + anchors.verticalCenter: parent.verticalCenter
4361 + theme: root.theme
4362 + variant: "meta"
4363 + text: sourceRow.modelData.muted ? "muted" : `${sourceRow.modelData.percent}%`
4364 + color: root.roleColor(sourceRow.modelData.muted ? "ui.minor" : sourceRow.modelData.role)
4367 + Rectangle {
4368 + id: sourceTrack
4370 + anchors.right: sourceTrailing.left
4371 + anchors.rightMargin: 10
4372 + anchors.verticalCenter: parent.verticalCenter
4373 + width: 96
4374 + height: 8
4375 + radius: 4
4376 + color: root.theme ? root.theme.withAlpha(root.theme.ui.minor, 0.28) : "transparent"
4378 + Rectangle {
4379 + anchors.left: parent.left
4380 + anchors.top: parent.top
4381 + anchors.bottom: parent.bottom
4382 + width: parent.width * (sourceRow.modelData.percent / 150)
4383 + radius: parent.radius
4384 + color: root.roleColor(sourceRow.modelData.role)
4385 + visible: !sourceRow.modelData.muted
4388 + MouseArea {
4389 + anchors.fill: parent
4390 + onClicked: event => {
4391 + return root.setVolume(sourceRow.modelData.id, event.x / Math.max(1, width) * 1.5);
4393 + onPositionChanged: event => {
4394 + if (pressed)
4395 + root.setVolume(sourceRow.modelData.id, event.x / Math.max(1, width) * 1.5);
4401 + // device options drawer: set-default + mute. PipeWire
4402 + // exposes no port/profile routing, so those aren't offered.
4403 + Rectangle {
4404 + visible: sourceRow.revealed
4405 + width: parent.width
4406 + height: visible ? sourceOpts.height + 16 : 0
4407 + radius: 10
4408 + color: root.theme ? root.theme.withAlpha(root.theme.ui.backdrop, 0.55) : "#333333"
4409 + border.width: 1
4410 + border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.4) : "white"
4411 + clip: true
4332 - Rectangle {
4333 - width: 92
4334 - height: 28
4335 - radius: 9
4336 - color: root.theme ? root.theme.withAlpha(sourceRow.modelData.muted ? root.theme.warning : root.theme.ui.accent, 0.18) : "transparent"
4337 - border.width: 1
4338 - border.color: root.theme ? root.theme.withAlpha(sourceRow.modelData.muted ? root.theme.warning : root.theme.ui.accent, 0.7) : "white"
4413 + Row {
4414 + id: sourceOpts
4340 - NuguText {
4341 - anchors.centerIn: parent
4342 - theme: root.theme
4343 - variant: "meta"
4344 - text: sourceRow.modelData.muted ? "unmute" : "mute"
4416 + x: 12
4417 + y: 8
4418 + spacing: 8
4420 + Rectangle {
4421 + visible: !sourceRow.modelData.isDefault
4422 + width: 110
4423 + height: 28
4424 + radius: 9
4425 + color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.18) : "transparent"
4426 + border.width: 1
4427 + border.color: root.theme ? root.theme.withAlpha(root.theme.ui.accent, 0.7) : "white"
4429 + NuguText {
4430 + anchors.centerIn: parent
4431 + theme: root.theme
4432 + variant: "meta"
4433 + text: "set default"
4436 + MouseArea {
4437 + anchors.fill: parent
4438 + onClicked: {
4439 + root.expandedSource = "";
4440 + root.selectSource(sourceRow.modelData.id);
4445 + Rectangle {
4446 + width: 92
4447 + height: 28
4448 + radius: 9
4449 + color: root.theme ? root.theme.withAlpha(sourceRow.modelData.muted ? root.theme.warning : root.theme.ui.accent, 0.18) : "transparent"
4450 + border.width: 1
4451 + border.color: root.theme ? root.theme.withAlpha(sourceRow.modelData.muted ? root.theme.warning : root.theme.ui.accent, 0.7) : "white"
4453 + NuguText {
4454 + anchors.centerIn: parent
4455 + theme: root.theme
4456 + variant: "meta"
4457 + text: sourceRow.modelData.muted ? "unmute" : "mute"
4460 + MouseArea {
4461 + anchors.fill: parent
4462 + onClicked: root.toggleMute(sourceRow.modelData.id)
4347 - MouseArea {
4348 - anchors.fill: parent
4349 - onClicked: root.toggleMute(sourceRow.modelData.id)
4372 4475 component MediaPanel: Column {
4373 4476 id: root
4375 - required property QtObject theme
4376 - required property QtObject mediaService
4377 - property var state: mediaService ? Util.parseJson(mediaService.stateJson(), {
4378 - "activePlayer": {
4379 - },
4478 + required property Theme theme
4479 + required property Media mediaService
4480 + property var panelState: mediaService ? Util.parseJson(mediaService.stateJson(), {
4481 + "activePlayer": {},
4380 4482 "players": [],
4381 - "mediaPanelContract": {
4483 + "mediaPanelContract": {}
4383 4484 }) : ({
4384 - "activePlayer": {
4385 - },
4386 - "players": [],
4387 - "mediaPanelContract": {
4389 - })
4390 - readonly property var player: state.activePlayer || ({
4391 - })
4392 - readonly property var players: state.players || []
4485 + "activePlayer": {},
4486 + "players": [],
4487 + "mediaPanelContract": {}
4488 + })
4489 + readonly property var player: panelState.activePlayer || ({})
4490 + readonly property var players: panelState.players || []
4393 4491 readonly property bool hasMedia: players.length > 0
4394 - readonly property var panel: state.mediaPanelContract || ({
4395 - })
4492 + readonly property var panel: panelState.mediaPanelContract || ({})
4396 4493 readonly property var transportActions: ["shuffle", "previous", "playPause", "next", "repeat"]
4399 4495 function mmss(seconds) {
4400 4496 const total = Math.max(0, Math.round(Number(seconds || 0)));
4401 4497 const minutes = Math.floor(total / 60);
4406 4502 function refreshFrom(text) {
4407 - state = Util.parseJson(text, state);
4503 + panelState = Util.parseJson(text, panelState);
4410 4506 function runAction(kind) {
4411 4507 if (mediaService)
4412 4508 refreshFrom(mediaService.action(kind));
4416 4511 function seekByRatio(ratio) {
4417 4512 const length = Math.max(0, Number(player.length || 0));
4418 4513 if (mediaService && length > 0)
4419 4514 refreshFrom(mediaService.seek(Math.round(Math.max(0, Math.min(1, ratio)) * length)));
4423 4517 function selectPlayer(id) {
4424 4518 if (mediaService)
4425 4519 refreshFrom(mediaService.select(id));
4429 4522 spacing: 10
4462 4555 color: root.theme ? root.theme.ui.accent : "transparent"
4463 4556 opacity: root.player.playbackState === "playing" ? 1 : 0.35
4468 4560 Column {
4528 4620 MouseArea {
4529 4621 anchors.fill: parent
4530 - onClicked: (event) => {
4622 + onClicked: event => {
4531 4623 return root.seekByRatio(event.x / Math.max(1, width));
4537 4628 NuguText {
4540 4631 text: root.mmss(root.player.length)
4541 4632 width: 34
4575 4665 anchors.fill: parent
4576 4666 onClicked: root.runAction(transportButton.modelData)
4622 4707 anchors.fill: parent
4623 4708 onClicked: root.selectPlayer(playerButton.modelData.id)
4653 4735 selected: true
4654 4736 text: "♪"
4659 4740 NuguText {
4669 4750 variant: "meta"
4670 4751 text: "Start a track — controls appear here"

quickshell/nuguland/Power.qml

Modified
11 11 Item {
12 12 id: root
14 - property QtObject lockService
15 - property QtObject niriService
14 + property Lock lockService
15 + property Niri niriService
16 16 property string pendingConfirmation: ""
17 17 property var lastAction: ({})
21 21 function nativeBattery() {
22 22 const device = UPower.displayDevice;
23 23 if (!device || !device.ready)
24 - return { "id": "display", "percent": 0, "state": "unknown", "timeEstimate": "unknown", "health": -1 };
24 + return {
25 + "id": "display",
26 + "percent": 0,
27 + "state": "unknown",
28 + "timeEstimate": "unknown",
29 + "health": -1
30 + };
26 32 const state = Power.cleanState(UPowerDeviceState.toString(device.state || UPowerDeviceState.Unknown));
27 33 return {
103 109 const action = String(kind);
104 110 if (Power.requiresConfirmation(action)) {
105 111 pendingConfirmation = action;
106 - lastAction = { "kind": action, "confirmed": false };
112 + lastAction = {
113 + "kind": action,
114 + "confirmed": false
115 + };
107 116 } else {
108 117 pendingConfirmation = "";
109 118 runPlan(Power.actionPlan(action));
110 - lastAction = { "kind": action, "confirmed": true };
119 + lastAction = {
120 + "kind": action,
121 + "confirmed": true
122 + };
112 124 return stateJson();
119 131 if (confirmed)
120 132 runPlan(Power.actionPlan(action));
122 - lastAction = { "kind": action, "confirmed": confirmed };
134 + lastAction = {
135 + "kind": action,
136 + "confirmed": confirmed
137 + };
123 138 return stateJson();
126 141 function cancelAction() {
127 142 pendingConfirmation = "";
128 - lastAction = { "kind": "cancel" };
143 + lastAction = {
144 + "kind": "cancel"
145 + };
129 146 return stateJson();
133 150 // state or executing anything. Gate-checks power.js via IPC.
134 151 function selfTest() {
135 152 const cases = [];
136 - function check(name, got, want) { cases.push({ "name": name, "pass": JSON.stringify(got) === JSON.stringify(want), "got": got }); }
153 + function check(name, got, want) {
154 + cases.push({
155 + "name": name,
156 + "pass": JSON.stringify(got) === JSON.stringify(want),
157 + "got": got
158 + });
138 - check("poweroff routes to systemctl", Power.actionPlan("poweroff"), { "via": "exec", "argv": ["systemctl", "poweroff"] });
139 - check("logout routes to niri quit", Power.actionPlan("logout"), { "via": "niri", "args": ["quit", "--skip-confirmation"] });
140 - check("lock routes to lockService", Power.actionPlan("lock"), { "via": "lock" });
141 - check("unknown is no-op", Power.actionPlan("bogus"), { "via": "none" });
161 + check("poweroff routes to systemctl", Power.actionPlan("poweroff"), {
162 + "via": "exec",
163 + "argv": ["systemctl", "poweroff"]
164 + });
165 + check("logout routes to niri quit", Power.actionPlan("logout"), {
166 + "via": "niri",
167 + "args": ["quit", "--skip-confirmation"]
168 + });
169 + check("lock routes to lockService", Power.actionPlan("lock"), {
170 + "via": "lock"
171 + });
172 + check("unknown is no-op", Power.actionPlan("bogus"), {
173 + "via": "none"
174 + });
142 175 check("poweroff confirms", Power.requiresConfirmation("poweroff"), true);
143 176 check("suspend immediate", Power.requiresConfirmation("suspend"), false);
144 177 check("batteryRole critical", Power.batteryRole(8), "error");
145 178 check("normalizePercent fraction", Power.normalizePercent(0.5), 50);
146 179 check("low power on discharge", Power.isLowPower("Discharging"), true);
148 - const failed = cases.filter((c) => !c.pass);
149 - return JSON.stringify({ "ok": failed.length === 0, "total": cases.length, "failed": failed });
181 + const failed = cases.filter(c => !c.pass);
182 + return JSON.stringify({
183 + "ok": failed.length === 0,
184 + "total": cases.length,
185 + "failed": failed
186 + });

quickshell/nuguland/Privilege.qml

Modified
1 +pragma ComponentBehavior: Bound
1 2 import QtQuick
2 -import Quickshell
3 3 import Quickshell.Services.Polkit
5 5 Item {
10 10 property bool authorized: false
11 11 property bool cancelled: false
12 12 property string error: ""
13 - property var request: ({
14 - })
15 - property var lastAction: ({
16 - })
13 + property var request: ({})
14 + property var lastAction: ({})
17 15 readonly property bool nativeActionRoute: true
18 16 readonly property var boundedActions: ["submit", "deny", "cancel", "fail", "clear"]
19 17 readonly property var buttons: ["deny", "cancel", "confirm"]
142 140 completed = false;
143 141 authorized = false;
144 142 cancelled = false;
145 - request = ({
146 - });
143 + request = ({});
147 144 error = "";
148 145 lastAction = {
149 146 "kind": "clear"
159 156 sourceComponent: PolkitAgent {
160 157 path: "/org/nuguland/PolkitAgent"
165 161 Connections {
166 162 function onAuthenticationRequestStarted() {
167 - const flow = polkitAgent ? polkitAgent.flow : null;
163 + const flow = root.polkitAgent ? root.polkitAgent.flow : null;
168 164 root.active = true;
169 165 root.completed = false;
170 166 root.authorized = false;
187 - target: polkitAgent
183 + target: root.polkitAgent
190 186 Connections {
200 196 root.cancel();
203 - target: !polkitAgent ? null : polkitAgent.flow
199 + target: !root.polkitAgent ? null : root.polkitAgent.flow

quickshell/nuguland/Resources.qml

Modified
13 13 // --- injected services (DI via shell.qml; never singletons here) ---
14 14 required property var upower // UPower singleton (displayDevice bindings)
15 15 required property var powerProfiles // PowerProfiles singleton (degradationReason)
16 - required property QtObject brightnessService // Brightness.qml (identity row reuse)
16 + required property Brightness brightnessService // Brightness.qml (identity row reuse)
18 18 // --- view-bound live properties (fast loop) ---
19 19 property real cpuUsage: 0
127 127 // --- last issue action record (for IPC introspection) ---
128 - property var lastAction: ({
129 - })
128 + property var lastAction: ({})
131 130 // --- internal delta state ---
132 131 property var prevCpu: null
219 218 const t = Sys.parseTemp(tempFile.text() || "");
220 219 if (t !== null)
221 220 cpuTemperatureC = t;
224 222 if (fanFile.path) {
225 223 fanFile.reload();
226 224 const f = Sys.parseFan(fanFile.text() || "");
227 225 if (f !== null)
228 226 fanRpm = f;
232 229 cpuRing = Sys.pushRing(cpuRing, cpuUsage, ringCap);
246 243 // --- slow loop: process spawns, only while popout open (5s) ---
247 244 function refreshSlow() {
248 245 if (!popoutOpen)
249 - return ;
246 + return;
251 248 if (!failedSystemProc.running)
252 249 failedSystemProc.exec(["systemctl", "--failed", "--no-legend", "--plain"]);
260 257 if (!psProc.running)
261 258 psProc.exec(["sh", "-c", "ps -eo pid=,comm=,pcpu=,pmem= --sort=-pcpu | head -n 5"]);
265 261 // --- rare loop: identity facts (cached) + checkupdates (async, on open) ---
270 266 if (!updatesProc.running)
271 267 updatesProc.exec(["checkupdates"]);
275 270 function recomputeFailed() {
312 307 if (!issue || !issue.action)
313 308 return JSON.stringify({
314 - "ok": false,
315 - "reason": "no-action",
316 - "id": id
317 - });
309 + "ok": false,
310 + "reason": "no-action",
311 + "id": id
312 + });
319 314 const a = issue.action;
320 315 let argv = null;
331 326 if (!argv)
332 327 return JSON.stringify({
333 - "ok": false,
334 - "reason": "unknown-action",
335 - "kind": a.kind
336 - });
328 + "ok": false,
329 + "reason": "unknown-action",
330 + "kind": a.kind
331 + });
338 333 lastAction = {
339 334 "ok": true,
429 424 for (let i = 0; i < list.length; i++) {
430 425 if (list[i].id === id)
431 426 return list[i];
434 428 return null;
451 445 for (let k = 0; k < keys.length; k++) {
452 446 if (!(keys[k] in st))
453 447 missing.push(keys[k]);
456 449 ok("state-keys-present:" + missing.join(","), missing.length === 0);
458 451 failedUnits = ["app-Handy@autostart.service"];
459 452 cpuTemperatureC = 95;
460 453 tempHighC = 87;
461 - diskUsage = [{
462 - "source": "/dev/sda3",
463 - "target": "/",
464 - "usedPercent": 96
465 - }];
454 + diskUsage = [
456 + "source": "/dev/sda3",
457 + "target": "/",
458 + "usedPercent": 96
460 + ];
466 461 memoryUsage = 0.95;
467 462 swapGrowing = true;
468 463 loadOne = 9;
483 478 // below threshold -> these checks clear (battery/throttle ignored: real device)
484 479 failedUnits = [];
485 480 cpuTemperatureC = 40;
486 - diskUsage = [{
487 - "source": "/dev/sda3",
488 - "target": "/",
489 - "usedPercent": 50
490 - }];
481 + diskUsage = [
483 + "source": "/dev/sda3",
484 + "target": "/",
485 + "usedPercent": 50
487 + ];
491 488 memoryUsage = 0.5;
492 489 swapGrowing = false;
493 490 loadOne = 1;
516 513 cores = saved.cores;
517 514 updateCount = saved.updateCount;
519 - const fail = cases.filter((c) => {
516 + const fail = cases.filter(c => {
520 517 return !c.pass;
521 518 }).length;
522 519 return JSON.stringify({
616 613 const v = Number(line.slice(5));
617 614 if (Number.isFinite(v) && v > 0)
618 615 root.tempHighC = v / 1000;
627 622 // --- slow-loop processes ---
637 632 root.recomputeFailed();
643 637 Process {
652 646 root.recomputeFailed();
658 651 Process {
666 659 const parsed = Sys.parseDf(this.text);
667 660 if (parsed.length > 0)
668 661 root.diskUsage = parsed;
675 666 Process {
683 674 const parsed = Sys.parsePsTop(this.text);
684 675 if (parsed.length > 0)
685 676 root.processes = parsed;
692 681 // --- rare-loop processes ---
721 709 Process {
732 720 // checkupdates: 0 = updates listed, 2 = none, other = error / no network.
733 - onExited: (exitCode, exitStatus) => {
721 + function onExited(exitCode) {
734 722 if (exitCode === 2) {
735 723 root.updateCount = 0;
736 - return ;
724 + return;
738 726 if (exitCode !== 0) {
739 727 root.updateCount = null;
740 - return ;
728 + return;
742 - const lines = String(updatesOut.text || "").split("\n").filter((l) => {
730 + const lines = String(updatesOut.text || "").split("\n").filter(l => {
743 731 return l.trim().length > 0;
745 733 root.updateCount = lines.length;
776 764 triggeredOnStart: false
777 765 onTriggered: root.refreshRare()

quickshell/nuguland/Screenshots.qml

Modified
1 1 import QtQuick
2 -import Quickshell
4 3 Item {
5 4 id: root
7 - property QtObject niriService
8 - property QtObject osdService
6 + property Niri niriService
7 + property Osd osdService
9 8 property string lastColor: ""
10 9 property var recent: []
11 - property var lastAction: ({
12 - })
10 + property var lastAction: ({})
13 11 property var selection: ({
14 - "model": "normalized-cross-screen-rect",
15 - "phase": "idle",
16 - "press": {
17 - "x": 0,
18 - "y": 0
19 - },
20 - "current": {
21 - "x": 0,
22 - "y": 0
23 - },
24 - "rect": {
25 - "x": 0,
26 - "y": 0,
27 - "width": 0,
28 - "height": 0
29 - },
30 - "cursor": "default",
31 - "completionFlash": false
32 - })
33 - property var lastOsd: ({
34 - })
12 + "model": "normalized-cross-screen-rect",
13 + "phase": "idle",
14 + "press": {
15 + "x": 0,
16 + "y": 0
17 + },
18 + "current": {
19 + "x": 0,
20 + "y": 0
21 + },
22 + "rect": {
23 + "x": 0,
24 + "y": 0,
25 + "width": 0,
26 + "height": 0
27 + },
28 + "cursor": "default",
29 + "completionFlash": false
30 + })
31 + property var lastOsd: ({})
35 32 readonly property bool nativeActionRoute: !!niriService && !!niriService.available
36 33 readonly property var nativeActions: ["screenshot-screen", "screenshot-window", "screenshot", "pick-color"]
37 34 readonly property var boundedActions: ["focused-screen", "focused-window", "interactive", "select-region", "pick-color", "copy", "save", "open-record", "clear"]
51 48 function record(id, kind, path) {
52 - const next = [{
53 - "id": id,
54 - "kind": kind,
55 - "path": path,
56 - "source": "niri-native",
57 - "saved": true
58 - }];
49 + const next = [
50 + {
51 + "id": id,
52 + "kind": kind,
53 + "path": path,
54 + "source": "niri-native",
55 + "saved": true
56 + }
57 + ];
59 58 for (let i = 0; i < recent.length; i++) {
60 59 if (recent[i].id !== id)
61 60 next.push(recent[i]);
64 62 recent = next.slice(0, 12);
67 65 function cornerHandles(rect) {
68 66 const size = rect.width > 0 && rect.height > 0 ? 14 : 0;
69 - return [{
70 - "id": "top-left",
71 - "x": rect.x,
72 - "y": rect.y,
73 - "size": size,
74 - "role": "ui.accent"
75 - }, {
76 - "id": "top-right",
77 - "x": rect.x + rect.width,
78 - "y": rect.y,
79 - "size": size,
80 - "role": "ui.accent"
81 - }, {
82 - "id": "bottom-left",
83 - "x": rect.x,
84 - "y": rect.y + rect.height,
85 - "size": size,
86 - "role": "ui.accent"
87 - }, {
88 - "id": "bottom-right",
89 - "x": rect.x + rect.width,
90 - "y": rect.y + rect.height,
91 - "size": size,
92 - "role": "ui.accent"
93 - }];
67 + return [
68 + {
69 + "id": "top-left",
70 + "x": rect.x,
71 + "y": rect.y,
72 + "size": size,
73 + "role": "ui.accent"
74 + },
75 + {
76 + "id": "top-right",
77 + "x": rect.x + rect.width,
78 + "y": rect.y,
79 + "size": size,
80 + "role": "ui.accent"
81 + },
82 + {
83 + "id": "bottom-left",
84 + "x": rect.x,
85 + "y": rect.y + rect.height,
86 + "size": size,
87 + "role": "ui.accent"
88 + },
89 + {
90 + "id": "bottom-right",
91 + "x": rect.x + rect.width,
92 + "y": rect.y + rect.height,
93 + "size": size,
94 + "role": "ui.accent"
95 + }
96 + ];
96 99 function selectionVisuals(selectionState) {
132 135 "nugulandCornerAccents": {
133 136 "bounded": true,
134 137 "freePhysicsLoop": false,
135 - "anchors": cornerHandles(rect).map((handle) => {
138 + "anchors": cornerHandles(rect).map(handle => {
136 139 return ({
137 - "id": handle.id,
138 - "x": handle.x,
139 - "y": handle.y
140 - });
140 + "id": handle.id,
141 + "x": handle.x,
142 + "y": handle.y
143 + });
220 223 "x": x,
221 224 "y": y
223 - selection = Object.assign({
224 - }, selection, {
226 + selection = Object.assign({}, selection, {
225 227 "phase": "dragging",
226 228 "current": current,
227 229 "rect": rectFromPoints(start, current),
238 240 function completeSelection(path) {
239 - selection = Object.assign({
240 - }, selection, {
241 + selection = Object.assign({}, selection, {
241 242 "phase": "completed",
242 243 "cursor": "default",
243 244 "completionFlash": true
260 261 function cancelSelection() {
261 - selection = Object.assign({
262 - }, selection, {
262 + selection = Object.assign({}, selection, {
263 263 "phase": "idle",
264 264 "cursor": "default",
265 265 "completionFlash": false
280 280 id = "capture-focused-screen";
281 281 if (nativeActionRoute)
282 282 niriService.screenshotScreen(target);
284 283 } else if (actionKind === "focused-window") {
285 284 nativeAction = "screenshot-window";
286 285 id = "capture-focused-window";
287 286 if (nativeActionRoute)
288 287 niriService.screenshotWindow(target);
290 288 } else if (actionKind === "interactive") {
291 289 nativeAction = "screenshot";
292 290 if (nativeActionRoute)
293 291 niriService.screenshot(target);
296 293 lastAction = {
297 294 "kind": actionKind,
307 304 function acceptPickedColor(color) {
308 305 const value = String(color || "").toLowerCase();
309 306 if (!/^#[0-9a-f]{6}$/.test(value))
310 - return ;
307 + return;
312 309 lastColor = value;
313 - lastAction = Object.assign({
314 - }, lastAction, {
310 + lastAction = Object.assign({}, lastAction, {
315 311 "color": lastColor,
316 312 "completed": true
377 373 target: root.niriService

quickshell/nuguland/SurfaceManager.qml

Modified
7 7 property bool popoutClosing: false
8 8 property string popoutPhase: "closed"
9 9 property string popoutName: ""
10 + property string popoutOutput: ""
10 11 property string activeLoaderName: ""
11 12 property string pendingLoaderName: ""
12 13 property string removingLoaderName: ""
13 - property var previousContent: ({
14 - })
14 + property var previousContent: ({})
15 15 property string lastInteraction: ""
16 16 property string lastCloseReason: ""
17 17 property rect popoutAnchor: Qt.rect(0, 0, 0, 0)
21 21 property int barHeight: 34
22 22 property string orientation: "horizontal"
23 23 readonly property bool vertical: orientation === "vertical"
24 - property var anchorRegistry: ({
25 - })
24 + property var anchorRegistry: ({})
26 25 readonly property int closeRetentionMs: 0
27 26 readonly property real goldenRatio: 1.61803
29 28 function parseRect(text) {
30 - const parts = String(text).split(/[, x]+/).filter((p) => {
29 + const parts = String(text).split(/[, x]+/).filter(p => {
31 30 return p.length > 0;
32 31 }).map(Number);
33 - if (parts.length !== 4 || parts.some((n) => {
32 + if (parts.length !== 4 || parts.some(n => {
34 33 return !Number.isFinite(n);
36 35 return Qt.rect(0, 0, 0, 0);
100 99 case "launcher":
101 100 return {
102 101 "width": width,
103 - "height": heightBudget(560)
102 + "height": heightBudget(432)
105 104 case "audio":
106 105 return {
215 214 "visual": ["search", "cards", "thumbnails", "private-mode"]
217 216 "launcher": {
218 - "component": "launcher-search",
217 + "component": "app-launcher",
219 218 "source": "Launcher.qml",
220 - "visual": ["provider-chips", "single-list", "preview", "bottom-search"]
219 + "visual": ["app-search", "desktop-icons", "desktop-actions", "desktop-entry-details"]
222 221 "audio": {
223 222 "component": "audio-mixer",
246 245 function registerAnchor(name, anchorText) {
247 - const next = Object.assign({
248 - }, anchorRegistry);
246 + const next = Object.assign({}, anchorRegistry);
249 247 next[String(name)] = rectObject(parseRect(anchorText));
250 248 anchorRegistry = next;
251 249 return registeredAnchors();
312 - function openPopout(name, anchorText) {
310 + function openPopout(name, anchorText, outputName) {
313 311 const nextName = String(name);
314 312 const wasOpen = popoutOpen && !popoutClosing;
315 313 unloadTimer.stop();
318 316 lastInteraction = "";
319 317 lastCloseReason = "";
320 318 popoutName = nextName;
319 + popoutOutput = String(outputName || "");
321 320 activeLoaderName = nextName;
322 321 pendingLoaderName = "";
323 322 removingLoaderName = "";
324 - previousContent = ({
325 - });
323 + previousContent = ({});
326 324 popoutAnchor = parseRect(anchorText);
327 325 popoutOpen = true;
328 326 if (wasOpen) {
336 334 return popoutState();
339 - function openRegisteredPopout(name) {
337 + function openRegisteredPopout(name, outputName) {
340 338 const anchor = anchorRegistry[String(name)] || {
341 339 "x": 0,
342 340 "y": 0,
343 341 "width": 0,
344 342 "height": 0
346 - return openPopout(name, `${anchor.x},${anchor.y},${anchor.width},${anchor.height}`);
344 + return openPopout(name, `${anchor.x},${anchor.y},${anchor.width},${anchor.height}`, outputName);
349 347 function hoverRegisteredPopout(name) {
368 366 popoutProgress = 0;
369 367 popoutPhase = "closed";
370 368 popoutName = "";
369 + popoutOutput = "";
371 370 activeLoaderName = "";
372 371 pendingLoaderName = "";
373 372 removingLoaderName = "";
374 - previousContent = ({
375 - });
373 + previousContent = ({});
376 374 return popoutState();
402 400 "closing": popoutClosing,
403 401 "phase": popoutPhase,
404 402 "name": popoutName,
403 + "output": popoutOutput,
405 404 "lastInteraction": lastInteraction,
406 405 "lastCloseReason": lastCloseReason,
407 406 "anchor": rectObject(popoutAnchor),
436 435 repeat: false
437 436 onTriggered: {
438 437 if (!root.popoutOpen || root.popoutClosing)
439 - return ;
438 + return;
441 440 root.popoutProgress = 1;
442 441 root.popoutPhase = "open";
452 451 root.popoutClosing = false;
453 452 root.popoutPhase = "closed";
454 453 root.popoutName = "";
454 + root.popoutOutput = "";
455 455 root.activeLoaderName = "";
456 456 root.pendingLoaderName = "";
457 457 root.removingLoaderName = "";
458 - root.previousContent = ({
459 - });
458 + root.previousContent = ({});

quickshell/nuguland/Theme.qml

Modified
6 6 property bool lowPowerMode: false
7 7 readonly property string mode: "dark"
8 8 readonly property var colors: ({
9 - "debug": "#ed5eed",
10 - "error": "#ec6376",
11 - "warning": "#f0ee69",
12 - "info": "#3ec5e3",
13 - "content": {
14 - "normal": "#ededed",
15 - "backdrop": "#121212",
16 - "accent": "#d151d1",
17 - "minor": "#8b8b8b",
18 - "focus": "#7ba1aa",
19 - "unfocus": "#5d5d5d",
20 - "important_local": "#b59ae4",
21 - "important_global": "#dfd3f3"
22 - },
23 - "ui": {
24 - "normal": "#dbdbdb",
25 - "backdrop": "#242424",
26 - "accent": "#d86dd8",
27 - "minor": "#9d9d9d",
28 - "focus": "#9aabae",
29 - "unfocus": "#6f6f6f",
30 - "important_local": "#c9b6eb",
31 - "important_global": "#f3effb"
32 - }
33 - })
9 + "debug": "#ed5eed",
10 + "error": "#ec6376",
11 + "warning": "#f0ee69",
12 + "info": "#3ec5e3",
13 + "content": {
14 + "normal": "#ededed",
15 + "backdrop": "#121212",
16 + "accent": "#d151d1",
17 + "minor": "#8b8b8b",
18 + "focus": "#7ba1aa",
19 + "unfocus": "#5d5d5d",
20 + "important_local": "#b59ae4",
21 + "important_global": "#dfd3f3"
22 + },
23 + "ui": {
24 + "normal": "#dbdbdb",
25 + "backdrop": "#242424",
26 + "accent": "#d86dd8",
27 + "minor": "#9d9d9d",
28 + "focus": "#9aabae",
29 + "unfocus": "#6f6f6f",
30 + "important_local": "#c9b6eb",
31 + "important_global": "#f3effb"
32 + }
33 + })
34 34 readonly property var content: colors.content
35 35 readonly property var ui: colors.ui
36 36 readonly property string error: colors.error
41 41 function withAlpha(hex, alpha) {
42 42 const aa = Math.round(Math.max(0, Math.min(1, alpha)) * 255).toString(16).padStart(2, "0");
43 - return `#${aa}${hex.slice(1)}`;
43 + return `#${aa}${String(hex).slice(1)}`;
44 + }
46 + function reload() {
47 + return mode;
46 50 visible: false

quickshell/nuguland/Time.qml

Modified
102 102 function personalAgenda(value) {
103 - return [{
104 - "id": "nuguland-focus",
105 - "title": "Nuguland focus",
106 - "time": `${formatClock(value).display}`,
107 - "source": "personal-constant",
108 - "role": "ui.accent"
109 - }];
103 + return [
105 + "id": "nuguland-focus",
106 + "title": "Nuguland focus",
107 + "time": `${formatClock(value).display}`,
108 + "source": "personal-constant",
109 + "role": "ui.accent"
111 + ];
112 114 function stateObject(value) {
188 190 repeat: true
189 191 onTriggered: root.now = new Date()

quickshell/nuguland/Tray.qml

Modified
9 9 property bool closeRequested: false
10 10 property string closeReason: ""
11 11 property var closePropagation: ({
12 - "requested": false,
13 - "source": "",
14 - "reason": ""
15 - })
16 - property var lastAction: ({
17 - })
12 + "requested": false,
13 + "source": "",
14 + "reason": ""
15 + })
16 + property var lastAction: ({})
18 17 readonly property var rowKinds: ["action", "separator", "submenu", "check", "radio", "disabled"]
19 18 readonly property var nativeItems: SystemTray.items.values
20 - readonly property int attentionCount: itemsArray().filter((item) => {
19 + readonly property int attentionCount: itemsArray().filter(item => {
21 20 return item.status === "NeedsAttention";
22 21 }).length
96 95 function itemsArray() {
97 96 const result = [];
98 - for (let i = 0; i < nativeItems.length; i++) result.push(shapeItem(nativeItems[i], i))
97 + for (let i = 0; i < nativeItems.length; i++)
98 + result.push(shapeItem(nativeItems[i], i));
99 99 return result;
102 102 function nativeItemById(id) {
103 103 const needle = String(id);
104 - for (let i = 0; i < nativeItems.length; i++) if (itemKey(nativeItems[i], i) === needle) {
105 - return nativeItems[i];
106 - }
104 + for (let i = 0; i < nativeItems.length; i++)
105 + if (itemKey(nativeItems[i], i) === needle) {
106 + return nativeItems[i];
107 108 return null;
115 116 if (selectedItemId.length === 0)
116 117 return items[0];
118 - for (let i = 0; i < items.length; i++) if (items[i].id === selectedItemId) {
119 - return items[i];
120 - }
119 + for (let i = 0; i < items.length; i++)
120 + if (items[i].id === selectedItemId) {
121 + return items[i];
121 123 return items[0];
126 128 if (!item || !item.hasMenu)
127 129 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 - }];
131 + return [
133 + "id": `${item.id}:native-menu`,
134 + "kind": "submenu",
135 + "label": `${item.title} menu`,
136 + "enabled": true,
137 + "expanded": expandedSubmenu === `${item.id}:native-menu`,
138 + "native": true,
139 + "children": []
141 + ];
140 144 function rowById(id) {
141 145 const rows = menuRows();
142 146 const needle = String(id);
143 - for (let i = 0; i < rows.length; i++) if (rows[i].id === needle) {
144 - return rows[i];
145 - }
147 + for (let i = 0; i < rows.length; i++)
148 + if (rows[i].id === needle) {
149 + return rows[i];
146 151 return ({
147 - "id": needle,
148 - "kind": "missing",
149 - "label": "",
150 - "enabled": false,
151 - "native": false
152 - });
152 + "id": needle,
153 + "kind": "missing",
154 + "label": "",
155 + "enabled": false,
156 + "native": false
157 + });
155 160 function trayPanelContract() {
188 193 "trayPanelContract": trayPanelContract(),
189 194 "oneExpandedSubmenu": true,
190 195 "expandedSubmenu": expandedSubmenu,
191 - "siblingsCollapsed": rows.filter((row) => {
196 + "siblingsCollapsed": rows.filter(row => {
192 197 return row.kind === "submenu" && row.expanded;
193 198 }).length <= 1,
194 199 "rowKinds": rowKinds,
309 314 "menu": stateObject()

quickshell/nuguland/Usage.qml

Modified
1 +pragma ComponentBehavior: Bound
1 2 import QtQuick
2 3 import Quickshell
3 4 import Quickshell.Io
17 18 // Snapshotted once at load (see FileView.onLoaded); the bar binds to this.
18 19 property var layoutOrder: widgets
19 20 property bool snapshotted: false
21 + property alias usageStore: usageStoreObject
21 23 function snapshot() {
22 24 if (root.snapshotted)
23 - return ;
25 + return;
25 27 root.snapshotted = true;
26 28 root.layoutOrder = root.ordered();
29 31 function countFor(name) {
30 - const counts = usageAdapter.counts || ({
31 - });
32 + const counts = root.usageStore.counts || ({});
32 33 return Number(counts[String(name)] || 0);
43 44 }).sort((a, b) => {
44 45 return (b.count - a.count) || (a.index - b.index);
45 - }).map((entry) => {
46 + }).map(entry => {
46 47 return entry.name;
52 53 if (root.widgets.indexOf(key) < 0)
53 54 return root.stateJson();
55 - const next = Object.assign({
56 - }, usageAdapter.counts);
56 + const next = Object.assign({}, root.usageStore.counts);
57 57 next[key] = (Number(next[key]) || 0) + 1;
58 - usageAdapter.counts = next;
58 + root.usageStore.counts = next;
59 + root.saveCounts();
59 60 return root.stateJson();
63 64 return JSON.stringify({
64 65 "backend": "Usage.qml",
65 66 "path": usageFile.path,
66 - "counts": usageAdapter.counts || ({
67 - }),
67 + "counts": root.usageStore.counts || ({}),
68 68 "layoutOrder": root.layoutOrder,
69 69 "liveOrder": root.ordered()
73 + function loadCounts() {
74 + let data = {};
75 + try {
76 + data = JSON.parse(usageFile.text() || "{}");
77 + } catch (error) {
78 + data = {};
79 + }
80 + root.usageStore.counts = data.counts || {};
81 + root.snapshot();
82 + }
84 + function saveCounts() {
85 + usageFile.setText(JSON.stringify({
86 + "counts": root.usageStore.counts || {}
87 + }, null, 2));
88 + }
90 + QtObject {
91 + id: usageStoreObject
93 + property var counts: ({})
94 + }
73 96 FileView {
74 97 id: usageFile
76 99 // Single writer (this shell), so no watchChanges: a reload on our own
77 100 // write would re-snapshot layoutOrder mid-session.
78 101 path: Quickshell.statePath("nuguland-widget-usage.json")
79 - onAdapterUpdated: writeAdapter()
80 - onLoaded: root.snapshot()
102 + printErrors: false
103 + onLoaded: root.loadCounts()
81 104 onLoadFailed: root.snapshot()
83 - JsonAdapter {
84 - id: usageAdapter
86 - property var counts: ({
87 - })
88 - }

quickshell/nuguland/bluetoothNative.js

Added
new file mode 100644
1 +// bluetoothNative.js — isolate Quickshell Bluetooth properties missing from qmllint qmltypes.
2 +function defaultAdapter(api) {
3 + return api.defaultAdapter;
4 +}
6 +function devices(api) {
7 + return api.devices.values;
8 +}

quickshell/nuguland/justfile

Modified
18 18 mapfile -t mjs < <(find . -name '*.mjs' -print | sort)
19 19 mapfile -t frag < <(find shaders -name '*.frag' -print 2>/dev/null | sort)
20 20 for file in "${qml[@]}"; do
21 - /usr/lib/qt6/bin/qmllint -I /usr/lib/qt6/qml "$file" || { echo "qmllint failed: $file" >&2; exit 1; }
21 + /usr/lib/qt6/bin/qmllint --max-warnings 0 -I /usr/lib/qt6/qml "$file" || { echo "qmllint failed: $file" >&2; exit 1; }
22 22 done
23 23 ((${#sh[@]} == 0)) || shellcheck "${sh[@]}"
24 24 for file in "${mjs[@]}"; do
29 29 for file in "${qml[@]}"; do
30 30 out="$tmp/${file#./}"
31 - /usr/lib/qt6/bin/qmlformat -n "$file" > "$out" || { echo "qmlformat failed: $file" >&2; exit 1; }
31 + /usr/lib/qt6/bin/qmlformat "$file" > "$out" || { echo "qmlformat failed: $file" >&2; exit 1; }
32 32 cmp -s "$file" "$out" || { echo "qmlformat changed: $file" >&2; diff -u "$file" "$out"; exit 1; }
33 33 done

quickshell/nuguland/launch.js

Modified
1 -// launch.js — pure launcher logic: normalize, prefix intents, subsequence fuzzy
2 -// scoring, calculator eval, row shaping, app mapping, and the ranking core.
3 -// NO I/O. Dual-mode: node `require` (tests) + QML import. Same pattern as clip.js.
1 +// launch.js — pure app-launcher logic: normalize, fuzzy rank, desktop-entry mapping.
2 +// NO I/O. Dual-mode: node `require` (tests) + QML import.
5 -// --- Provider Nerd Font glyphs (FA PUA, render in "Symbols Nerd Font Mono").
6 -// Kept as \uXXXX escapes. App glyph is the FALLBACK shown only when a real
7 -// desktop icon fails to resolve. ---
8 -var GLYPH_APP = "\uF135"; // rocket (app fallback)
9 -var GLYPH_ACTION = "\uF013"; // gear
10 -var GLYPH_CALCULATOR = "\uF1EC"; // calculator
11 -var GLYPH_CLIPBOARD = "\uF0EA"; // clipboard
12 -var GLYPH_WINDOW = "\uF2D0"; // window
4 +var GLYPH_APP = "\uF135"; // rocket fallback when themed icon misses
14 -// --- lowercase + trim, null-safe (search/compare key) ---
15 6 function normalize(text) {
16 7 return String(text == null ? "" : text).trim().toLowerCase();
19 -// --- prefix routing: `=`->calculator, `>`->action, `clip `->clipboard, else all.
20 -// Strips the prefix into `query`. Returns {intent, query}. ---
21 10 function prefixIntent(raw) {
22 - var text = String(raw == null ? "" : raw).trim();
23 - if (text.indexOf("=") === 0)
24 - return { intent: "calculator", query: text.slice(1).trim() };
25 - if (text.indexOf(">") === 0)
26 - return { intent: "action", query: text.slice(1).trim() };
27 - // `.trim()` above strips the trailing space, so match "clip" exactly or the
28 - // "clip <query>" form. (IPC also trims the arg, so a bare "clip " arrives as "clip".)
29 - var low = text.toLowerCase();
30 - if (low === "clip" || low.indexOf("clip ") === 0)
31 - return { intent: "clipboard", query: text.slice(4).trim() };
32 - return { intent: "all", query: text };
11 + return { intent: "app", query: String(raw == null ? "" : raw).trim() };
35 -// --- a char is part of a word (vs. a boundary separator: space, -, _, ., /, :) ---
36 14 function isWordChar(ch) {
37 15 return /[a-z0-9]/.test(ch);
40 -// --- greedy left-to-right subsequence match of q against t (both normalized).
41 -// Returns {matched, firstIndex, contiguous, boundaryHits}. `contiguous` counts
42 -// adjacent matched positions; `boundaryHits` counts matches at a word start. ---
43 18 function subsequenceMatch(q, t) {
44 19 var qi = 0;
45 20 var positions = [];
52 27 if (qi < q.length)
53 28 return { matched: false, firstIndex: -1, contiguous: 0, boundaryHits: 0 };
54 30 var contiguous = 0;
55 31 var boundaryHits = 0;
56 32 for (var i = 0; i < positions.length; i++) {
60 36 if (p === 0 || !isWordChar(t.charAt(p - 1)))
61 37 boundaryHits++;
63 - return {
64 - matched: true,
65 - firstIndex: positions[0],
66 - contiguous: contiguous,
67 - boundaryHits: boundaryHits
68 - };
39 + return { matched: true, firstIndex: positions[0], contiguous: contiguous, boundaryHits: boundaryHits };
71 -// --- subsequence-aware ranking. Bands stay separated so categories can't cross:
72 -// exact +1000, prefix +800-len, word-boundary subsequence (base 600), loose
73 -// subsequence (base 350), substring fallback, else -1. `boost` is a per-provider
74 -// weight; empty query returns boost so every row lists. ---
75 42 function fuzzyScore(query, title, boost) {
76 43 var b = Number(boost) || 0;
77 44 var q = normalize(query);
86 53 var m = subsequenceMatch(q, t);
87 54 if (m.matched) {
88 - // every matched char at a word start => acronym-grade (high band)
89 55 var allBoundary = m.boundaryHits === q.length;
90 56 var base = allBoundary ? 600 : 350;
91 - var bonus = m.contiguous * 10 + m.boundaryHits * 15 - m.firstIndex;
92 - return b + base + bonus;
57 + return b + base + m.contiguous * 10 + m.boundaryHits * 15 - m.firstIndex;
94 - // substring fallback (any contiguous substring is already a subsequence, so
95 - // this is effectively unreachable — kept to document intent).
96 - var idx = t.indexOf(q);
97 - if (idx > 0)
98 - return b + 300 - idx;
99 59 return -1;
102 -// --- regex-guarded arithmetic eval. Returns a formatted string, or null on
103 -// guard failure / non-finite / non-number. Integers print plain; otherwise
104 -// rounded to 4 decimals. ---
105 -function calculatorValue(expression) {
106 - var expr = String(expression == null ? "" : expression).replace(/\s+/g, "");
107 - if (expr.length === 0 || !/^[0-9.+\-*/()%]+$/.test(expr))
108 - return null;
109 - try {
110 - var value = Function('"use strict"; return (' + expr + ')')();
111 - if (typeof value !== "number" || !isFinite(value))
112 - return null;
113 - return value === Math.floor(value)
114 - ? String(value)
115 - : String(Math.round(value * 10000) / 10000);
116 - } catch (error) {
117 - return null;
62 +function list(value) {
63 + var out = [];
64 + var src = value || [];
65 + for (var i = 0; i < src.length; i++) {
66 + var text = String(src[i] || "").trim();
67 + if (text.length > 0)
68 + out.push(text);
70 + return out;
121 -// --- primary verb per provider (row may override via row.verb) ---
122 -function rowVerb(provider, row) {
123 - if (row && row.verb)
124 - return String(row.verb);
125 - if (provider === "calculator") return "copy-result";
126 - if (provider === "action") return "run-action";
127 - if (provider === "app") return "launch-app";
128 - if (provider === "clipboard") return "copy-clipboard";
129 - if (provider === "window") return "focus-window";
130 - return "activate";
73 +function commandList(value) {
74 + var out = [];
75 + var src = value || [];
76 + for (var i = 0; i < src.length; i++)
77 + out.push(String(src[i]));
78 + return out;
133 -// --- semantic icon role per provider (row may override via row.iconRole) ---
134 -function rowIconRole(provider, row) {
135 - if (row && row.iconRole)
136 - return String(row.iconRole);
137 - if (provider === "calculator") return "calculator";
138 - if (provider === "action") return "shell-action";
139 - if (provider === "app") return "desktop-entry";
140 - if (provider === "clipboard") return "clipboard";
141 - if (provider === "window") return "niri-window";
142 - return "item";
81 +function primaryCategory(categories) {
82 + var skip = { Qt: true, KDE: true, GNOME: true, GTK: true, Application: true, Core: true };
83 + for (var i = 0; i < categories.length; i++) {
84 + var cat = categories[i];
85 + if (!skip[cat])
86 + return cat;
87 + }
88 + return categories[0] || "App";
145 -// --- Nerd Font fallback glyph per provider (apps fall back to rocket) ---
146 -function providerGlyph(provider) {
147 - if (provider === "action") return GLYPH_ACTION;
148 - if (provider === "calculator") return GLYPH_CALCULATOR;
149 - if (provider === "clipboard") return GLYPH_CLIPBOARD;
150 - if (provider === "window") return GLYPH_WINDOW;
151 - return GLYPH_APP;
154 -// --- clone + enrich a row for the result list. Preserves `icon` (desktop icon
155 -// name) for apps so the view can render the real themed image. ---
156 -function shapeRow(row, provider, score) {
157 - var next = Object.assign({}, row || {});
158 - next.provider = provider;
159 - next.iconRole = rowIconRole(provider, next);
160 - next.verb = rowVerb(provider, next);
161 - next.glyph = providerGlyph(provider);
162 - next.subtitle = next.subtitle || provider;
163 - next.score = score;
164 - next.keyboard = true;
165 - return next;
168 -// --- filter (score < 0 drops) + shape into the results list ---
169 -function pushResult(results, row, provider, score) {
170 - if (score < 0)
171 - return;
172 - results.push(shapeRow(row, provider, score));
175 -// --- Map Quickshell DesktopEntry objects to launcher rows, sorted by title.
176 -// Exec field codes (%f, %u, …) are already stripped from `command` by Quickshell.
177 -// Keeps `icon` (desktop icon name) for real themed-icon rendering. ---
178 -function buildApps(entries) {
179 - var list = entries || [];
91 +function buildDesktopActions(actions) {
180 92 var rows = [];
181 - for (var i = 0; i < list.length; i++) {
182 - var e = list[i];
93 + var src = actions || [];
94 + for (var i = 0; i < src.length; i++) {
95 + var a = src[i];
96 + if (!a || !a.name)
97 + continue;
98 + rows.push({
99 + id: String(a.id || a.name),
100 + title: String(a.name),
101 + icon: String(a.icon || ""),
102 + exec: String(a.execString || ""),
103 + execArgv: commandList(a.command)
104 + });
106 + return rows;
109 +function buildApps(entries) {
110 + var rows = [];
111 + var src = entries || [];
112 + for (var i = 0; i < src.length; i++) {
113 + var e = src[i];
183 114 if (!e || !e.name)
184 115 continue;
185 117 var id = String(e.id || e.name);
186 - var argv = [];
187 - var command = e.command || [];
188 - for (var j = 0; j < command.length; j++) argv.push(String(command[j]));
118 + var categories = list(e.categories);
119 + var keywords = list(e.keywords);
120 + var genericName = String(e.genericName || "");
121 + var comment = String(e.comment || "");
122 + var kind = genericName || primaryCategory(categories);
123 + var category = primaryCategory(categories);
124 + var actions = buildDesktopActions(e.actions);
189 126 rows.push({
190 127 id: "app:" + id,
191 128 title: String(e.name),
192 - subtitle: String(e.comment || e.genericName || id),
129 + subtitle: kind + (category && category !== kind ? " · " + category : ""),
130 + genericName: genericName,
131 + comment: comment,
193 132 desktopId: id,
194 - // uwsm resolves the desktop id (with .desktop suffix) for proper
195 - // startup/env integration; argv is the fallback launch path.
196 133 desktopPath: id + ".desktop",
134 + startupClass: String(e.startupClass || ""),
197 135 exec: String(e.execString || ""),
198 - execArgv: argv,
136 + execArgv: commandList(e.command),
137 + workingDirectory: String(e.workingDirectory || ""),
199 138 icon: String(e.icon || ""),
200 139 terminal: !!e.runInTerminal,
140 + categories: categories,
141 + keywords: keywords,
142 + actions: actions,
143 + details: [
144 + { label: "category", value: category },
145 + { label: "keywords", value: keywords.slice(0, 4).join("; ") || "—" },
146 + { label: "terminal", value: e.runInTerminal ? "yes" : "no" }
147 + ],
148 + searchText: [e.name, genericName, comment, id, e.startupClass].concat(categories).concat(keywords).join(" "),
201 149 route: "desktop-entry"
207 155 return rows;
210 -// --- the pure ranking core. Takes the already-gathered source bundles (no I/O)
211 -// and returns {results, selectedIndex, providerIntent, calc}. Applies prefix
212 -// intent, scores each provider, filters non-matches, sorts by score then title. ---
213 -function rankResults(rawQuery, sources) {
214 - var src = sources || {};
215 - var apps = src.apps || [];
216 - var actions = src.actions || [];
217 - var windows = src.windows || [];
218 - var clipRows = src.clipRows || [];
158 +function shapeRow(row, provider, score) {
159 + var next = Object.assign({}, row || {});
160 + next.provider = "app";
161 + next.iconRole = "desktop-entry";
162 + next.verb = "open";
163 + next.glyph = GLYPH_APP;
164 + next.score = score;
165 + next.keyboard = true;
166 + return next;
169 +function rankResults(rawQuery, sources) {
170 + var apps = (sources || {}).apps || [];
220 171 var intent = prefixIntent(rawQuery);
221 - var provider = intent.intent;
222 172 var query = intent.query;
223 173 var results = [];
225 - var calcValue = calculatorValue(query);
226 - var calc = null;
227 - if ((provider === "calculator" || provider === "all") && calcValue !== null) {
228 - calc = {
229 - id: "calc:" + query,
230 - title: calcValue,
231 - subtitle: query,
232 - value: calcValue,
233 - route: "calculator"
234 - };
235 - pushResult(results, calc, "calculator", provider === "calculator" ? 2000 : 600);
236 - }
238 - if (provider === "action" || provider === "all") {
239 - for (var a = 0; a < actions.length; a++)
240 - pushResult(results, actions[a], "action",
241 - fuzzyScore(query, actions[a].title, provider === "action" ? 1500 : 300));
242 - }
244 - if (provider === "app" || provider === "all") {
245 - for (var p = 0; p < apps.length; p++)
246 - pushResult(results, Object.assign({ route: "desktop-entry" }, apps[p]),
247 - "app", fuzzyScore(query, apps[p].title, 900));
248 - }
250 - if (provider === "clipboard" || provider === "all") {
251 - for (var c = 0; c < clipRows.length; c++)
252 - pushResult(results, Object.assign({ route: "clipboard" }, clipRows[c]),
253 - "clipboard", fuzzyScore(query, clipRows[c].title, provider === "clipboard" ? 1400 : 200));
254 - }
256 - // Windows have no prefix intent, so they list only in `all` (or an explicit
257 - // `window` intent, kept for forward-compat). This intentionally differs from
258 - // the old search() which added windows under every intent.
259 - if (provider === "all" || provider === "window") {
260 - for (var w = 0; w < windows.length; w++) {
261 - var win = windows[w];
262 - var title = win.title || win.app_id || win.appId || ("window " + win.id);
263 - pushResult(results, {
264 - id: String(win.id),
265 - title: title,
266 - subtitle: win.app_id || win.appId || "window",
267 - route: "niri-window",
268 - windowId: win.id
269 - }, "window", fuzzyScore(query, title, provider === "window" ? 1300 : 250));
270 - }
175 + for (var i = 0; i < apps.length; i++) {
176 + var app = apps[i];
177 + var score = Math.max(
178 + fuzzyScore(query, app.title, 900),
179 + fuzzyScore(query, app.searchText || app.title, 760)
180 + );
181 + if (score >= 0)
182 + results.push(shapeRow(app, "app", score));
273 185 results.sort(function (x, y) {
277 189 return {
278 190 results: results,
279 191 selectedIndex: results.length > 0 ? 0 : -1,
280 - providerIntent: provider,
281 - calc: calc
192 + providerIntent: intent.intent
285 196 if (typeof module !== 'undefined' && module.exports) {
286 - module.exports = { normalize: normalize, prefixIntent: prefixIntent,
287 - subsequenceMatch: subsequenceMatch, fuzzyScore: fuzzyScore,
288 - calculatorValue: calculatorValue, rowVerb: rowVerb,
289 - rowIconRole: rowIconRole, providerGlyph: providerGlyph,
290 - shapeRow: shapeRow, pushResult: pushResult, buildApps: buildApps,
291 - rankResults: rankResults };
197 + module.exports = {
198 + normalize: normalize,
199 + prefixIntent: prefixIntent,
200 + subsequenceMatch: subsequenceMatch,
201 + fuzzyScore: fuzzyScore,
202 + buildDesktopActions: buildDesktopActions,
203 + buildApps: buildApps,
204 + shapeRow: shapeRow,
205 + rankResults: rankResults
206 + };

quickshell/nuguland/launch.test.js

Modified
1 1 const assert = require('assert');
2 2 const L = require('./launch.js');
4 -// --- prefixIntent: each prefix routes + strips, returns {intent, query} ---
5 -assert.deepStrictEqual(L.prefixIntent('=2+2'), { intent: 'calculator', query: '2+2' });
6 -assert.deepStrictEqual(L.prefixIntent('>lock'), { intent: 'action', query: 'lock' });
7 -assert.deepStrictEqual(L.prefixIntent('clip foo'), { intent: 'clipboard', query: 'foo' });
8 -assert.deepStrictEqual(L.prefixIntent('firefox'), { intent: 'all', query: 'firefox' });
9 -// the key is `intent`, NOT `provider` (contract rename)
10 -assert.strictEqual(L.prefixIntent('=2+2').intent, 'calculator');
11 -assert.strictEqual(L.prefixIntent('=2+2').provider, undefined);
12 -assert.strictEqual(L.prefixIntent('CLIP bar').intent, 'clipboard'); // prefix is case-insensitive
4 +assert.deepStrictEqual(L.prefixIntent('=2+2'), { intent: 'app', query: '=2+2' });
5 +assert.deepStrictEqual(L.prefixIntent('firefox'), { intent: 'app', query: 'firefox' });
14 -// --- fuzzyScore: exact > prefix > word-boundary subsequence > loose subsequence > -1 ---
15 -const exact = L.fuzzyScore('firefox', 'firefox', 0); // 1000
16 -const prefix = L.fuzzyScore('fire', 'firefox', 0); // 800 - 7
17 -const wbSub = L.fuzzyScore('fb', 'firefox browser', 0); // acronym, high band
18 -const loose = L.fuzzyScore('frfx', 'firefox', 0); // scattered, low band
7 +const exact = L.fuzzyScore('firefox', 'firefox', 0);
8 +const prefix = L.fuzzyScore('fire', 'firefox', 0);
9 +const wbSub = L.fuzzyScore('fb', 'firefox browser', 0);
10 +const loose = L.fuzzyScore('frfx', 'firefox', 0);
19 11 assert.ok(exact > prefix, 'exact > prefix');
20 12 assert.ok(prefix > wbSub, 'prefix > word-boundary subsequence');
21 13 assert.ok(wbSub > loose, 'word-boundary subsequence > loose subsequence');
22 -assert.ok(loose >= 0, 'loose subsequence is a match (>= 0)');
23 -// "frfx" finds "firefox"; "zzz" does not
24 -assert.ok(L.fuzzyScore('frfx', 'firefox', 0) > 0, 'frfx matches firefox');
25 -assert.strictEqual(L.fuzzyScore('zzz', 'firefox', 0), -1, 'zzz does not match firefox');
26 -// empty query returns the bare boost (so every row lists)
14 +assert.ok(loose >= 0, 'loose subsequence is a match');
15 +assert.strictEqual(L.fuzzyScore('zzz', 'firefox', 0), -1);
27 16 assert.strictEqual(L.fuzzyScore('', 'anything', 900), 900);
28 -// exact concrete value + provider boost adds in
29 -assert.strictEqual(L.fuzzyScore('firefox', 'firefox', 900), 1900);
31 -// --- calculatorValue: evaluates, rejects non-arithmetic, null on fail/non-finite ---
32 -assert.strictEqual(L.calculatorValue('2+2'), '4');
33 -assert.strictEqual(L.calculatorValue('2*21'), '42');
34 -assert.strictEqual(L.calculatorValue(' 1 + 1 '), '2'); // whitespace stripped
35 -assert.strictEqual(L.calculatorValue('1/2'), '0.5'); // non-integer formatting
36 -assert.strictEqual(L.calculatorValue('a()'), null); // letters rejected by guard
37 -assert.strictEqual(L.calculatorValue('x=1'), null); // assignment rejected by guard
38 -assert.strictEqual(L.calculatorValue('1/0'), null); // Infinity -> non-finite
39 -assert.strictEqual(L.calculatorValue(''), null); // empty -> null
41 -// --- buildApps: sorts by title + carries the desktop icon name ---
42 18 const apps = L.buildApps([
43 - { id: 'gimp', name: 'GIMP', icon: 'gimp', comment: 'Image editor' },
44 - { id: 'firefox', name: 'Firefox', icon: 'firefox-icon', comment: 'Web browser' }
19 + {
20 + id: 'gimp',
21 + name: 'GIMP',
22 + icon: 'gimp',
23 + comment: 'Image editor',
24 + genericName: 'Image Editor',
25 + categories: ['Graphics'],
26 + keywords: ['paint', 'photo']
27 + },
28 + {
29 + id: 'firefox',
30 + name: 'Firefox',
31 + icon: 'firefox-icon',
32 + genericName: 'Web Browser',
33 + categories: ['Network'],
34 + keywords: ['web', 'browser'],
35 + actions: [
36 + { id: 'new-window', name: 'New Window', icon: 'window-new', command: ['firefox', '--new-window'] },
37 + { id: 'private-window', name: 'Private Window', command: ['firefox', '--private-window'] }
38 + ]
39 + }
46 -assert.deepStrictEqual(apps.map(a => a.title), ['Firefox', 'GIMP']); // alpha sorted
47 -assert.strictEqual(apps[0].icon, 'firefox-icon'); // icon carried
48 -assert.strictEqual(apps[1].icon, 'gimp');
42 +assert.deepStrictEqual(apps.map(a => a.title), ['Firefox', 'GIMP']);
43 +assert.strictEqual(apps[0].icon, 'firefox-icon');
49 44 assert.strictEqual(apps[0].id, 'app:firefox');
50 45 assert.strictEqual(apps[0].desktopPath, 'firefox.desktop');
51 -assert.ok(L.buildApps([{ id: 'noname' }]).length === 0); // entries without name skipped
46 +assert.strictEqual(apps[0].subtitle, 'Web Browser · Network');
47 +assert.strictEqual(apps[0].details[0].value, 'Network');
48 +assert.strictEqual(apps[0].details[1].value, 'web; browser');
49 +assert.strictEqual(apps[0].actions[0].title, 'New Window');
50 +assert.deepStrictEqual(apps[0].actions[0].execArgv, ['firefox', '--new-window']);
51 +assert.ok(L.buildApps([{ id: 'noname' }]).length === 0);
53 -// --- rankResults: exact app title ranks to selectedIndex 0, icon preserved ---
54 -const allRank = L.rankResults('Firefox', { apps: apps });
55 -assert.strictEqual(allRank.providerIntent, 'all');
56 -assert.strictEqual(allRank.selectedIndex, 0);
57 -assert.strictEqual(allRank.results[0].title, 'Firefox');
58 -assert.strictEqual(allRank.results[0].provider, 'app');
59 -assert.strictEqual(allRank.results[0].icon, 'firefox-icon'); // icon survives shaping
53 +const titleRank = L.rankResults('Firefox', { apps });
54 +assert.strictEqual(titleRank.providerIntent, 'app');
55 +assert.strictEqual(titleRank.selectedIndex, 0);
56 +assert.strictEqual(titleRank.results[0].title, 'Firefox');
57 +assert.strictEqual(titleRank.results[0].provider, 'app');
58 +assert.strictEqual(titleRank.results[0].icon, 'firefox-icon');
61 -// --- rankResults: `>` honors action intent ---
62 -const actions = [
63 - { id: 'lock', title: 'Lock', subtitle: 'Lock this session', route: 'service' },
64 - { id: 'overview', title: 'Overview', subtitle: 'Open niri overview', route: 'service' }
65 -];
66 -const actionRank = L.rankResults('>', { apps: apps, actions: actions });
67 -assert.strictEqual(actionRank.providerIntent, 'action');
68 -assert.ok(actionRank.results.length >= 1);
69 -assert.ok(actionRank.results.every(r => r.provider === 'action')); // no apps leak in
70 -assert.strictEqual(actionRank.selectedIndex, 0);
60 +const keywordRank = L.rankResults('browser', { apps });
61 +assert.strictEqual(keywordRank.results[0].title, 'Firefox');
62 +assert.ok(keywordRank.results.every(r => r.provider === 'app'));
72 -// --- rankResults: `clip ` honors clipboard intent ---
73 -const clipRows = [{ id: 'c1', title: 'hello clip', body: 'hello clip' }];
74 -const clipRank = L.rankResults('clip hello', { apps: apps, clipRows: clipRows });
75 -assert.strictEqual(clipRank.providerIntent, 'clipboard');
76 -assert.ok(clipRank.results.length >= 1);
77 -assert.ok(clipRank.results.every(r => r.provider === 'clipboard'));
79 -// --- rankResults: `=2*21` emits a calc row with value 42 (string) ---
80 -const calcRank = L.rankResults('=2*21', {});
81 -assert.strictEqual(calcRank.providerIntent, 'calculator');
82 -assert.ok(calcRank.calc, 'calc row present');
83 -assert.strictEqual(calcRank.calc.value, '42');
84 -assert.strictEqual(calcRank.results[0].provider, 'calculator');
85 -assert.strictEqual(calcRank.results[0].title, '42');
87 -// --- rankResults: empty query lists apps sorted, selectedIndex 0 ---
88 -const emptyRank = L.rankResults('', { apps: apps });
64 +const emptyRank = L.rankResults('', { apps });
89 65 assert.strictEqual(emptyRank.selectedIndex, 0);
90 66 assert.deepStrictEqual(emptyRank.results.map(r => r.title), ['Firefox', 'GIMP']);

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 +//@ pragma IconTheme Papirus
2 +pragma ComponentBehavior: Bound
1 3 import QtQuick
2 4 import Quickshell
3 5 import Quickshell.Io
13 15 // falls back to the first connected screen. The wallpaper backdrop and the
14 16 // polkit security prompt deliberately stay on every screen.
15 17 property string primaryOutput: ""
16 - readonly property string primaryScreenName: {
18 + readonly property var primaryScreens: {
17 19 const screens = Quickshell.screens;
18 20 const want = String(shell.primaryOutput || "");
19 - if (want.length > 0)
20 - for (let i = 0; i < screens.length; i++)
21 - if (String(screens[i].name) === want)
22 - return want;
21 + for (let i = 0; i < screens.length; i++)
22 + if (want.length === 0 || String(screens[i].name) === want)
23 + return [screens[i]];
24 - return screens.length > 0 ? String(screens[0].name) : "";
25 + return [];
27 + readonly property string primaryScreenName: primaryScreens.length > 0 ? String(primaryScreens[0].name) : ""
27 29 // Bar orientation: "horizontal" (top edge, default) or "vertical" (left
28 30 // edge). Injected into the Bar and the SurfaceManager so layout and popout
88 90 Launcher {
89 91 id: launcher
91 - niriService: niri
92 - clipboardService: clipboard
95 94 Osd {
174 173 screen: modelData
175 174 // primary monitor only — no value showing the OSD once per screen.
176 175 visible: osd.visibleState && modelData.name === shell.primaryScreenName
177 - implicitWidth: 300
178 - implicitHeight: osdCard.implicitHeight + 16
176 + implicitWidth: 316
177 + implicitHeight: osdCard.implicitHeight + 64
179 178 color: "transparent"
180 179 exclusionMode: ExclusionMode.Ignore
181 180 WlrLayershell.layer: WlrLayer.Overlay
187 186 right: true
190 - margins {
191 - top: 48
192 - right: 16
195 189 // Mirrors the notification card's visual language (backdrop
196 190 // alpha, radius, IconImage, IBM Plex, accent) but stays a
197 191 // glance-only meter — no close/actions/body. The mask is left
209 203 anchors.left: parent.left
210 204 anchors.right: parent.right
211 205 anchors.top: parent.top
212 - anchors.margins: 8
206 + anchors.topMargin: 56
207 + anchors.rightMargin: 24
208 + anchors.leftMargin: 8
209 + anchors.bottomMargin: 8
213 210 implicitHeight: osdRow.implicitHeight + 24
214 211 radius: 14
215 212 color: nuguTheme.withAlpha(nuguTheme.ui.backdrop, 0.92)
297 294 radius: parent.radius
298 295 color: osdCard.roleColor
299 296 Behavior on width {
300 - NumberAnimation { duration: nuguTheme.lowPowerMode ? 0 : 160; easing.type: Easing.OutCubic }
297 + NumberAnimation {
298 + duration: nuguTheme.lowPowerMode ? 0 : 160
299 + easing.type: Easing.OutCubic
322 322 duration: nuguTheme.lowPowerMode ? 0 : 120
323 323 easing.type: Easing.OutCubic
330 - mask: Region {
328 + mask: Region {}
339 333 Variants {
342 336 delegate: Component {
343 337 PanelWindow {
338 + id: toastSurface
344 340 required property var modelData
346 342 readonly property var toasts: notifications.activeToastRows()
348 344 objectName: "notificationToastSurface"
349 345 screen: modelData
350 346 // primary monitor only, so a toast shows once, not once per screen.
351 - visible: toasts.length > 0 && modelData.name === shell.primaryScreenName
352 - implicitWidth: 380
353 - implicitHeight: Math.max(1, toastColumn.implicitHeight + 16)
347 + visible: toastSurface.toasts.length > 0 && modelData.name === shell.primaryScreenName
348 + implicitWidth: 404
349 + implicitHeight: Math.max(1, toastColumn.implicitHeight + 64)
354 350 color: "transparent"
355 351 exclusionMode: ExclusionMode.Ignore
356 352 WlrLayershell.layer: WlrLayer.Overlay
357 353 WlrLayershell.namespace: "nuguland-toast"
358 354 WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
360 - anchors { top: true; right: true }
361 - margins { top: 48; right: 16 }
356 + anchors {
357 + top: true
358 + right: true
363 360 Column {
364 361 id: toastColumn
365 362 anchors.top: parent.top
366 363 anchors.right: parent.right
367 - anchors.margins: 8
368 - width: parent.width - 16
364 + anchors.topMargin: 56
365 + anchors.rightMargin: 24
366 + anchors.leftMargin: 8
367 + anchors.bottomMargin: 8
368 + width: parent.width - 32
369 369 spacing: 8
371 371 Repeater {
372 - model: toasts
372 + model: toastSurface.toasts
373 373 // Wrap in a plain Item: Qt6 does NOT inject an array
374 374 // model's modelData into a required property on an
375 375 // external-component (NotificationCard) delegate root —
387 387 theme: nuguTheme
388 388 modelData: toastWrap.modelData
389 389 compact: true
390 - onDismiss: (id) => notifications.dismissToast(id)
390 + onDismiss: id => notifications.dismissToast(id)
391 391 onInvokeAction: (id, actionId) => notifications.runAction(id, actionId)
393 393 // Dismiss + drain derive from the service-stamped
427 427 radius: 1
428 428 color: nuguTheme ? nuguTheme.ui.accent : "transparent"
429 429 width: (toastCard.width - 24) * Math.max(0, Math.min(100, toastWrap.toastProgress)) / 100
430 - Behavior on width { NumberAnimation { duration: nuguTheme && nuguTheme.lowPowerMode ? 0 : 200 } }
430 + Behavior on width {
431 + NumberAnimation {
432 + duration: nuguTheme && nuguTheme.lowPowerMode ? 0 : 200
432 436 Rectangle {
433 437 visible: toastWrap.toastExpiry > 0 && !toastWrap.toastHasProgress
452 456 // Accept input only over the toast cards (click to dismiss);
453 457 // the transparent margins stay click-through to apps below.
454 - mask: Region { item: toastColumn }
458 + mask: Region {
459 + item: toastColumn
484 490 theme: nuguTheme
485 491 privilegeService: privilege
494 497 Variants {
502 505 resourceService: resources
503 506 lowPowerMode: power.lowPowerMode()
510 511 Variants {
511 - model: Quickshell.screens
512 + model: shell.barRemap ? shell.primaryScreens : []
513 514 delegate: Component {
517 518 // primary monitor only; the bar consolidates every output's
518 519 // workspaces into per-output trays (see Bar.qml workspaceStrip).
519 - visible: shell.barRemap && modelData.name === shell.primaryScreenName
520 520 screen: modelData
521 521 theme: nuguTheme
522 522 niriService: niri
540 540 formatService: format
541 541 orientation: shell.orientation
548 546 IpcHandler {
562 560 return audio.muteInput();
565 - function route(action: string) : string {
563 + function route(action: string): string {
566 564 return audio.route(action);
594 592 return media.action("repeat");
597 - function route(action: string) : string {
595 + function route(action: string): string {
598 596 return media.action(action);
604 602 IpcHandler {
605 - function increase() : string {
603 + function increase(): string {
606 604 return brightness.increase();
609 - function decrease() : string {
607 + function decrease(): string {
610 608 return brightness.decrease();
616 614 IpcHandler {
617 - function usageState() : string {
615 + function usageState(): string {
618 616 return usage.stateJson();
621 - function record(name: string) : string {
619 + function record(name: string): string {
622 620 return usage.record(name);
628 626 IpcHandler {
629 627 target: "caldav"
630 - function state() : string { return caldav.stateJson(); }
631 - function selfTest() : string { return caldav.selfTest(); }
632 - function refresh() : string { caldav.refresh(); return caldav.stateJson(); }
628 + function state(): string {
629 + return caldav.stateJson();
631 + function selfTest(): string {
632 + return caldav.selfTest();
634 + function refresh(): string {
635 + caldav.refresh();
636 + return caldav.stateJson();
635 640 IpcHandler {
636 641 target: "system"
637 - function state() : string { return resources.stateJson(); }
638 - function selfTest() : string { return resources.selfTest(); }
642 + function state(): string {
643 + return resources.stateJson();
645 + function selfTest(): string {
646 + return resources.selfTest();
641 650 IpcHandler {
642 651 target: "clipboard"
643 - function selfTest() : string { return clipboard.selfTest(); }
652 + function selfTest(): string {
653 + return clipboard.selfTest();
646 657 IpcHandler {
647 - function ping() : string {
658 + function ping(): string {
648 659 return "nuguland";
651 - function niriState() : string {
662 + function niriState(): string {
652 663 return niri.stateJson();
655 - function niriSelfTest() : string {
666 + function niriSelfTest(): string {
656 667 return JSON.stringify(niri.selfTest());
659 - function setOrientation(mode: string) : string {
670 + function setOrientation(mode: string): string {
660 671 const want = String(mode);
661 672 if (want === "toggle")
662 673 shell.orientation = shell.orientation === "vertical" ? "horizontal" : "vertical";
668 679 return shell.orientation;
671 - function abbreviateSelfTest() : string {
682 + function abbreviateSelfTest(): string {
672 683 return JSON.stringify(format.abbreviateSelfTest());
677 688 return nuguTheme.mode;
680 - function screenshotScreen(path: string) : string {
691 + function screenshotScreen(path: string): string {
681 692 niri.screenshotScreen(path);
682 693 return path;
685 - function windowRuleMetadata() : string {
696 + function windowRuleMetadata(): string {
686 697 return niri.windowRuleMetadata();
689 - function windowCardAction(kind: string) : string {
700 + function windowCardAction(kind: string): string {
690 701 return niri.windowCardAction(kind);
693 - function openWindow() : string {
704 + function openWindow(): string {
694 705 return surfaceManager.openRegisteredPopout("window");
697 - function timeState() : string {
708 + function timeState(): string {
698 709 return time.stateJson();
701 - function timeStateAt(iso: string) : string {
712 + function timeStateAt(iso: string): string {
702 713 return time.stateAt(iso);
705 - function timeRelative(fromIso: string, toIso: string) : string {
716 + function timeRelative(fromIso: string, toIso: string): string {
706 717 return time.relative(fromIso, toIso);
709 - function timeCalendar(year: int, month: int, selectedDay: int) : string {
720 + function timeCalendar(year: int, month: int, selectedDay: int): string {
710 721 return time.calendar(year, month, selectedDay);
713 - function openClock() : string {
724 + function openClock(): string {
714 725 return surfaceManager.openRegisteredPopout("clock");
717 - function systemWidgetState() : string {
728 + function systemWidgetState(): string {
718 729 return resources.systemWidgetState();
721 - function openSystem() : string {
732 + function openSystem(): string {
722 733 return surfaceManager.openRegisteredPopout("system");
725 - function notificationWidgetState(attention: bool, active: bool) : string {
736 + function notificationWidgetState(attention: bool, active: bool): string {
726 737 return notifications.widgetState(attention, active);
729 - function notificationsState() : string {
740 + function notificationsState(): string {
730 741 return notifications.stateJson();
733 - function notificationsToggleDnd() : string {
744 + function notificationsToggleDnd(): string {
734 745 return notifications.toggleDnd();
737 - function notificationsAction(id: string, actionId: string) : string {
748 + function notificationsAction(id: string, actionId: string): string {
738 749 return notifications.runAction(id, actionId);
741 - function notificationsReply(id: string, text: string) : string {
752 + function notificationsReply(id: string, text: string): string {
742 753 return notifications.sendReply(id, text);
745 - function notificationsToggleGroup(appName: string) : string {
756 + function notificationsToggleGroup(appName: string): string {
746 757 return notifications.toggleGroup(appName);
749 - function notificationsDiscardAll() : string {
760 + function notificationsDiscardAll(): string {
750 761 return notifications.discardAllNotifications();
753 - function notificationsSelfTest() : string {
764 + function notificationsSelfTest(): string {
754 765 return JSON.stringify(notifications.selfTest());
757 - function notificationsDismissToasts() : string {
768 + function notificationsDismissToasts(): string {
758 769 return notifications.dismissToasts();
761 - function trayWidgetState(attention: bool, active: bool) : string {
772 + function trayWidgetState(attention: bool, active: bool): string {
762 773 return tray.widgetState(attention, active);
765 - function trayState() : string {
776 + function trayState(): string {
766 777 return tray.stateJson();
769 - function openTray() : string {
780 + function openTray(): string {
770 781 return surfaceManager.openRegisteredPopout("tray");
773 - function traySelectItem(id: string) : string {
784 + function traySelectItem(id: string): string {
774 785 return tray.selectItem(id);
777 - function trayMenuExpand(id: string) : string {
788 + function trayMenuExpand(id: string): string {
778 789 return tray.expandSubmenu(id);
781 - function trayMenuActivate(id: string) : string {
792 + function trayMenuActivate(id: string): string {
782 793 return tray.activateRow(id);
785 - function trayMenuClose(reason: string) : string {
796 + function trayMenuClose(reason: string): string {
786 797 return tray.closeMenu(reason);
789 - function launcherSearch(query: string) : string {
800 + function launcherSearch(query: string): string {
790 801 return launcher.search(query);
793 - function launcherState() : string {
804 + function launcherState(): string {
794 805 return launcher.stateJson();
797 - function launcherSelfTest() : string {
808 + function launcherSelfTest(): string {
798 809 return launcher.selfTest();
801 - function launcherLaunchRecord(rowJson: string) : string {
812 + function launcherLaunchRecord(rowJson: string): string {
802 813 return launcher.launchRecord(rowJson);
805 - function launcherActivate(rowJson: string) : string {
816 + function launcherActivate(rowJson: string): string {
806 817 return launcher.activate(rowJson);
809 - function launcherActivateFirst(query: string) : string {
820 + function launcherActivateAction(rowJson: string, index: string): string {
821 + return launcher.activateAction(rowJson, Number(index));
824 + function launcherActivateFirst(query: string): string {
810 825 return launcher.activateFirst(query);
813 - function launcherActivateId(id: string) : string {
828 + function launcherActivateId(id: string): string {
814 829 return launcher.activateId(id);
817 - function hotkey(id: string) : string {
832 + function hotkey(id: string): string {
818 833 return launcher.hotkey(id);
821 - function openLauncher() : string {
822 - return surfaceManager.openRegisteredPopout("launcher");
836 + function openLauncher(): string {
837 + return surfaceManager.openRegisteredPopout("launcher", niri.focusedOutputName);
825 - function osdTrigger(event: string, value: string) : string {
840 + function osdTrigger(event: string, value: string): string {
826 841 return osd.trigger(event, value);
829 - function osdState() : string {
844 + function osdState(): string {
830 845 return osd.stateJson();
833 - function osdExpire() : string {
848 + function osdExpire(): string {
834 849 return osd.expire();
837 - function clipboardState() : string {
852 + function clipboardState(): string {
838 853 return clipboard.stateJson();
841 - function clipboardSearch(query: string) : string {
856 + function clipboardSearch(query: string): string {
842 857 return clipboard.search(query);
845 - function clipboardTogglePin(id: string) : string {
860 + function clipboardTogglePin(id: string): string {
846 861 return clipboard.togglePin(id);
849 - function clipboardCopy(id: string) : string {
864 + function clipboardCopy(id: string): string {
850 865 return clipboard.copy(id);
853 - function clipboardPaste(id: string) : string {
868 + function clipboardPaste(id: string): string {
854 869 return clipboard.paste(id);
857 - function clipboardDelete(id: string) : string {
872 + function clipboardDelete(id: string): string {
858 873 return clipboard.deleteRow(id);
861 - function clipboardPrivateMode(enabled: bool) : string {
876 + function clipboardPrivateMode(enabled: bool): string {
862 877 return clipboard.setPrivateMode(enabled);
865 - function openClipboard() : string {
880 + function openClipboard(): string {
866 881 return surfaceManager.openRegisteredPopout("clipboard");
869 - function mediaState() : string {
884 + function mediaState(): string {
870 885 return media.stateJson();
873 - function openMedia() : string {
888 + function openMedia(): string {
874 889 return surfaceManager.openRegisteredPopout("media");
877 - function mediaAction(kind: string) : string {
892 + function mediaAction(kind: string): string {
878 893 return media.action(kind);
881 - function mediaSeek(position: real) : string {
896 + function mediaSeek(position: real): string {
882 897 return media.seek(position);
885 - function mediaSelect(id: string) : string {
900 + function mediaSelect(id: string): string {
886 901 return media.select(id);
889 - function audioState() : string {
904 + function audioState(): string {
890 905 return audio.stateJson();
893 - function audioSelfTest() : string {
908 + function audioSelfTest(): string {
894 909 return audio.selfTest();
897 - function openAudio() : string {
912 + function openAudio(): string {
898 913 return surfaceManager.openRegisteredPopout("audio");
901 - function privacyWidgetState() : string {
916 + function privacyWidgetState(): string {
902 917 return audio.privacyWidgetJson();
905 - function audioSetVolume(id: string, volume: real) : string {
920 + function audioSetVolume(id: string, volume: real): string {
906 921 return audio.setVolume(id, volume);
909 - function audioToggleMute(id: string) : string {
924 + function audioToggleMute(id: string): string {
910 925 return audio.toggleMute(id);
913 - function audioSetDefaultSink(id: string) : string {
928 + function audioSetDefaultSink(id: string): string {
914 929 return audio.setDefaultSink(id);
917 - function audioSetDefaultSource(id: string) : string {
932 + function audioSetDefaultSource(id: string): string {
918 933 return audio.setDefaultSource(id);
921 - function audioMoveStream(id: string, target: string) : string {
936 + function audioMoveStream(id: string, target: string): string {
922 937 return audio.moveStream(id, target);
925 - function brightnessState() : string {
940 + function brightnessState(): string {
926 941 return brightness.stateJson();
929 - function brightnessSelfTest() : string {
944 + function brightnessSelfTest(): string {
930 945 return brightness.selfTest();
933 - function openBrightness() : string {
948 + function openBrightness(): string {
934 949 return surfaceManager.openRegisteredPopout("brightness");
937 - function brightnessSetLevel(level: string) : string {
952 + function brightnessSetLevel(level: string): string {
938 953 return brightness.setLevel(level);
941 - function brightnessIncrease() : string {
956 + function brightnessIncrease(): string {
942 957 return brightness.increase();
945 - function brightnessDecrease() : string {
960 + function brightnessDecrease(): string {
946 961 return brightness.decrease();
949 - function idleState() : string {
964 + function idleState(): string {
950 965 return idle.stateJson();
953 - function idleToggle() : string {
968 + function idleToggle(): string {
954 969 return idle.toggle();
957 - function idleDisable() : string {
972 + function idleDisable(): string {
958 973 return idle.disable();
961 - function privilegeState() : string {
976 + function privilegeState(): string {
962 977 return privilege.stateJson();
965 - function privilegeSubmit(secret: string) : string {
980 + function privilegeSubmit(secret: string): string {
966 981 return privilege.submit(secret);
969 - function privilegeDeny() : string {
984 + function privilegeDeny(): string {
970 985 return privilege.deny();
973 - function privilegeCancel() : string {
988 + function privilegeCancel(): string {
974 989 return privilege.cancel();
977 - function privilegeFail(message: string) : string {
992 + function privilegeFail(message: string): string {
978 993 return privilege.fail(message);
981 - function privilegeClear() : string {
996 + function privilegeClear(): string {
982 997 return privilege.clear();
985 - function lockState() : string {
1000 + function lockState(): string {
986 1001 return lock.stateJson();
989 - function lockRequest() : string {
1004 + function lockRequest(): string {
990 1005 return lock.request();
993 - function lockType(secret: string) : string {
1008 + function lockType(secret: string): string {
994 1009 return lock.typeSecret(secret);
997 - function lockSubmit(secret: string) : string {
1012 + function lockSubmit(secret: string): string {
998 1013 return lock.submit(secret);
1001 - function lockCancel() : string {
1016 + function lockCancel(): string {
1002 1017 return lock.cancel();
1005 - function networkState() : string {
1020 + function networkState(): string {
1006 1021 return network.stateJson();
1009 - function networkSelfTest() : string {
1024 + function networkSelfTest(): string {
1010 1025 return network.selfTest();
1013 - function networkWidgetState() : string {
1028 + function networkWidgetState(): string {
1014 1029 const state = JSON.parse(network.stateJson());
1015 1030 state.barLabel = "network";
1016 1031 state.shader.values = [resources.networkRxLevel(), resources.networkTxLevel(), state.compact.signal / 100, state.wifi.enabled ? 1 : 0];
1028 1043 return network.scan();
1031 - function networkSelect(id: string) : string {
1046 + function networkSelect(id: string): string {
1032 1047 return network.select(id);
1035 - function networkToggleWifi(enabled: bool) : string {
1050 + function networkToggleWifi(enabled: bool): string {
1036 1051 return network.toggleWifi(enabled);
1039 - function networkForget(id: string) : string {
1054 + function networkForget(id: string): string {
1040 1055 return network.forget(id);
1044 1059 return network.checkConnectivity();
1047 - function bluetoothState() : string {
1062 + function bluetoothState(): string {
1048 1063 return bluetooth.stateJson();
1051 - function bluetoothScan() : string {
1066 + function bluetoothScan(): string {
1052 1067 return bluetooth.scan();
1055 - function bluetoothToggle(enabled: bool) : string {
1070 + function bluetoothToggle(enabled: bool): string {
1056 1071 return bluetooth.toggle(enabled);
1059 - function bluetoothDeviceAction(kind: string, id: string) : string {
1074 + function bluetoothDeviceAction(kind: string, id: string): string {
1060 1075 return bluetooth.deviceAction(kind, id);
1063 - function powerState() : string {
1078 + function powerState(): string {
1064 1079 return power.stateJson();
1067 - function openPower() : string {
1082 + function openPower(): string {
1068 1083 return surfaceManager.openRegisteredPopout("power");
1071 - function openNetwork() : string {
1086 + function openNetwork(): string {
1072 1087 return surfaceManager.openRegisteredPopout("connectivity");
1075 - function powerSelfTest() : string {
1090 + function powerSelfTest(): string {
1076 1091 return power.selfTest();
1079 - function powerSessionAction(kind: string) : string {
1094 + function powerSessionAction(kind: string): string {
1080 1095 return power.sessionAction(kind);
1083 - function powerConfirmAction(kind: string) : string {
1098 + function powerConfirmAction(kind: string): string {
1084 1099 return power.confirmAction(kind);
1087 - function powerCancelAction() : string {
1102 + function powerCancelAction(): string {
1088 1103 return power.cancelAction();
1091 - function screenshotsState() : string {
1106 + function screenshotsState(): string {
1092 1107 return screenshots.stateJson();
1095 - function screenshotsBeginSelection(x: real, y: real) : string {
1110 + function screenshotsBeginSelection(x: real, y: real): string {
1096 1111 return screenshots.beginSelection(x, y);
1099 - function screenshotsUpdateSelection(x: real, y: real) : string {
1114 + function screenshotsUpdateSelection(x: real, y: real): string {
1100 1115 return screenshots.updateSelection(x, y);
1103 - function screenshotsCompleteSelection(path: string) : string {
1118 + function screenshotsCompleteSelection(path: string): string {
1104 1119 return screenshots.completeSelection(path);
1107 - function screenshotsCancelSelection() : string {
1122 + function screenshotsCancelSelection(): string {
1108 1123 return screenshots.cancelSelection();
1111 - function screenshotsCapture(kind: string, path: string) : string {
1126 + function screenshotsCapture(kind: string, path: string): string {
1112 1127 return screenshots.capture(kind, path);
1115 - function screenshotsPickColor() : string {
1130 + function screenshotsPickColor(): string {
1116 1131 return screenshots.pickColor();
1119 - function screenshotsRecordAction(kind: string, id: string) : string {
1134 + function screenshotsRecordAction(kind: string, id: string): string {
1120 1135 return screenshots.recordAction(kind, id);
1123 - function screenshotsClear() : string {
1138 + function screenshotsClear(): string {
1124 1139 return screenshots.clear();
1127 - function openScreenshots() : string {
1142 + function openScreenshots(): string {
1128 1143 return surfaceManager.openRegisteredPopout("screenshots");
1131 - function registeredAnchors() : string {
1146 + function registeredAnchors(): string {
1132 1147 return surfaceManager.registeredAnchors();
1135 - function popoutContentCatalog() : string {
1150 + function popoutContentCatalog(): string {
1136 1151 return surfaceManager.popoutContentCatalog();
1139 - function setPopoutScreen(width: int, height: int) : string {
1154 + function setPopoutScreen(width: int, height: int): string {
1140 1155 return surfaceManager.setPopoutScreen(width, height);
1143 - function openPopout(name: string, anchor: string) : string {
1158 + function openPopout(name: string, anchor: string): string {
1144 1159 return surfaceManager.openPopout(name, anchor);
1147 - function openRegisteredPopout(name: string) : string {
1162 + function openRegisteredPopout(name: string): string {
1148 1163 return surfaceManager.openRegisteredPopout(name);
1151 - function openNotifications() : string {
1166 + function openNotifications(): string {
1152 1167 return surfaceManager.openRegisteredPopout("notifications");
1155 - function hoverRegisteredPopout(name: string) : string {
1170 + function hoverRegisteredPopout(name: string): string {
1156 1171 return surfaceManager.hoverRegisteredPopout(name);
1159 - function closePopout() : string {
1174 + function closePopout(): string {
1160 1175 return surfaceManager.closePopout("");
1163 - function popoutInteraction(kind: string) : string {
1178 + function popoutInteraction(kind: string): string {
1164 1179 return surfaceManager.popoutInteraction(kind);
1167 - function popoutState() : string {
1182 + function popoutState(): string {
1168 1183 return surfaceManager.popoutState();
1179 1194 component NuguText: Text {
1180 - required property QtObject theme
1195 + required property Theme theme
1181 1196 property string variant: "body"
1182 1197 property bool selected: false
1201 1216 onActiveChanged: {
1202 1217 if (active)
1203 1218 shake.restart();
1261 1275 duration: nuguTheme.lowPowerMode ? 0 : 30
1262 1276 easing.type: Easing.OutCubic
1267 1280 transform: Translate {
1275 1287 component PrivilegeSurface: Rectangle {
1276 1288 id: root
1278 - required property QtObject theme
1279 - required property QtObject privilegeService
1280 - property var state: privilegeService ? parseJson(privilegeService.stateJson(), {
1281 - "request": {
1282 - },
1283 - "privilegeSurfacePanelContract": {
1284 - },
1290 + required property Theme theme
1291 + required property Privilege privilegeService
1292 + property var panelState: privilegeService ? parseJson(privilegeService.stateJson(), {
1293 + "request": {},
1294 + "privilegeSurfacePanelContract": {},
1285 1295 "buttons": []
1286 1296 }) : ({
1287 - "request": {
1288 - },
1289 - "privilegeSurfacePanelContract": {
1290 - },
1291 - "buttons": []
1292 - })
1293 - readonly property var request: state.request || ({
1294 - })
1295 - readonly property var panel: state.privilegeSurfacePanelContract || ({
1296 - })
1297 + "request": {},
1298 + "privilegeSurfacePanelContract": {},
1299 + "buttons": []
1300 + })
1301 + readonly property var request: panelState.request || ({})
1302 + readonly property var panel: panelState.privilegeSurfacePanelContract || ({})
1297 1303 readonly property string source: "Quickshell Polkit manual agent.qml plus Nuguland Polkit.qml plus Nuguland PolkitService.qml"
1298 1304 readonly property bool isolatedSecuritySurface: true
1299 1305 readonly property bool requestIdentityCard: true
1318 1324 function submitSecret(secret) {
1319 1325 if (privilegeService)
1320 1326 refreshFrom(privilegeService.submit(secret));
1324 1329 function deny() {
1325 1330 if (privilegeService)
1326 1331 refreshFrom(privilegeService.deny());
1330 1334 function cancel() {
1331 1335 if (privilegeService)
1332 1336 refreshFrom(privilegeService.cancel());
1336 1339 color: theme ? theme.withAlpha(theme.ui.backdrop, 0.94) : "black"
1337 - visible: state.active || state.error.length > 0
1338 - Keys.onEscapePressed: (event) => {
1340 + visible: panelState.active || panelState.error.length > 0
1341 + Keys.onEscapePressed: event => {
1339 1342 event.accepted = true;
1340 1343 root.cancel();
1398 1401 width: parent.width
1399 1402 elide: Text.ElideMiddle
1406 1407 PrivilegeFailureShake {
1407 1408 objectName: "failureShakeSlot"
1408 - active: root.state.error && root.state.error.length > 0
1409 + active: root.panelState.error && root.panelState.error.length > 0
1409 1410 width: parent.width
1410 1411 height: secretBox.height
1416 1417 width: parent.width
1417 1418 height: 46
1418 1419 radius: 23
1419 - color: root.theme ? root.theme.withAlpha(root.state.error ? root.theme.error : root.theme.ui.focus, root.state.error ? 0.18 : 0.12) : "transparent"
1420 + color: root.theme ? root.theme.withAlpha(root.panelState.error ? root.theme.error : root.theme.ui.focus, root.panelState.error ? 0.18 : 0.12) : "transparent"
1420 1421 border.width: 0
1421 - border.color: root.theme ? (root.state.error ? root.theme.error : root.theme.ui.focus) : "transparent"
1422 + border.color: root.theme ? (root.panelState.error ? root.theme.error : root.theme.ui.focus) : "transparent"
1423 1424 NuguText {
1424 1425 anchors.left: parent.left
1444 1445 font.family: "IBM Plex Mono"
1445 1446 echoMode: root.request.responseVisible ? TextInput.Normal : TextInput.Password
1446 1447 inputMethodHints: Qt.ImhSensitiveData
1447 - focus: root.state.active
1448 + focus: root.panelState.active
1448 1449 onActiveFocusChanged: {
1449 - if (!activeFocus && root.state.active)
1450 + if (!activeFocus && root.panelState.active)
1450 1451 forceActiveFocus();
1453 - Keys.onReturnPressed: (event) => {
1453 + Keys.onReturnPressed: event => {
1454 1454 event.accepted = true;
1455 1455 root.submitSecret(text);
1456 1456 text = "";
1458 - Keys.onEnterPressed: (event) => {
1458 + Keys.onEnterPressed: event => {
1459 1459 event.accepted = true;
1460 1460 root.submitSecret(text);
1461 1461 text = "";
1463 - Keys.onEscapePressed: (event) => {
1463 + Keys.onEscapePressed: event => {
1464 1464 event.accepted = true;
1465 1465 root.cancel();
1466 1466 text = "";
1474 1472 NuguText {
1475 1473 theme: root.theme
1476 1474 variant: "meta"
1477 - text: root.state.error || "No decoration. No command construction. Native Polkit route."
1475 + text: root.panelState.error || "No decoration. No command construction. Native Polkit route."
1478 1476 width: parent.width
1479 - color: root.state.error && root.theme ? root.theme.error : (root.theme ? root.theme.content.normal : "white")
1477 + color: root.panelState.error && root.theme ? root.theme.error : (root.theme ? root.theme.content.normal : "white")
1480 1478 elide: Text.ElideRight