aboutsummaryrefslogtreecommitdiffstats
path: root/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'desktop')
-rw-r--r--desktop/Drawer.qml1
-rw-r--r--desktop/NotificationList.qml1
-rw-r--r--desktop/Page.qml28
-rw-r--r--desktop/Prefs.qml23
-rw-r--r--desktop/SectionHeader.qml49
-rw-r--r--desktop/Settings.qml2
l---------desktop/WheelScroll.qml1
-rw-r--r--desktop/assistant/Assistant.qml15
-rw-r--r--desktop/assistant/Card.qml2
-rw-r--r--desktop/assistant/Files.js5
-rw-r--r--desktop/assistant/History.qml1
-rw-r--r--desktop/assistant/Models.qml1
-rw-r--r--desktop/assistant/Picker.qml1
-rw-r--r--desktop/assistant/test_files.js4
-rw-r--r--desktop/island/ClockPill.qml6
-rw-r--r--desktop/island/Island.qml53
-rw-r--r--desktop/island/ObsPill.qml2
-rw-r--r--desktop/island/README.md6
-rw-r--r--desktop/island/calendar/Cal.js83
-rw-r--r--desktop/island/calendar/Calendar.qml1
-rw-r--r--desktop/island/calendar/CalendarPanel.qml87
-rw-r--r--desktop/island/calendar/EventEditor.qml39
-rwxr-xr-xdesktop/island/calendar/calctl27
-rw-r--r--desktop/island/calendar/test_cal.js36
-rw-r--r--desktop/island/calendar/test_calctl.py25
-rw-r--r--desktop/modules/ai/AiPage.qml16
-rw-r--r--desktop/modules/appearance/README.md19
-rw-r--r--desktop/modules/appearance/StepsWindow.qml2
-rw-r--r--desktop/modules/appearance/WallColors.js70
-rw-r--r--desktop/modules/appearance/WallpaperTab.qml105
-rw-r--r--desktop/modules/appearance/Wallpapers.qml71
-rw-r--r--desktop/modules/appearance/test_wallcolors.js47
-rw-r--r--desktop/modules/assistant/AssistantModule.qml8
-rw-r--r--desktop/modules/assistant/AssistantPage.qml55
-rw-r--r--desktop/modules/bluetooth/BluetoothPage.qml42
-rw-r--r--desktop/modules/clipboard/ClipboardPage.qml1
-rw-r--r--desktop/modules/deckit/DeckIt.qml43
-rw-r--r--desktop/modules/deckit/DeckItDashboardModule.qml6
-rw-r--r--desktop/modules/deckit/DeckItDashboardPage.qml36
-rw-r--r--desktop/modules/deckit/DeckItGeneralPage.qml2
-rw-r--r--desktop/modules/deckit/DeckItModule.qml7
-rw-r--r--desktop/modules/deckit/DeckItServicesModule.qml4
-rw-r--r--desktop/modules/deckit/DeckItServicesPage.qml6
-rw-r--r--desktop/modules/deckit/Modules.js6
-rw-r--r--desktop/modules/deckit/README.md28
-rw-r--r--desktop/modules/fonts/Fonts.js35
-rw-r--r--desktop/modules/fonts/FontsModule.qml5
-rw-r--r--desktop/modules/fonts/FontsPage.qml71
-rw-r--r--desktop/modules/fonts/README.md10
-rw-r--r--desktop/modules/fonts/test_fonts.js13
-rw-r--r--desktop/modules/island/IslandCalendarModule.qml76
-rw-r--r--desktop/modules/island/IslandClockModule.qml247
-rw-r--r--desktop/modules/island/IslandPillsModule.qml140
-rw-r--r--desktop/modules/mail/MailPage.qml14
-rw-r--r--desktop/modules/mimeapps/MimeApps.js148
-rw-r--r--desktop/modules/mimeapps/MimeAppsModule.qml106
-rw-r--r--desktop/modules/mimeapps/MimeAppsPage.qml313
-rw-r--r--desktop/modules/mimeapps/README.md30
-rw-r--r--desktop/modules/mimeapps/test_mimeapps.js77
-rw-r--r--desktop/modules/network/NetworkModule.qml60
-rw-r--r--desktop/modules/network/NetworkPage.qml147
-rw-r--r--desktop/modules/notes/NotesPage.qml1
-rw-r--r--desktop/modules/perf/Perf.js18
-rw-r--r--desktop/modules/perf/Perf.qml22
-rw-r--r--desktop/modules/perf/PerfPanel.qml30
-rw-r--r--desktop/modules/perf/README.md10
-rwxr-xr-xdesktop/modules/perf/gpu.sh (renamed from desktop/modules/perf/vram.sh)21
-rwxr-xr-xdesktop/modules/perf/test_gpu.sh (renamed from desktop/modules/perf/test_vram.sh)16
-rw-r--r--desktop/modules/perf/test_perf.js9
-rw-r--r--desktop/modules/services/README.md41
-rw-r--r--desktop/modules/services/Services.js43
-rw-r--r--desktop/modules/services/ServicesModule.qml135
-rw-r--r--desktop/modules/services/ServicesPage.qml91
-rwxr-xr-xdesktop/modules/services/restart.sh (renamed from desktop/modules/shells/restart.sh)0
-rw-r--r--desktop/modules/services/test_services.js46
-rw-r--r--desktop/modules/shells/README.md21
-rw-r--r--desktop/modules/shells/ShellsModule.qml80
-rw-r--r--desktop/modules/shells/ShellsPage.qml51
-rw-r--r--desktop/modules/sound/Player.qml37
-rw-r--r--desktop/modules/sound/SoundPage.qml23
-rw-r--r--desktop/modules/status/README.md24
-rw-r--r--desktop/modules/status/StatusPage.qml14
-rwxr-xr-xdesktop/modules/status/notify-sound10
-rwxr-xr-xdesktop/modules/status/statusctl27
-rwxr-xr-xdesktop/modules/status/test-notify-sound.sh15
-rwxr-xr-xdesktop/modules/status/test-statusctl.sh23
-rw-r--r--desktop/shell.qml10
87 files changed, 2876 insertions, 507 deletions
diff --git a/desktop/Drawer.qml b/desktop/Drawer.qml
index 93493cc..f77169a 100644
--- a/desktop/Drawer.qml
+++ b/desktop/Drawer.qml
@@ -230,6 +230,7 @@ Scope {
contentHeight: grid.height
clip: true
boundsBehavior: Flickable.StopAtBounds
+ WheelScroll { parent: tiles; anchors.fill: parent; flick: tiles; step: 96 + grid.spacing }
Flow {
id: grid
diff --git a/desktop/NotificationList.qml b/desktop/NotificationList.qml
index 9fe4328..63ab1aa 100644
--- a/desktop/NotificationList.qml
+++ b/desktop/NotificationList.qml
@@ -61,6 +61,7 @@ Item {
contentWidth: width
contentHeight: col.implicitHeight
boundsBehavior: Flickable.StopAtBounds
+ WheelScroll { parent: flick; anchors.fill: parent; flick: flick }
Column {
id: col
diff --git a/desktop/Page.qml b/desktop/Page.qml
index eb1c5c0..e02db7e 100644
--- a/desktop/Page.qml
+++ b/desktop/Page.qml
@@ -139,6 +139,21 @@ Item {
clip: true
contentWidth: availableWidth
+ // Page Up/Down, Home/End scroll the page. Reached when the page
+ // itself has focus (a click on empty space, below) or bubbling up
+ // from a field, which keeps Home/End for its cursor.
+ Keys.onPressed: e => {
+ const f = scroll.contentItem, max = Math.max(0, f.contentHeight - f.height);
+ const to = e.key === Qt.Key_PageUp ? f.contentY - f.height * 0.9
+ : e.key === Qt.Key_PageDown ? f.contentY + f.height * 0.9
+ : e.key === Qt.Key_Home ? 0
+ : e.key === Qt.Key_End ? max : null;
+ if (to === null) return;
+ f.cancelFlick();
+ f.contentY = Math.max(0, Math.min(to, max));
+ e.accepted = true;
+ }
+
Item {
id: holder
width: parent.width
@@ -146,6 +161,19 @@ Item {
}
}
+ // A click on empty page space focuses the page, for the keys above,
+ // and the wheel scrolls it. Beneath the content, so fields and buttons
+ // keep their clicks and an inner slider or list keeps its wheel; the
+ // Flickable still steals drags from it.
+ WheelScroll {
+ parent: holder
+ z: -1
+ anchors.fill: parent
+ flick: scroll.contentItem
+ acceptedButtons: Qt.LeftButton
+ onPressed: scroll.forceActiveFocus()
+ }
+
// The reveal highlight, over the row and in holder's coordinates.
// Declared out here, not in the ScrollView, which sizes from a single
// child; parent puts it in holder all the same.
diff --git a/desktop/Prefs.qml b/desktop/Prefs.qml
index ef2ac72..1d24796 100644
--- a/desktop/Prefs.qml
+++ b/desktop/Prefs.qml
@@ -14,6 +14,7 @@ pragma Singleton
import Quickshell
import Quickshell.Io
import QtQuick
+import "island/calendar/Cal.js" as Cal
// Preferences that must survive a reboot, in one JSON file under the state
// home. Only the shell writes it, which is why it is not in ~/.config.
@@ -84,6 +85,18 @@ Singleton {
root.write(Object.assign({}, root.doc, { bootlogo: root.bootlogo }));
}
+ // The island bar's settings (modules/island): the length a new event gets,
+ // and that its end keeps from the start, in minutes; the pills left to
+ // right, the first two left of the screen's centre, the last two right; the
+ // clock, 12-hour or not, and the date's format (island/calendar/Cal.js).
+ readonly property var islandDefaults: ({ eventMinutes: 60, pills: ["media", "clock", "status", "obs"],
+ h12: false, dateFormat: Cal.DATE_FORMATS[0] })
+ property var island: islandDefaults
+ function setIsland(changes) {
+ root.island = Object.assign({}, root.island, changes);
+ root.write(Object.assign({}, root.doc, { island: root.island }));
+ }
+
// The whole parsed object, so a write keeps keys this version does not
// know about.
property var doc: ({})
@@ -154,6 +167,16 @@ Singleton {
const bl = parsed.bootlogo && typeof parsed.bootlogo === "object" && !Array.isArray(parsed.bootlogo)
? parsed.bootlogo : {};
root.bootlogo = Object.assign({}, root.bootlogoDefaults, bl);
+ const isl = parsed.island && typeof parsed.island === "object" ? parsed.island : {};
+ root.island = {
+ eventMinutes: Number.isInteger(isl.eventMinutes) && isl.eventMinutes >= 5 && isl.eventMinutes <= 1440
+ ? isl.eventMinutes : 60,
+ pills: Array.isArray(isl.pills) && isl.pills.length === 4
+ && root.islandDefaults.pills.every(p => isl.pills.includes(p))
+ ? isl.pills.slice() : root.islandDefaults.pills,
+ h12: isl.h12 === true,
+ dateFormat: Cal.shortDateFmt(isl.dateFormat),
+ };
}
FileView {
diff --git a/desktop/SectionHeader.qml b/desktop/SectionHeader.qml
new file mode 100644
index 0000000..6bbe07a
--- /dev/null
+++ b/desktop/SectionHeader.qml
@@ -0,0 +1,49 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import QtQuick
+
+// A drawer page's section title: accent glyph, bold label, and a divider
+// with space above it, which is what separates the sections. The divider is
+// at 0.3: the 0.12 one the pages used before read too faint. The first
+// section of a page sets divider: false. Children (a switch, a level) are
+// laid on the right; anchor them to the bottom, where the label sits.
+Item {
+ property string glyph
+ property string label
+ property bool divider: true
+
+ width: parent ? parent.width : 0
+ implicitHeight: headerText.implicitHeight + (divider ? 18 : 10)
+
+ Rectangle {
+ visible: parent.divider
+ width: parent.width
+ height: 1
+ color: Qt.alpha(Theme.text, 0.3)
+ }
+
+ Text {
+ id: headerGlyph
+ anchors { left: parent.left; verticalCenter: headerText.verticalCenter }
+ text: parent.glyph
+ font { family: Theme.iconFamily; pixelSize: Theme.fontSize }
+ color: Theme.accent
+ }
+
+ Text {
+ id: headerText
+ anchors { left: headerGlyph.right; leftMargin: 8; bottom: parent.bottom }
+ text: parent.label
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize + 1; bold: true }
+ color: Theme.text
+ }
+}
diff --git a/desktop/Settings.qml b/desktop/Settings.qml
index 6b81586..56f911f 100644
--- a/desktop/Settings.qml
+++ b/desktop/Settings.qml
@@ -228,6 +228,7 @@ Scope {
// Without it a scrolled list draws over the search box.
clip: true
model: root.found
+ WheelScroll { parent: side; anchors.fill: parent; flick: side; step: 120 }
// A group's heading above its first entry, then the entry.
delegate: Column {
@@ -450,6 +451,7 @@ Scope {
clip: true
boundsBehavior: Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar {}
+ WheelScroll { parent: landingFlick; anchors.fill: parent; flick: landingFlick }
Column {
id: about
diff --git a/desktop/WheelScroll.qml b/desktop/WheelScroll.qml
new file mode 120000
index 0000000..f6de73f
--- /dev/null
+++ b/desktop/WheelScroll.qml
@@ -0,0 +1 @@
+../shared/WheelScroll.qml \ No newline at end of file
diff --git a/desktop/assistant/Assistant.qml b/desktop/assistant/Assistant.qml
index d6863a0..7d299eb 100644
--- a/desktop/assistant/Assistant.qml
+++ b/desktop/assistant/Assistant.qml
@@ -49,7 +49,7 @@ Scope {
property int opChars: 0
property var opOut: []
property string opError: ""
- // Results folder: $(xdg-user-dir DOCUMENTS)/Assistant, read once.
+ // Results folder: the daemon's out_dir, from hello; this until then.
property string outDir: (Quickshell.env("HOME") || "") + "/Documents/Assistant"
readonly property string fileops:
decodeURIComponent(Qt.resolvedUrl("fileops").toString().replace(/^file:\/\//, ""))
@@ -281,18 +281,6 @@ Scope {
}
}
- Process {
- running: true
- command: ["xdg-user-dir", "DOCUMENTS"]
- stdout: StdioCollector {
- // With no documents folder set, xdg-user-dir answers $HOME itself.
- onStreamFinished: {
- const d = text.trim();
- if (d.startsWith("/") && d !== Quickshell.env("HOME")) root.outDir = d + "/Assistant";
- }
- }
- }
-
// deck-it's Assistant tab look, from its config's [assistant] keys: the
// backdrop picture, the user's avatar, and where the assistant's face is
// in the backdrop ([centre x, centre y, size] in its pixels). Empty: no
@@ -442,6 +430,7 @@ print(json.dumps({"bg": os.path.expanduser(a.get("background") or ""),
root.runningTool = e.state === "tool" ? e.tool : "";
root.model = e.model ?? "";
root.chatModel = e.chat_model ?? "";
+ if (e.out_dir) root.outDir = e.out_dir;
root.ctxUsed = e.ctx_used;
root.ctxMax = e.ctx_max;
root.load(e.id, e.turns, e.pending);
diff --git a/desktop/assistant/Card.qml b/desktop/assistant/Card.qml
index 2f9af69..f4e1af1 100644
--- a/desktop/assistant/Card.qml
+++ b/desktop/assistant/Card.qml
@@ -252,6 +252,7 @@ Rectangle {
onMovementStarted: stick = false
onMovementEnded: stick = atYEnd
onContentHeightChanged: if (stick) Qt.callLater(positionViewAtEnd)
+ WheelScroll { parent: list; anchors.fill: parent; flick: list; onSettled: list.stick = list.atYEnd }
Component.onCompleted: positionViewAtEnd()
delegate: Message {
@@ -588,6 +589,7 @@ Rectangle {
contentHeight: input.contentHeight
clip: true
boundsBehavior: Flickable.StopAtBounds
+ WheelScroll { parent: scroller; anchors.fill: parent; flick: scroller; step: 60 }
function follow(r) {
if (r.y < contentY) contentY = r.y;
else if (r.y + r.height > contentY + height) contentY = r.y + r.height - height;
diff --git a/desktop/assistant/Files.js b/desktop/assistant/Files.js
index bcbd9bc..bea1841 100644
--- a/desktop/assistant/Files.js
+++ b/desktop/assistant/Files.js
@@ -28,8 +28,9 @@ const IMAGE = [".png", ".jpg", ".jpeg", ".gif", ".webp"];
const VIDEO = [".mp4", ".mkv", ".webm", ".mov", ".avi", ".m4v"];
const ARCHIVE = [".zip", ".tar", ".gz", ".tgz", ".xz", ".txz", ".bz2", ".zst", ".7z", ".rar"];
-// Kinds chat takes; the rest only get local actions.
-const CHAT = ["text", "code", "image", "pdf"];
+// Kinds chat takes; the rest only get local actions. A video goes as its
+// path only, for the video tool.
+const CHAT = ["text", "code", "image", "pdf", "video"];
function name(path) { return path.slice(path.lastIndexOf("/") + 1); }
diff --git a/desktop/assistant/History.qml b/desktop/assistant/History.qml
index 709e1a6..1b2a355 100644
--- a/desktop/assistant/History.qml
+++ b/desktop/assistant/History.qml
@@ -58,6 +58,7 @@ Rectangle {
spacing: 4
boundsBehavior: Flickable.StopAtBounds
model: field.text.trim() === "" ? panel.canvas.convs : panel.canvas.results
+ WheelScroll { parent: rows; anchors.fill: parent; flick: rows }
delegate: Rectangle {
id: r
diff --git a/desktop/assistant/Models.qml b/desktop/assistant/Models.qml
index b1b2a38..1fa1d37 100644
--- a/desktop/assistant/Models.qml
+++ b/desktop/assistant/Models.qml
@@ -30,6 +30,7 @@ Rectangle {
clip: true
spacing: 2
model: panel.canvas.models
+ WheelScroll { parent: rows; anchors.fill: parent; flick: rows }
delegate: Rectangle {
id: r
diff --git a/desktop/assistant/Picker.qml b/desktop/assistant/Picker.qml
index 6d7b8ad..4c691ec 100644
--- a/desktop/assistant/Picker.qml
+++ b/desktop/assistant/Picker.qml
@@ -108,6 +108,7 @@ Rectangle {
boundsBehavior: Flickable.StopAtBounds
model: files
highlightMoveDuration: 0
+ WheelScroll { parent: rows; anchors.fill: parent; flick: rows }
delegate: Rectangle {
id: r
diff --git a/desktop/assistant/test_files.js b/desktop/assistant/test_files.js
index f2a65ca..f6ed058 100644
--- a/desktop/assistant/test_files.js
+++ b/desktop/assistant/test_files.js
@@ -29,8 +29,8 @@ const cases = {
};
for (const [p, k] of Object.entries(cases)) assert.strictEqual(F.kind(p), k, p);
-assert.ok(F.chats("pdf") && F.chats("image") && F.chats("text") && F.chats("code"));
-assert.ok(!F.chats("video") && !F.chats("archive") && !F.chats("other"));
+assert.ok(F.chats("pdf") && F.chats("image") && F.chats("text") && F.chats("code") && F.chats("video"));
+assert.ok(!F.chats("archive") && !F.chats("other"));
assert.strictEqual(F.fromUrl("file:///home/you/My%20Docs/caf%C3%A9.pdf"), "/home/you/My Docs/café.pdf");
assert.strictEqual(F.fromUrl("file:///tmp/a.txt"), "/tmp/a.txt");
diff --git a/desktop/island/ClockPill.qml b/desktop/island/ClockPill.qml
index 4ed8e38..9677508 100644
--- a/desktop/island/ClockPill.qml
+++ b/desktop/island/ClockPill.qml
@@ -12,6 +12,7 @@
import Quickshell
import Quickshell.Widgets
import QtQuick
+import "calendar/Cal.js" as Cal
import ".."
import "../modules/vm"
import "calendar"
@@ -39,6 +40,7 @@ Capsule {
// Escape asks the panel before closing it.
function focusPanel() { calendarPanel.reset(); calendarPanel.forceActiveFocus(); }
function back() { return calendarPanel.back(); }
+ function importFile(path) { calendarPanel.importFile(path); }
readonly property var entry: flickApp ? DesktopEntries.heuristicLookup(flickApp) : null
readonly property string wsIcon: Workspaces.icon(flickWs)
@@ -62,13 +64,13 @@ Capsule {
Text {
anchors.verticalCenter: parent.verticalCenter
- text: Qt.formatDateTime(clock.date, "ddd dd/MM")
+ text: Qt.formatDateTime(clock.date, Cal.shortDateFmt(Prefs.island.dateFormat))
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
color: Theme.subtext
}
Text {
anchors.verticalCenter: parent.verticalCenter
- text: Qt.formatDateTime(clock.date, "HH:mm")
+ text: Qt.formatDateTime(clock.date, Cal.timeFmt(Prefs.island.h12))
font { family: Theme.fontFamily; pixelSize: Theme.fontSize; weight: Font.DemiBold }
color: Theme.text
}
diff --git a/desktop/island/Island.qml b/desktop/island/Island.qml
index f17358d..decde30 100644
--- a/desktop/island/Island.qml
+++ b/desktop/island/Island.qml
@@ -233,10 +233,13 @@ PanelWindow {
// --- file drop ---------------------------------------------------------
// A file dragged onto the sliver opens a bubble to drop it on; the drop
- // hands it to the assistant canvas. Wayland reports a drag only once it
+ // hands it to the assistant canvas, or a lone .ics to the calendar's
+ // editor, filled in for review. Wayland reports a drag only once it
// enters an input region, so the receptor is the sliver's width at rest
// and grows to hold the bubble while a drag is over it.
property bool dropHold: false
+ property bool dropIcs: false // a lone .ics: the calendar takes it
+ function isIcs(urls) { return urls.length === 1 && /\.ics$/i.test(String(urls[0])); }
// Why the last drop was refused, shown in the bubble for a moment.
property string dropNote: ""
Timer { id: noteTimer; interval: 2500; onTriggered: win.dropNote = "" }
@@ -252,9 +255,10 @@ PanelWindow {
DropArea {
anchors.fill: parent
- enabled: win.asst !== null
onEntered: drag => {
- drag.accepted = drag.hasUrls && (drag.supportedActions & Qt.CopyAction);
+ win.dropIcs = win.isIcs(drag.urls);
+ drag.accepted = drag.hasUrls && (drag.supportedActions & Qt.CopyAction)
+ && (win.dropIcs || win.asst !== null);
if (drag.accepted) { win.dropHold = true; drag.accept(Qt.CopyAction); }
}
onExited: win.dropHold = false
@@ -275,7 +279,13 @@ PanelWindow {
drop.accepted = false;
return;
}
- win.asst.attach(paths);
+ if (win.isIcs(paths)) {
+ win.shown = true;
+ win.panel = "calendar";
+ clock.importFile(paths[0]);
+ } else {
+ win.asst.attach(paths);
+ }
drop.accept(Qt.CopyAction);
}
}
@@ -291,20 +301,31 @@ PanelWindow {
border.color: Qt.alpha(win.dropHold ? Theme.accent : Theme.red, 0.6)
Text {
anchors.centerIn: parent
- text: win.dropHold ? "Drop for the assistant" : win.dropNote
+ text: !win.dropHold ? win.dropNote : win.dropIcs ? "Drop to add to the calendar" : "Drop for the assistant"
color: win.dropHold ? Theme.text : Theme.red
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
}
}
}
- // Both pills start overlapped at the sliver, above the screen edge, and
- // travel down and apart. At reveal 1 the clock ends gap/2 left of the
- // centre and the status gap/2 right of it; the status pill's left edge
- // stays put while its panel widens it.
+ // The pills start overlapped at the sliver, above the screen edge, and
+ // travel down and apart. Prefs.island.pills orders them: the first two
+ // end left of the centre, the last two right, each a gap past the visible
+ // ones nearer the centre, the nearest gap/2 from it. A pill keeps its
+ // edge facing the centre while a panel widens it, and one hidden (no
+ // player, no OBS) leaves no hole.
+ readonly property var pillOrder: Prefs.island.pills
+ function pillX(w, name) {
+ const i = win.pillOrder.indexOf(name);
+ const left = i < 2;
+ const nearer = left ? win.pillOrder.slice(i + 1, 2) : win.pillOrder.slice(2, i);
+ const byName = { media: media, clock: clock, status: status, obs: obs };
+ const off = nearer.reduce((o, n) => byName[n].visible ? o + byName[n].width + win.gap : o, win.gap / 2);
+ return win.cx - w / 2 + (left ? -1 : 1) * (off + w / 2) * win.reveal;
+ }
ClockPill {
id: clock
- x: win.cx - width / 2 - (win.gap / 2 + width / 2) * win.reveal
+ x: win.pillX(width, "clock")
y: -height + (win.top + height) * win.clockDrop
opacity: Math.min(1, win.clockDrop * 2)
flicking: win.flicking
@@ -317,7 +338,7 @@ PanelWindow {
StatusPill {
id: status
- x: win.cx - width / 2 + (win.gap / 2 + width / 2) * win.reveal
+ x: win.pillX(width, "status")
y: -height + (win.top + height) * win.reveal
opacity: Math.min(1, win.reveal * 2)
sound: win.sound
@@ -335,8 +356,7 @@ PanelWindow {
onOpenDrawer: { win.panel = ""; win.drawer.show("sound"); }
}
- // While something plays or is paused; it sits left of the clock pill and
- // follows it as the calendar widens it. Hidden outright while the island
+ // While something plays or is paused. Hidden outright while the island
// is retracted: opacity 0 alone leaves it visible, and its marquee then
// animated off-screen for as long as anything played, repainting the
// island every frame (measured at 42% of a core, idle).
@@ -344,19 +364,18 @@ PanelWindow {
id: media
visible: win.reveal > 0
&& (Player.playing || Player.current?.playbackState === MprisPlaybackState.Paused)
- x: win.cx - width / 2 - (win.gap * 1.5 + clock.width + width / 2) * win.reveal
+ x: win.pillX(width, "media")
y: -height + (win.top + height) * win.reveal
opacity: Math.min(1, win.reveal * 2)
}
- // While OBS runs; right of the status pill, following it as the sound
- // panel widens it.
+ // While OBS runs.
ObsPill {
id: obs
visible: Obs.connected
panel: win.panel
onOpenPanel: win.panel = "obs"
- x: win.cx - width / 2 + (win.gap * 1.5 + status.width + width / 2) * win.reveal
+ x: win.pillX(width, "obs")
y: -height + (win.top + height) * win.reveal
opacity: Math.min(1, win.reveal * 2)
}
diff --git a/desktop/island/ObsPill.qml b/desktop/island/ObsPill.qml
index 3fdb4a3..c4b0870 100644
--- a/desktop/island/ObsPill.qml
+++ b/desktop/island/ObsPill.qml
@@ -134,11 +134,13 @@ Capsule {
// ponytail: four columns, two rows visible; the wheel scrolls beyond
// eight scenes. Selection is click-only, so scrolling never switches.
Flickable {
+ id: scenes
width: controls.width
height: Math.min(80, grid.childrenRect.height)
contentHeight: grid.childrenRect.height
clip: true
flickableDirection: Flickable.VerticalFlick
+ WheelScroll { parent: scenes; anchors.fill: parent; flick: scenes; step: 40 }
Grid {
id: grid
diff --git a/desktop/island/README.md b/desktop/island/README.md
index 1b1a3f2..03f7201 100644
--- a/desktop/island/README.md
+++ b/desktop/island/README.md
@@ -184,3 +184,9 @@ width at rest and grows to hold the bubble while a drag is over it. Only
`file://` URLs are taken; a refused drop says why in the bubble for a
moment. The file manager offers a trashed file as a `trash:` URL, which has
no path to read: restore it first.
+
+A lone `.ics` file goes to the calendar instead, and the bubble says so:
+the panel opens on the event's month with the editor filled from the file
+by `calctl read`, in the default calendar, and nothing is written until
+Save. A repeat rule or alarm the form cannot show reads `none`, since a new
+event has nothing of its own to keep.
diff --git a/desktop/island/calendar/Cal.js b/desktop/island/calendar/Cal.js
index d8dcf80..d12ed29 100644
--- a/desktop/island/calendar/Cal.js
+++ b/desktop/island/calendar/Cal.js
@@ -83,10 +83,42 @@ function dots(events, day, calendars) {
return calendars.filter(c => events.some(e => e.calendar === c.name && onDay(e, day)));
}
-function timeLabel(ev, day) {
+// The island's clock settings (Prefs.island): h12 for a 12-hour clock, and
+// dateFormat, the clock pill's date as one of DATE_FORMATS (Qt format
+// strings). The calendar's longer dates follow its order, day or month
+// first. clockTime formats calctl's "HH:MM", compact ("9:30p") where width
+// is short.
+var DATE_GROUPS = [
+ { title: "Day first", formats: ["ddd dd/MM", "dd/MM", "dd/MM/yy", "dd/MM/yyyy", "ddd dd/MM/yyyy",
+ "dd.MM.yyyy", "dd-MM-yyyy", "d MMM", "ddd d MMM", "d MMM yyyy"] },
+ { title: "Month first", formats: ["ddd MM/dd", "MM/dd", "MM/dd/yy", "MM/dd/yyyy", "ddd MM/dd/yyyy",
+ "MMM d", "ddd MMM d", "MMM d, yyyy"] },
+ { title: "Year first", formats: ["yyyy-MM-dd", "ddd yyyy-MM-dd", "yyyy/MM/dd", "ddd MM-dd"] }];
+var DATE_FORMATS = DATE_GROUPS.reduce((a, g) => a.concat(g.formats), []);
+function timeFmt(h12) { return h12 ? "h:mm AP" : "HH:mm"; }
+function shortDateFmt(fmt) { return DATE_FORMATS.includes(fmt) ? fmt : DATE_FORMATS[0]; }
+// Day first unless the month comes before the day, the weekday name aside.
+function dayFirst(fmt) {
+ const f = shortDateFmt(fmt).replace(/ddd+/, "");
+ return f.indexOf("d") < f.indexOf("M");
+}
+function dayFmt(fmt, long) {
+ if (dayFirst(fmt)) return long ? "dddd d MMMM" : "ddd d MMM";
+ return long ? "dddd, MMMM d" : "ddd MMM d";
+}
+function clockTime(hhmm, h12) {
+ if (!h12 || !validTime(hhmm)) return hhmm;
+ const h = +hhmm.slice(0, 2);
+ return (h % 12 || 12) + hhmm.slice(2) + (h < 12 ? "a" : "p");
+}
+function hourLabel(h, h12) {
+ return h12 ? (h % 12 || 12) + (h < 12 ? "a" : "p") : pad(h);
+}
+
+function timeLabel(ev, day, h12) {
if (ev.allDay) return "all day";
- const s = ev.start.slice(0, 10) === day ? ev.start.slice(11, 16) : "…";
- const e = ev.end.slice(0, 10) === day ? ev.end.slice(11, 16) : "…";
+ const s = ev.start.slice(0, 10) === day ? clockTime(ev.start.slice(11, 16), h12) : "…";
+ const e = ev.end.slice(0, 10) === day ? clockTime(ev.end.slice(11, 16), h12) : "…";
return s + "–" + e;
}
@@ -94,22 +126,52 @@ function validTime(s) {
return /^([01]\d|2[0-3]):[0-5]\d$/.test(s);
}
+// Loose typing as HH:MM: "9.30", "9:30", "930", "9", and with am or pm
+// ("9.30pm", "12am") for the 12-hour clock, mean what they look like.
+// Anything else comes back unchanged, for validTime to reject.
+function normTime(s) {
+ const m = /^\s*(\d{1,2})(?:[:.,h ]?(\d{2}))?\s*(?:([ap])\.?m?\.?)?\s*$/i.exec(s);
+ if (!m) return s;
+ let h = +m[1];
+ if (m[3]) {
+ if (h < 1 || h > 12) return s;
+ h = h % 12 + (m[3].toLowerCase() === "p" ? 12 : 0);
+ }
+ const t = pad(h) + ":" + (m[2] || "00");
+ return validTime(t) ? t : s;
+}
+
// Step a time by minutes, wrapping within the day; an invalid time is left
// for the user to fix rather than guessed at.
function stepTime(s, minutes) {
+ s = normTime(s);
if (!validTime(s)) return s;
const m = ((+s.slice(0, 2) * 60 + +s.slice(3, 5) + minutes) % 1440 + 1440) % 1440;
return pad(Math.floor(m / 60)) + ":" + pad(m % 60);
}
-// A new event on `day`: the next whole hour, one hour long, alarm 1h (the
-// most common alarm in the live calendars). Capped at 22:00 so the end stays
-// on the same day.
-function newDraft(day, now, calendar) {
+// A new event on `day`: the next whole hour, `minutes` long (the island's
+// default event length), alarm 1h (the most common alarm in the live
+// calendars). Capped at 22:00 so a short event stays on the same day.
+function newDraft(day, now, calendar, minutes) {
const h = Math.min(22, now.getHours() + 1);
- return { uid: "", source: "", calendar: calendar, title: "", allDay: false,
- startDay: day, endDay: day, startTime: pad(h) + ":00", endTime: pad(h + 1) + ":00",
- repeat: "none", until: "", alarm: "1h", location: "", notes: "", override: false };
+ return withStart({ uid: "", source: "", calendar: calendar, title: "", allDay: false,
+ startDay: day, endDay: day, startTime: pad(h) + ":00", endTime: pad(h) + ":00",
+ repeat: "none", until: "", alarm: "1h", location: "", notes: "", override: false },
+ pad(h) + ":00", minutes);
+}
+
+// The draft with a new start time, as typed, the end following it `minutes` later,
+// into the next day if need be. A multi-day event keeps its end: snapping it
+// to the start's day would throw the other days away.
+function withStart(draft, time, minutes) {
+ const d = Object.assign({}, draft, { startTime: time });
+ const n = normTime(time);
+ if (!validTime(n) || d.startDay !== d.endDay) return d;
+ const t = +n.slice(0, 2) * 60 + +n.slice(3, 5) + (minutes > 0 ? minutes : 60);
+ d.endDay = addDays(d.startDay, Math.floor(t / 1440));
+ d.endTime = pad(Math.floor(t % 1440 / 60)) + ":" + pad(t % 60);
+ return d;
}
// calctl's event JSON as an editor draft. `source` is the calendar the event
@@ -141,6 +203,7 @@ function pick(draft, day, shift) {
// The draft as calctl's event JSON, or the first thing wrong with it.
function toPayload(d) {
+ d = Object.assign({}, d, { startTime: normTime(d.startTime), endTime: normTime(d.endTime) });
if (!d.title.trim()) return { error: "Title is empty" };
if (!d.allDay && (!validTime(d.startTime) || !validTime(d.endTime)))
return { error: "Times are HH:MM" };
diff --git a/desktop/island/calendar/Calendar.qml b/desktop/island/calendar/Calendar.qml
index 4a5e7d4..5431ad1 100644
--- a/desktop/island/calendar/Calendar.qml
+++ b/desktop/island/calendar/Calendar.qml
@@ -53,6 +53,7 @@ Singleton {
// `cal` is the calendar the event is in now: one UID can be in two.
function get(uid, cal, cb) { root.run(["get", uid, cal], cb); }
+ function read(file, cb) { root.run(["read", file], cb); }
function create(event, cb) { root.run(["new", JSON.stringify(event)], cb); }
function update(uid, cal, event, cb) { root.run(["edit", uid, cal, JSON.stringify(event)], cb); }
function remove(uid, cal, cb) { root.run(["delete", uid, cal], cb); }
diff --git a/desktop/island/calendar/CalendarPanel.qml b/desktop/island/calendar/CalendarPanel.qml
index 7d42f7d..cea3898 100644
--- a/desktop/island/calendar/CalendarPanel.qml
+++ b/desktop/island/calendar/CalendarPanel.qml
@@ -31,6 +31,7 @@ Item {
readonly property var cells: Cal.monthCells(viewY, viewM0)
readonly property real gridWidth: 252
+ readonly property bool pickingTime: panel.editing && editor.timeField !== ""
implicitHeight: Math.max(left.implicitHeight, right.implicitHeight)
@@ -81,10 +82,23 @@ Item {
}
function newEvent() {
- editor.load(Cal.newDraft(panel.selected, new Date(), Calendar.defaultCalendar));
+ editor.load(Cal.newDraft(panel.selected, new Date(), Calendar.defaultCalendar, Prefs.island.eventMinutes));
panel.editing = true;
}
+ // A dropped .ics: the editor, filled from it, on its month. Nothing is
+ // saved until Save.
+ function importFile(path) {
+ Calendar.read(path, r => {
+ if (!r.ok) { panel.agendaError = r.error; return; }
+ const d = Cal.fromEvent(r.data);
+ panel.selected = d.startDay;
+ panel.show(+d.startDay.slice(0, 4), +d.startDay.slice(5, 7) - 1);
+ editor.load(d);
+ panel.editing = true;
+ });
+ }
+
function closeEditor() {
panel.editing = false;
panel.forceActiveFocus();
@@ -113,12 +127,14 @@ Item {
Text {
anchors.verticalCenter: parent.verticalCenter
- text: Qt.locale().standaloneMonthName(panel.viewM0) + " " + panel.viewY
+ text: panel.pickingTime ? (editor.timeField === "startTime" ? "Start" : "End") + " time"
+ : Qt.locale().standaloneMonthName(panel.viewM0) + " " + panel.viewY
color: Theme.text
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
}
Row {
anchors { right: parent.right; verticalCenter: parent.verticalCenter }
+ visible: !panel.pickingTime
spacing: 12
Repeater {
model: [{ t: "‹", n: -1 }, { t: "›", n: 1 }]
@@ -140,6 +156,7 @@ Item {
Grid {
columns: 7
spacing: 2
+ visible: !panel.pickingTime
Repeater {
model: [0, 1, 2, 3, 4, 5, 6]
@@ -208,6 +225,66 @@ Item {
}
}
}
+ // While a time field has focus: hours, then minutes. Typing still
+ // works, the field keeps the focus.
+ Grid {
+ id: hours
+ readonly property string cur: panel.pickingTime ? Cal.normTime(editor.draft[editor.timeField]) : ""
+ visible: panel.pickingTime
+ columns: 6
+ spacing: 2
+
+ Repeater {
+ model: 24
+ delegate: TimeCell {
+ required property int index
+ width: (panel.gridWidth - 10) / 6
+ label: Cal.hourLabel(index, Prefs.island.h12)
+ on: hours.cur.slice(0, 2) === Cal.pad(index)
+ onClicked: editor.pickTime(index, null)
+ }
+ }
+ }
+ Row {
+ id: minutes
+ readonly property string cur: panel.pickingTime ? Cal.normTime(editor.draft[editor.timeField]) : ""
+ visible: panel.pickingTime
+ spacing: 2
+
+ Repeater {
+ model: ["00", "15", "30", "45"]
+ delegate: TimeCell {
+ required property string modelData
+ width: (panel.gridWidth - 6) / 4
+ label: ":" + modelData
+ on: minutes.cur.slice(2) === label
+ onClicked: editor.pickTime(null, modelData)
+ }
+ }
+ }
+ }
+
+ component TimeCell: Rectangle {
+ property string label: ""
+ property bool on: false
+ signal clicked()
+ height: 32
+ radius: 8
+ color: on ? Qt.alpha(Theme.accent, 0.35)
+ : cellHover.containsMouse ? Qt.alpha(Theme.surface, 0.8) : "transparent"
+ Text {
+ anchors.centerIn: parent
+ text: parent.label
+ color: Theme.text
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+ MouseArea {
+ id: cellHover
+ anchors.fill: parent
+ hoverEnabled: true
+ cursorShape: Qt.PointingHandCursor
+ onClicked: parent.clicked()
+ }
}
// --- right: agenda or editor -------------------------------------------
@@ -227,7 +304,7 @@ Item {
Text {
text: panel.selected === "" ? ""
: Qt.formatDate(new Date(+panel.selected.slice(0, 4), +panel.selected.slice(5, 7) - 1,
- +panel.selected.slice(8, 10)), "dddd d MMMM")
+ +panel.selected.slice(8, 10)), Cal.dayFmt(Prefs.island.dateFormat, true))
color: Theme.text
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
}
@@ -263,9 +340,9 @@ Item {
Text {
id: when
x: 16
- width: 82
+ width: Prefs.island.h12 ? 92 : 82
anchors.verticalCenter: parent.verticalCenter
- text: Cal.timeLabel(row.modelData, panel.selected)
+ text: Cal.timeLabel(row.modelData, panel.selected, Prefs.island.h12)
color: Theme.subtext
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 5 }
}
diff --git a/desktop/island/calendar/EventEditor.qml b/desktop/island/calendar/EventEditor.qml
index 510c844..e55396b 100644
--- a/desktop/island/calendar/EventEditor.qml
+++ b/desktop/island/calendar/EventEditor.qml
@@ -24,6 +24,10 @@ Column {
property bool confirmDelete: false
property bool busy: false
property string err: ""
+ // The time field with focus, if any: the panel swaps the month for an
+ // hour and minute picker while one has it.
+ readonly property string timeField: startTime.input.activeFocus ? "startTime"
+ : endTime.input.activeFocus ? "endTime" : ""
signal done()
@@ -49,6 +53,29 @@ Column {
ed.draft = d;
}
+ function setTime(key, value) {
+ (key === "startTime" ? startTime : endTime).input.text = value;
+ if (key === "startTime") ed.setStart(value);
+ else ed.set(key, value);
+ }
+
+ // The end follows the start by the island's default event length.
+ function setStart(text) {
+ ed.draft = Cal.withStart(ed.draft, text, Prefs.island.eventMinutes);
+ endTime.input.text = ed.draft.endTime;
+ }
+
+ // A click in the time picker: an hour keeps the minutes, a minute keeps
+ // the hour and moves on, start to end, end out of the fields.
+ function pickTime(h, m) {
+ const key = ed.timeField;
+ if (!key) return;
+ const cur = Cal.normTime(ed.draft[key]);
+ const old = Cal.validTime(cur) ? cur : "09:00";
+ ed.setTime(key, (h !== null ? Cal.pad(h) : old.slice(0, 2)) + ":" + (m !== null ? m : old.slice(3, 5)));
+ if (m !== null) (key === "startTime" ? endTime.input : ed).forceActiveFocus();
+ }
+
function pick(day, shift) {
if (ed.pickUntil) {
ed.set("until", day);
@@ -82,7 +109,7 @@ Column {
function dayLabel(day) {
const d = new Date(+day.slice(0, 4), +day.slice(5, 7) - 1, +day.slice(8, 10));
- return Qt.formatDate(d, "ddd d MMM");
+ return Qt.formatDate(d, Cal.dayFmt(Prefs.island.dateFormat, false));
}
// An unhandled Escape from any field lands here: leave the editor, not
@@ -175,7 +202,8 @@ Column {
id: startTime
width: 62
visible: !ed.draft.allDay
- input.onTextEdited: ed.set("startTime", input.text)
+ input.onTextEdited: ed.setStart(input.text)
+ input.onEditingFinished: if (Cal.normTime(input.text) !== input.text) ed.setTime("startTime", Cal.normTime(input.text))
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
@@ -183,8 +211,7 @@ Column {
onWheel: wheel => {
acc += wheel.angleDelta.y;
if (Math.abs(acc) < 120) return;
- parent.input.text = Cal.stepTime(parent.input.text, acc > 0 ? 15 : -15);
- ed.set("startTime", parent.input.text);
+ ed.setTime("startTime", Cal.stepTime(parent.input.text, acc > 0 ? 15 : -15));
acc = 0;
}
}
@@ -200,6 +227,7 @@ Column {
width: 62
visible: !ed.draft.allDay
input.onTextEdited: ed.set("endTime", input.text)
+ input.onEditingFinished: if (Cal.normTime(input.text) !== input.text) ed.setTime("endTime", Cal.normTime(input.text))
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
@@ -207,8 +235,7 @@ Column {
onWheel: wheel => {
acc += wheel.angleDelta.y;
if (Math.abs(acc) < 120) return;
- parent.input.text = Cal.stepTime(parent.input.text, acc > 0 ? 15 : -15);
- ed.set("endTime", parent.input.text);
+ ed.setTime("endTime", Cal.stepTime(parent.input.text, acc > 0 ? 15 : -15));
acc = 0;
}
}
diff --git a/desktop/island/calendar/calctl b/desktop/island/calendar/calctl
index ce98098..a28b20a 100755
--- a/desktop/island/calendar/calctl
+++ b/desktop/island/calendar/calctl
@@ -18,6 +18,7 @@
# calctl calendars {default, calendars: [{name, color, path}]}
# calctl list FROM TO occurrences in [FROM, TO), local time
# calctl get UID CAL the series itself, for the editor
+# calctl read FILE an outside .ics as a new event, for the editor
# calctl new EVENT-JSON {uid}
# calctl edit UID CAL EVENT-JSON {uid}; CAL is where it is now
# calctl delete UID CAL {}
@@ -61,7 +62,7 @@ COLORS = {
"cyan": "teal", "dark cyan": "teal", "light cyan": "teal",
}
-USAGE = ("usage: calctl calendars | list FROM TO | get UID CAL | new JSON"
+USAGE = ("usage: calctl calendars | list FROM TO | get UID CAL | read FILE | new JSON"
" | edit UID CAL JSON | delete UID CAL")
@@ -293,6 +294,28 @@ def cmd_get(uid, cal_name):
return to_json(cal, ev, start, end, all_day, overrides())
+def cmd_read(file):
+ """A dropped .ics (an invite, a booking) as a draft for the editor: no
+ UID, so saving creates a new event in the default calendar. A rule or
+ alarm the form cannot show reads `none`: a new event has nothing to keep."""
+ try:
+ ev = master(icalendar.Calendar.from_ical(Path(file).read_bytes()))
+ except OSError as e:
+ raise Fail(f"cannot read {file}: {e.strerror}")
+ except ValueError as e:
+ raise Fail(f"not a calendar file: {e}")
+ if ev is None or "DTSTART" not in ev:
+ raise Fail("no event in that file")
+ cals, default = calendars()
+ cal = next(c for c in cals if c["name"] == default)
+ d = to_json(cal, ev, *span(ev), set())
+ d["uid"] = ""
+ for key in ("repeat", "alarm"):
+ if d[key] == "custom":
+ d[key] = "none"
+ return d
+
+
def parse_payload(text, cals):
"""The form's JSON, checked. Dates become date/datetime; an all-day end
becomes exclusive."""
@@ -470,6 +493,8 @@ def main(argv):
data = cmd_list(*args)
elif cmd == "get" and len(args) == 2:
data = cmd_get(*args)
+ elif cmd == "read" and len(args) == 1:
+ data = cmd_read(*args)
elif cmd == "new" and len(args) == 1:
data = cmd_new(*args)
elif cmd == "edit" and len(args) == 3:
diff --git a/desktop/island/calendar/test_cal.js b/desktop/island/calendar/test_cal.js
index 9d0d147..5a9c1c0 100644
--- a/desktop/island/calendar/test_cal.js
+++ b/desktop/island/calendar/test_cal.js
@@ -17,7 +17,7 @@ const assert = require("assert");
const src = fs.readFileSync(__dirname + "/Cal.js", "utf8").replace(/^\.pragma library$/m, "");
const C = new Function(src + "\nreturn { pad, addDays, today, daysBetween, monthCells, shiftMonth," +
- " lastDay, onDay, dayEvents, dots, timeLabel, validTime, stepTime, newDraft, fromEvent, pick," +
+ " lastDay, onDay, dayEvents, dots, timeLabel, validTime, normTime, clockTime, hourLabel, shortDateFmt, dayFmt, stepTime, newDraft, withStart, fromEvent, pick," +
" toPayload };")();
// Dates are plain YYYY-MM-DD strings, arithmetic in UTC so DST never moves a day.
@@ -76,6 +76,26 @@ assert.strictEqual(C.stepTime("14:30", 15), "14:45");
assert.strictEqual(C.stepTime("23:50", 15), "00:05");
assert.strictEqual(C.stepTime("00:05", -15), "23:50");
assert.strictEqual(C.stepTime("bad", 15), "bad");
+assert.strictEqual(C.stepTime("9.30", 15), "09:45");
+for (const [i, o] of [["9.30", "09:30"], ["9:30", "09:30"], ["930", "09:30"], ["1230", "12:30"],
+ ["9", "09:00"], [" 14h15 ", "14:15"], ["09:05", "09:05"],
+ ["24.00", "24.00"], ["9.30pm", "21:30"], ["12am", "00:00"], ["12 PM", "12:00"],
+ ["9:30 a.m.", "09:30"], ["13pm", "13pm"], ["9.7", "9.7"], ["ab", "ab"], ["", ""]])
+ assert.strictEqual(C.normTime(i), o, i);
+
+// The 12-hour clock, compact; 24-hour leaves calctl's time alone.
+assert.strictEqual(C.clockTime("00:05", true), "12:05a");
+assert.strictEqual(C.clockTime("12:00", true), "12:00p");
+assert.strictEqual(C.clockTime("21:30", true), "9:30p");
+assert.strictEqual(C.clockTime("21:30", false), "21:30");
+assert.strictEqual(C.hourLabel(0, true), "12a");
+assert.strictEqual(C.hourLabel(13, true), "1p");
+assert.strictEqual(C.hourLabel(7, false), "07");
+assert.strictEqual(C.shortDateFmt("bogus"), "ddd dd/MM");
+assert.strictEqual(C.dayFmt("ddd MM/dd", false), "ddd MMM d");
+assert.strictEqual(C.dayFmt("ddd dd/MM", true), "dddd d MMMM");
+assert.strictEqual(C.dayFmt("yyyy-MM-dd", false), "ddd MMM d");
+assert.strictEqual(C.dayFmt("d MMM yyyy", false), "ddd d MMM");
// A new event: the next whole hour, one hour long, alarm 1h.
const d = C.newDraft("2026-10-20", new Date(2026, 9, 13, 9, 20), "home");
@@ -86,6 +106,17 @@ assert.strictEqual(d.alarm, "1h");
assert.strictEqual(d.calendar, "home");
assert.strictEqual(d.source, "");
assert.strictEqual(C.newDraft("2026-10-20", new Date(2026, 9, 13, 23, 10), "home").startTime, "22:00");
+assert.strictEqual(C.newDraft("2026-10-20", new Date(2026, 9, 13, 9, 20), "home", 90).endTime, "11:30");
+
+// The end follows the start, by the default length, past midnight too.
+const w = C.withStart(d, "23:30", 60);
+assert.strictEqual(w.startTime, "23:30");
+assert.strictEqual(w.endTime, "00:30");
+assert.strictEqual(w.endDay, "2026-10-21");
+assert.strictEqual(C.withStart(d, "14:00", 45).endTime, "14:45");
+assert.strictEqual(C.withStart(d, "9.3", 60).endTime, "11:00");
+const multi = Object.assign({}, d, { endDay: "2026-10-22", endTime: "18:00" });
+assert.strictEqual(C.withStart(multi, "08:00", 60).endTime, "18:00");
// From calctl's JSON.
const fe = C.fromEvent({ uid: "u", calendar: "home", title: "Trip", allDay: true, start: "2026-10-14",
@@ -111,7 +142,8 @@ assert.strictEqual(p3.endDay, "2026-10-16");
// To calctl's JSON.
assert.strictEqual(C.toPayload(Object.assign({}, d, { title: " " })).error, "Title is empty");
-assert.strictEqual(C.toPayload(Object.assign({}, d, { title: "x", startTime: "9:00" })).error, "Times are HH:MM");
+assert.strictEqual(C.toPayload(Object.assign({}, d, { title: "x", startTime: "9:00" })).payload.start.slice(11), "09:00");
+assert.strictEqual(C.toPayload(Object.assign({}, d, { title: "x", startTime: "25:00" })).error, "Times are HH:MM");
assert.strictEqual(C.toPayload(Object.assign({}, d, { title: "x", endTime: "09:00" })).error, "End is before start");
assert.strictEqual(C.toPayload(Object.assign({}, d, { title: "x", repeat: "weekly", until: "2026-10-01" })).error,
"Until is before the start");
diff --git a/desktop/island/calendar/test_calctl.py b/desktop/island/calendar/test_calctl.py
index 91ad384..e6b3da2 100644
--- a/desktop/island/calendar/test_calctl.py
+++ b/desktop/island/calendar/test_calctl.py
@@ -290,5 +290,30 @@ assert "json" in run("new", "{not json", ok=False)
assert sorted(p.name for p in tmp.rglob("*.ics")) == before
no_temp()
+# read: an outside .ics as a new draft in the default calendar, nothing written.
+put(tmp / "invite.ics", """
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//test//EN
+BEGIN:VEVENT
+UID:invite-1
+DTSTAMP:20260101T000000Z
+DTSTART:20261203T140000Z
+DTEND:20261203T153000Z
+SUMMARY:Dentist
+LOCATION:Main St 1
+RRULE:FREQ=WEEKLY;BYDAY=TH
+END:VEVENT
+END:VCALENDAR
+""")
+before = sorted(p.name for p in tmp.rglob("*.ics"))
+r = run("read", str(tmp / "invite.ics"))
+assert (r["uid"], r["calendar"], r["title"], r["location"]) == ("", "home", "Dentist", "Main St 1"), r
+assert (r["start"], r["end"], r["allDay"], r["repeat"]) == ("2026-12-03T15:00", "2026-12-03T16:30", False, "none"), r
+assert sorted(p.name for p in tmp.rglob("*.ics")) == before
+put(tmp / "bad.ics", "hello")
+assert "not a calendar" in run("read", str(tmp / "bad.ics"), ok=False)
+assert "cannot read" in run("read", str(tmp / "missing.ics"), ok=False)
+
shutil.rmtree(tmp)
print("test_calctl: ok")
diff --git a/desktop/modules/ai/AiPage.qml b/desktop/modules/ai/AiPage.qml
index c1cb07c..fed9e65 100644
--- a/desktop/modules/ai/AiPage.qml
+++ b/desktop/modules/ai/AiPage.qml
@@ -21,12 +21,7 @@ Column {
spacing: 8
- Text {
- width: page.width
- text: "Engines"
- font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
- color: Theme.subtext
- }
+ SectionHeader { divider: false; glyph: "\uf2db"; label: "Engines" }
Repeater {
model: page.ai.engines
@@ -48,14 +43,7 @@ Column {
}
}
- Item { width: 1; height: 6 }
-
- Text {
- width: page.width
- text: "Apps"
- font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
- color: Theme.subtext
- }
+ SectionHeader { glyph: String.fromCodePoint(0xF003B); label: "Apps" }
Repeater {
model: page.ai.apps
diff --git a/desktop/modules/appearance/README.md b/desktop/modules/appearance/README.md
index 2c9a6ad..f6f0356 100644
--- a/desktop/modules/appearance/README.md
+++ b/desktop/modules/appearance/README.md
@@ -84,7 +84,10 @@ where there is not, and the hovered thumbnail on the targeted screen while the
pointer is over it.
The thumbnails are grouped by folder, each a header that opens and closes
-it, closed to begin with and remembered while the shell runs. The local
+it, closed to begin with and remembered while the shell runs; opening one
+folds whichever was open, so only one is open at a time. A colour filter
+that leaves the open folder empty folds it and opens the first folder with
+matches instead. The local
groups are the top-level folders of `~/Pictures/wallpapers`, with the images
loose in it as a group of its own; after them come the distribution's,
`/usr/share/wallpapers`, as `system` for its loose images and `Plasma` for
@@ -105,6 +108,20 @@ how far it enlarges: not at all is green, up to 1.33x yellow, past that red.
Under the mock screens a note in the same colour says why, for the hovered
image or else the staged one. The staged image keeps the accent border.
+The row of colour circles under the mock screens filters the list: a click
+shows only the wallpapers that carry that colour, folders left empty drop
+out, and a second click shows them all again. Each image is quantized to six
+colours by `magick` on a 64 px copy, run in parallel, and each colour lands
+in a hue bucket, or dark or light when it has little saturation
+(`WallColors.js`, tested by `node test_wallcolors.js`). Each image is filed
+under one bucket, its dominant one: the largest colour bucket when it covers a
+quarter of the image, else the larger of dark and light. A first version
+matched any bucket over a fifth, and a blue sky with a red sunset showed
+under both. The raw colours are cached by path in
+`~/.cache/keystone/wallcolors.tsv`, so only new files are analysed: the first
+run over 843 images filled it in about 20 seconds. Saturation is HSV's, not
+HSL's: HSL reads a pale lavender like `#cad3f5` as strongly coloured.
+
"Open wallhaven-dl" under the mock screens launches the wallhaven-dl app,
which searches wallhaven.cc and finds larger copies of low-res wallpapers,
and closes the settings window, as a successful Apply does, so the desk
diff --git a/desktop/modules/appearance/StepsWindow.qml b/desktop/modules/appearance/StepsWindow.qml
index aeb77fe..dcfe705 100644
--- a/desktop/modules/appearance/StepsWindow.qml
+++ b/desktop/modules/appearance/StepsWindow.qml
@@ -106,6 +106,7 @@ Scope {
}
Flickable {
+ id: steps
width: parent.width
// Sized from the screen, never from the window: the
// window's height comes from this, and a binding back
@@ -114,6 +115,7 @@ Scope {
win.screen.height - 240 - tabBar.implicitHeight - actions.implicitHeight - 32)
contentHeight: content.implicitHeight
clip: true
+ WheelScroll { parent: steps; anchors.fill: parent; flick: steps }
Column {
id: content
diff --git a/desktop/modules/appearance/WallColors.js b/desktop/modules/appearance/WallColors.js
new file mode 100644
index 0000000..749f5cb
--- /dev/null
+++ b/desktop/modules/appearance/WallColors.js
@@ -0,0 +1,70 @@
+.pragma library
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// The wallpaper page's colour filter, tested by test_wallcolors.js under node.
+// Each image is quantized to six colours by magick (Wallpapers.qml), and each
+// colour falls in one bucket here. An image matches one bucket only, its
+// dominant one: the largest colour bucket when it covers a quarter of the
+// image, else the larger of dark and light. Matching any bucket over a share
+// mixed a red sunset into blue for its sky.
+// ponytail: six colours and fixed hue cuts; tune the cuts and MIN if the
+// matches feel off.
+
+var BUCKETS = ["red", "peach", "yellow", "green", "teal", "blue", "mauve", "dark", "light"];
+var MIN = 0.25;
+
+// "#RRGGBB" -> a bucket name, or "" for a mid grey.
+function bucket(hex) {
+ const r = parseInt(hex.slice(1, 3), 16) / 255,
+ g = parseInt(hex.slice(3, 5), 16) / 255,
+ b = parseInt(hex.slice(5, 7), 16) / 255;
+ const max = Math.max(r, g, b), min = Math.min(r, g, b), d = max - min;
+ const l = (max + min) / 2;
+ // HSV saturation: HSL reads a pale lavender like #cad3f5 as strongly
+ // coloured, which is the "light" the swatch means.
+ const s = max === 0 ? 0 : d / max;
+ if (l < 0.15) return "dark";
+ if (s < 0.2) return l < 0.35 ? "dark" : l > 0.65 ? "light" : "";
+ let h = max === r ? ((g - b) / d) % 6 : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
+ h = (h * 60 + 360) % 360;
+ return h < 15 || h >= 335 ? "red" : h < 40 ? "peach" : h < 70 ? "yellow"
+ : h < 160 ? "green" : h < 200 ? "teal" : h < 255 ? "blue" : "mauve";
+}
+
+// "#RRGGBB:count,..." -> { bucket: fraction of the image }.
+function parse(line) {
+ const out = {};
+ let total = 0;
+ for (const part of line.split(",")) {
+ const i = part.indexOf(":");
+ if (i < 0) continue;
+ const n = +part.slice(i + 1), k = bucket(part.slice(0, i));
+ total += n;
+ if (k) out[k] = (out[k] || 0) + n;
+ }
+ for (const k in out) out[k] /= total;
+ return out;
+}
+
+// The bucket an image is filed under, "" for none (mostly mid grey).
+function dominant(fractions) {
+ let best = "", bestF = 0;
+ for (const k in fractions)
+ if (k !== "dark" && k !== "light" && fractions[k] > bestF) { best = k; bestF = fractions[k]; }
+ if (bestF >= MIN) return best;
+ const d = fractions.dark || 0, l = fractions.light || 0;
+ return d === 0 && l === 0 ? "" : d >= l ? "dark" : "light";
+}
+
+function matches(fractions, key) {
+ return !!fractions && dominant(fractions) === key;
+}
diff --git a/desktop/modules/appearance/WallpaperTab.qml b/desktop/modules/appearance/WallpaperTab.qml
index 136b24d..b51b710 100644
--- a/desktop/modules/appearance/WallpaperTab.qml
+++ b/desktop/modules/appearance/WallpaperTab.qml
@@ -205,9 +205,59 @@ Column {
}
}
+ // The colour filter: a click shows only the wallpapers that carry the
+ // colour (Wallpapers.colors), a second click shows them all again.
+ Row {
+ id: colorRow
+ spacing: 8
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: "Colour"
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
+ color: Theme.subtext
+ }
+ Repeater {
+ // Fixed colours, not the theme's: they name WallColors.js's hue
+ // buckets, which do not move with the scheme, and a scheme can
+ // reuse one colour under several names (one had peach = yellow,
+ // blue = lavender, mauve = pink, three pairs of twin circles).
+ model: [
+ { key: "red", color: "#ed8796" }, { key: "peach", color: "#f5a97f" },
+ { key: "yellow", color: "#eed49f" }, { key: "green", color: "#a6da95" },
+ { key: "teal", color: "#8bd5ca" }, { key: "blue", color: "#8aadf4" },
+ { key: "mauve", color: "#c6a0f6" }, { key: "dark", color: "#181926" },
+ { key: "light", color: "#cad3f5" },
+ ]
+ delegate: Rectangle {
+ required property var modelData
+ readonly property bool on: Wallpapers.colorFilter === modelData.key
+ anchors.verticalCenter: parent.verticalCenter
+ width: 22
+ height: 22
+ radius: width / 2
+ color: modelData.color
+ border.width: on ? 3 : swatchHover.hovered ? 2 : 1
+ border.color: on ? Theme.accent : Qt.alpha(Theme.text, swatchHover.hovered ? 0.6 : 0.2)
+ HoverHandler { id: swatchHover }
+ MouseArea {
+ anchors.fill: parent
+ cursorShape: Qt.PointingHandCursor
+ onClicked: Wallpapers.colorFilter = parent.on ? "" : modelData.key
+ }
+ }
+ }
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ visible: Wallpapers.analysing
+ text: "analysing colours…"
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ color: Theme.overlay
+ }
+ }
+
Column {
width: parent.width
- height: parent.height - mockPane.height - parent.spacing
+ height: parent.height - mockPane.height - colorRow.height - parent.spacing * 2
spacing: 12
Row {
@@ -232,6 +282,8 @@ Column {
anchors.verticalCenter: parent.verticalCenter
text: Wallpapers.scanning ? "scanning…"
: Wallpapers.applying ? "applying…"
+ : Wallpapers.colorFilter !== ""
+ ? Wallpapers.groups.reduce((n, g) => n + g.files.length, 0) + " of " + Wallpapers.files.length + " wallpapers"
: Wallpapers.files.length + " wallpapers"
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
color: Theme.overlay
@@ -268,18 +320,50 @@ Column {
return out;
}
function rebuild() {
+ // An open folder the colour filter hid is folded for real,
+ // not just hidden, and unless another is open the first
+ // folder left opens in its place. Left open, it came back
+ // beside the next one opened once the filter was cleared.
+ // Not while the list is empty, before the first scan.
+ const keys = Wallpapers.groups.map(g => g.key);
+ const hidden = Object.keys(Wallpapers.expanded)
+ .filter(k => Wallpapers.expanded[k] && keys.indexOf(k) < 0);
+ if (keys.length > 0 && hidden.length > 0) {
+ hidden.forEach(k => Wallpapers.toggle(k));
+ if (!keys.some(k => Wallpapers.expanded[k])) Wallpapers.toggle(keys[0]);
+ }
rows.clear();
for (const g of Wallpapers.groups) {
rows.append({ key: g.key, start: -1 });
if (Wallpapers.expanded[g.key]) rows.append(rowsOf(g));
}
}
+ // One folder open at a time: opening one first folds any other,
+ // from the bottom up so the indexes above stay put, then scrolls
+ // to the new one's header, which a fold above it would move.
function toggle(index) {
const g = group(rows.get(index).key);
const body = rowsOf(g);
- if (Wallpapers.expanded[g.key]) rows.remove(index + 1, body.length);
- else body.forEach((r, i) => rows.insert(index + 1 + i, r));
+ if (Wallpapers.expanded[g.key]) {
+ rows.remove(index + 1, body.length);
+ Wallpapers.toggle(g.key);
+ return;
+ }
+ let folded = false;
+ for (let i = rows.count - 1; i >= 0; i--) {
+ const r = rows.get(i);
+ if (r.start >= 0 || r.key === g.key || !Wallpapers.expanded[r.key]) continue;
+ rows.remove(i + 1, rowsOf(group(r.key)).length);
+ Wallpapers.toggle(r.key);
+ if (i < index) folded = true;
+ }
+ if (folded) {
+ index = 0;
+ while (rows.get(index).key !== g.key) index++;
+ }
+ body.forEach((r, i) => rows.insert(index + 1 + i, r));
Wallpapers.toggle(g.key);
+ if (folded) positionViewAtIndex(index, ListView.Beginning);
}
// The width settles after creation, and a new column count
@@ -434,18 +518,13 @@ Column {
}
}
- // The default wheel step moves a fraction of a thumbnail; a
- // notch here moves one row. A touchpad's pixel delta is kept.
- MouseArea {
+ // A notch moves one row, animated. On top of the thumbnails,
+ // none of which takes the wheel.
+ WheelScroll {
parent: wallList
anchors.fill: parent
- acceptedButtons: Qt.NoButton
- onWheel: wheel => {
- const d = wheel.pixelDelta.y !== 0 ? wheel.pixelDelta.y
- : wheel.angleDelta.y / 120 * wallList.thumbHeight;
- wallList.contentY = Math.max(wallList.originY, Math.min(
- wallList.originY + wallList.contentHeight - wallList.height, wallList.contentY - d));
- }
+ flick: wallList
+ step: wallList.thumbHeight
}
}
}
diff --git a/desktop/modules/appearance/Wallpapers.qml b/desktop/modules/appearance/Wallpapers.qml
index 2b8faf7..f24aca4 100644
--- a/desktop/modules/appearance/Wallpapers.qml
+++ b/desktop/modules/appearance/Wallpapers.qml
@@ -15,6 +15,7 @@ import Quickshell
import Quickshell.Io
import QtQuick
import "../.."
+import "WallColors.js" as WallColors
// The wallpaper side. Setting one is `wallp`'s job: it knows about the two
// outputs, the saved state and the accent run, and none of that is worth
@@ -93,6 +94,70 @@ Singleton {
sizeProc.running = false;
sizeProc.command = ["sh", "-c", 'printf "%s\\0" "$@" | xargs -0 -r file -N -0', "sh"].concat(root.files);
sizeProc.running = true;
+ root.analyse();
+ }
+ }
+ }
+
+ // Each image's six main colours, for the page's colour filter
+ // (WallColors.js), as fractions by bucket. magick quantizes a 64 px copy,
+ // decoded small with jpeg:size, in parallel; each child prints its line
+ // in one write, so lines do not interleave on the pipe. The raw lines are
+ // cached by path in colorCache: only new files are analysed. An upscale
+ // rewrites a file in place but keeps its colours, so the path is the key.
+ property var colors: ({})
+ property var colorLines: ({})
+ property string colorFilter: ""
+ readonly property bool analysing: colorProc.running
+ readonly property string colorCache:
+ (Quickshell.env("XDG_CACHE_HOME") || home + "/.cache") + "/keystone/wallcolors.tsv"
+
+ function analyse() {
+ if (!colorViewReady) return; // the cache read calls again
+ const missing = files.filter(f => !(f in colorLines));
+ if (missing.length === 0 || colorProc.running) return;
+ colorProc.command = ["sh", "-c",
+ `printf '%s\\0' "$@" | xargs -0 -r -P"$(nproc)" -n1 sh -c '` +
+ `c=$(magick -define jpeg:size=256x256 "$1[0]" -alpha off -resize 64x64 -colors 6 ` +
+ `-format %c histogram:info: 2>/dev/null | sort -rn | ` +
+ `awk "{sub(\\":\\",\\"\\",\\$1); printf \\"%s%s:%s\\", s, substr(\\$3,1,7), \\$1; s=\\",\\"}"); ` +
+ `printf "%s\\t%s\\n" "$1" "$c"' sh`, "sh"].concat(missing);
+ colorProc.running = true;
+ }
+
+ // Raw cache lines to colorLines and colors, reassigned whole so bindings
+ // see the change.
+ function takeColors(text) {
+ const lines = Object.assign({}, colorLines), cols = Object.assign({}, colors);
+ for (const line of text.split("\n")) {
+ const t = line.indexOf("\t");
+ if (t < 0) continue;
+ const p = line.slice(0, t), c = line.slice(t + 1);
+ lines[p] = c;
+ cols[p] = WallColors.parse(c);
+ }
+ colorLines = lines;
+ colors = cols;
+ }
+
+ FileView {
+ id: colorView
+ path: root.colorCache
+ printErrors: false // absent until the first analysis
+ onLoaded: { root.takeColors(text()); root.colorViewReady = true; root.analyse(); }
+ onLoadFailed: { root.colorViewReady = true; root.analyse(); }
+ }
+ property bool colorViewReady: false
+
+ Process {
+ id: colorProc
+ stdout: StdioCollector {
+ onStreamFinished: {
+ root.takeColors(text);
+ let out = "";
+ for (const p in root.colorLines) out += `${p}\t${root.colorLines[p]}\n`;
+ // Never empty: analyse ran only with files to add.
+ colorView.setText(out);
}
}
}
@@ -249,7 +314,11 @@ Singleton {
// `expanded` is indexed by, so a local folder named "system" stays apart.
readonly property var groups: {
const local = {}, system = [], plasma = {};
- for (const f of files) {
+ // With a colour picked, only the images it dominates; one not yet
+ // analysed is left out until it is.
+ const shownFiles = colorFilter === "" ? files
+ : files.filter(f => WallColors.matches(colors[f], colorFilter));
+ for (const f of shownFiles) {
if (f.startsWith(dir + "/")) {
const rel = f.slice(dir.length + 1);
const key = rel.includes("/") ? rel.slice(0, rel.indexOf("/")) : "";
diff --git a/desktop/modules/appearance/test_wallcolors.js b/desktop/modules/appearance/test_wallcolors.js
new file mode 100644
index 0000000..aa05b61
--- /dev/null
+++ b/desktop/modules/appearance/test_wallcolors.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Run: node desktop/modules/appearance/test_wallcolors.js
+// WallColors.js is a QML library, so its .pragma line is stripped before node
+// evaluates it.
+
+const fs = require("fs");
+const assert = require("assert");
+
+const src = fs.readFileSync(__dirname + "/WallColors.js", "utf8").replace(/^\.pragma library$/m, "");
+const C = new Function(src + "\nreturn { bucket, parse, matches, dominant };")();
+
+assert.strictEqual(C.bucket("#ed8796"), "red");
+assert.strictEqual(C.bucket("#f5a97f"), "peach");
+assert.strictEqual(C.bucket("#eed49f"), "yellow");
+assert.strictEqual(C.bucket("#a6da95"), "green");
+assert.strictEqual(C.bucket("#8bd5ca"), "teal");
+assert.strictEqual(C.bucket("#8aadf4"), "blue");
+assert.strictEqual(C.bucket("#2a3a6a"), "blue"); // navy, dark but coloured
+assert.strictEqual(C.bucket("#c6a0f6"), "mauve");
+assert.strictEqual(C.bucket("#181926"), "dark");
+assert.strictEqual(C.bucket("#cad3f5"), "light");
+assert.strictEqual(C.bucket("#808080"), ""); // mid grey: no bucket
+
+const f = C.parse("#8aadf4:30,#181926:60,#808080:10");
+assert.ok(Math.abs(f.blue - 0.3) < 1e-9 && Math.abs(f.dark - 0.6) < 1e-9);
+// One bucket per image: blue covers over a quarter, so it wins over the
+// larger dark.
+assert.ok(C.matches(f, "blue") && !C.matches(f, "dark"));
+assert.ok(!C.matches(f, "red") && !C.matches(undefined, "blue"));
+// Two colours: the larger wins, the smaller does not match.
+const sunset = C.parse("#8aadf4:60,#ed8796:30,#181926:10");
+assert.ok(C.matches(sunset, "blue") && !C.matches(sunset, "red"));
+// No colour covers a quarter: dark or light decides.
+assert.strictEqual(C.dominant(C.parse("#ed8796:10,#181926:60,#cad3f5:30")), "dark");
+assert.strictEqual(C.dominant(C.parse("#808080:1")), "");
+
+console.log("ok");
diff --git a/desktop/modules/assistant/AssistantModule.qml b/desktop/modules/assistant/AssistantModule.qml
index 9e8adbc..6aefb1f 100644
--- a/desktop/modules/assistant/AssistantModule.qml
+++ b/desktop/modules/assistant/AssistantModule.qml
@@ -27,7 +27,8 @@ Module {
settings: true
group: "Assistant"
keywords: ["llm", "model", "llama", "server", "prompt", "temperature", "thinking",
- "rounds", "tools", "environment", "daemon", "restart", "cloud", "provider"]
+ "rounds", "tools", "environment", "daemon", "restart", "cloud", "provider",
+ "folder", "output", "documents"]
readonly property string home: Quickshell.env("HOME")
readonly property string daemonDir: home + "/Programming/GIT/desktop-assistant"
@@ -38,9 +39,10 @@ Module {
// The system interpreter, as for calctl: python3 on PATH is a pyenv shim.
readonly property string python: "/usr/bin/python3"
- readonly property var keys: ["llm", "system", "tool_rounds", "temperature", "thinking"]
+ readonly property var keys: ["llm", "system", "tool_rounds", "temperature", "thinking", "out_dir"]
readonly property var labels: ({ llm: "Server", system: "System prompt", tool_rounds: "Tool rounds",
- temperature: "Temperature", thinking: "Thinking" })
+ temperature: "Temperature", thinking: "Thinking",
+ out_dir: "Output folder" })
// config.toml as last read or written; "" when there is none. The page
// edits draft, which save() writes; base is the file the draft began
diff --git a/desktop/modules/assistant/AssistantPage.qml b/desktop/modules/assistant/AssistantPage.qml
index b25b33b..a952b4f 100644
--- a/desktop/modules/assistant/AssistantPage.qml
+++ b/desktop/modules/assistant/AssistantPage.qml
@@ -359,6 +359,25 @@ Column {
}
}
+ Labelled {
+ objectName: "key:out_dir"
+ label: "Output folder"
+ Field {
+ anchors.fill: parent
+ value: page.v.out_dir ?? ""
+ placeholder: page.d.out_dir ?? ""
+ bad: page.asst.invalid["key:out_dir"] ?? false
+ // Where the canvas and tools write files; the daemon refuses
+ // anything but an absolute or ~ path, so a bad one never saves.
+ onEdited: t => {
+ const s = t.trim();
+ const ok = s === "" || s.startsWith("/") || s === "~" || s.startsWith("~/");
+ page.asst.markInvalid("key:out_dir", !ok);
+ if (ok) page.asst.setKey("out_dir", s ? page.asst.quote(s) : null);
+ }
+ }
+ }
+
// The prompt is long and multi-line, so it gets its own box and an
// explicit Save rather than Enter.
Column {
@@ -379,7 +398,9 @@ Column {
color: Theme.surface
ScrollView {
+ id: promptScroll
anchors { fill: parent; margins: 8 }
+ WheelScroll { parent: promptScroll; anchors.fill: parent; flick: promptScroll.contentItem; step: 60 }
TextArea {
id: prompt
wrapMode: TextEdit.Wrap
@@ -680,15 +701,39 @@ Column {
id: toolText
anchors { left: toolSw.right; leftMargin: 10; right: cloudMark.left; rightMargin: 10
verticalCenter: parent.verticalCenter }
- Text {
- text: toolRow.modelData.name
- color: page.asst.toolOn(toolRow.modelData) ? Theme.text : Theme.subtext
- font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
+ // A description ending "Read-only." shows it as a chip by
+ // the name instead. The toml keeps the sentence: the model
+ // reads the description too.
+ readonly property var ro: /\s*Read-only\.\s*$/.exec(toolRow.modelData.description ?? "")
+ Row {
+ spacing: 8
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: toolRow.modelData.name
+ color: page.asst.toolOn(toolRow.modelData) ? Theme.text : Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
+ }
+ Rectangle {
+ anchors.verticalCenter: parent.verticalCenter
+ visible: toolText.ro !== null
+ width: roText.implicitWidth + 12
+ height: roText.implicitHeight + 4
+ radius: height / 2
+ color: Qt.alpha(Theme.overlay, 0.35)
+ Text {
+ id: roText
+ anchors.centerIn: parent
+ text: "read only"
+ color: Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 5 }
+ }
+ }
}
Small {
width: parent.width
wrapMode: Text.Wrap
- text: toolRow.modelData.description
+ text: toolText.ro ? toolRow.modelData.description.slice(0, toolText.ro.index)
+ : toolRow.modelData.description
}
}
}
diff --git a/desktop/modules/bluetooth/BluetoothPage.qml b/desktop/modules/bluetooth/BluetoothPage.qml
index 8ab67f0..a289205 100644
--- a/desktop/modules/bluetooth/BluetoothPage.qml
+++ b/desktop/modules/bluetooth/BluetoothPage.qml
@@ -22,21 +22,13 @@ Column {
// --- Adapter ---
- Item {
- width: page.width
- implicitHeight: Math.max(btLabel.implicitHeight, powerSwitch.implicitHeight)
-
- Text {
- id: btLabel
- anchors.verticalCenter: parent.verticalCenter
- text: "Bluetooth"
- font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 1; bold: true }
- color: Theme.text
- }
+ SectionHeader {
+ divider: false
+ glyph: "\uf293"
+ label: "Bluetooth"
Switch {
- id: powerSwitch
- anchors { right: parent.right; verticalCenter: parent.verticalCenter }
+ anchors { right: parent.right; bottom: parent.bottom }
enabled: page.bt.adapter !== null
checked: page.bt.adapter ? page.bt.adapter.enabled : false
onToggled: on => { if (page.bt.adapter) page.bt.adapter.enabled = on; }
@@ -97,13 +89,7 @@ Column {
// --- Connected ---
- Text {
- width: page.width
- visible: page.bt.connectedDevices.length > 0
- text: "Connected"
- font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
- color: Theme.subtext
- }
+ SectionHeader { visible: page.bt.connectedDevices.length > 0; glyph: "\uf0c1"; label: "Connected" }
Repeater {
model: page.bt.connectedDevices
@@ -118,13 +104,7 @@ Column {
// --- Paired ---
- Text {
- width: page.width
- visible: page.bt.pairedDevices.length > 0
- text: "Paired"
- font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
- color: Theme.subtext
- }
+ SectionHeader { visible: page.bt.pairedDevices.length > 0; glyph: String.fromCodePoint(0xF1218); label: "Paired" }
Repeater {
model: page.bt.pairedDevices
@@ -139,13 +119,7 @@ Column {
// --- Available (found while scanning, not yet paired) ---
- Text {
- width: page.width
- visible: page.bt.availableDevices.length > 0
- text: "Available"
- font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
- color: Theme.subtext
- }
+ SectionHeader { visible: page.bt.availableDevices.length > 0; glyph: "\uf002"; label: "Available" }
Repeater {
model: page.bt.availableDevices
diff --git a/desktop/modules/clipboard/ClipboardPage.qml b/desktop/modules/clipboard/ClipboardPage.qml
index 945557c..9b48909 100644
--- a/desktop/modules/clipboard/ClipboardPage.qml
+++ b/desktop/modules/clipboard/ClipboardPage.qml
@@ -101,6 +101,7 @@ Item {
highlightMoveDuration: 0
boundsBehavior: Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar {}
+ WheelScroll { parent: list; anchors.fill: parent; flick: list }
Text {
anchors.centerIn: parent
diff --git a/desktop/modules/deckit/DeckIt.qml b/desktop/modules/deckit/DeckIt.qml
index 632285f..f39ad8c 100644
--- a/desktop/modules/deckit/DeckIt.qml
+++ b/desktop/modules/deckit/DeckIt.qml
@@ -58,9 +58,12 @@ Singleton {
// waiting, tablet, extend}; null until the first answer.
property var status: null
property int watchers: 0
- // A pending Restart, 0 when none; its outcome goes to the window's snackbar.
- property real restartAt: 0
- readonly property int restartTimeout: 30000
+ // A Start, Stop or Restart from the drawer while it takes effect, "" when
+ // none. It clears once `deck-it status` shows the result, or after busyTimeout.
+ property string busy: ""
+ property real busyAt: 0
+ readonly property int busyTimeout: 30000
+ readonly property bool running: !!root.status && (root.status.server || root.status.waiting)
// One line for the page.
readonly property string summary: {
@@ -75,24 +78,26 @@ Singleton {
readonly property bool healthy: !!root.status && root.status.server && root.status.tablet !== ""
&& (!root.status.extend || root.status.display)
- // Stops it and starts it again the way login does, so a saved config applies.
- function restart() {
- Quickshell.execDetached(["sh", "-c", "deck-it stop; exec deck-it wifi --wait"]);
- Snack.wait("Restarting deck-it…");
- root.restartAt = Date.now();
- // Let stop run first, or the first poll still sees the old instance.
+ // Start and Restart start it the way login does, so a saved config applies.
+ readonly property var commands: ({
+ start: "exec deck-it wifi --wait",
+ stop: "deck-it stop",
+ restart: "deck-it stop; exec deck-it wifi --wait"
+ })
+
+ function control(op) {
+ Quickshell.execDetached(["sh", "-c", root.commands[op]]);
+ root.busy = op;
+ root.busyAt = Date.now();
poll.restart();
}
- function checkRestart() {
- if (root.restartAt === 0) return;
- if (root.healthy) {
- Snack.ok("deck-it restarted");
- root.restartAt = 0;
- } else if (Date.now() - root.restartAt > root.restartTimeout) {
- Snack.error("deck-it not back after " + root.restartTimeout / 1000 + "s: " + root.summary);
- root.restartAt = 0;
- }
+ function checkBusy() {
+ if (!root.busy) return;
+ const age = Date.now() - root.busyAt;
+ // ponytail: 2s before believing a Restart, so the old instance's last answer does not count.
+ const done = root.busy === "stop" ? !!root.status && !root.running : root.running && age > 2000;
+ if (done || age > root.busyTimeout) root.busy = "";
}
Timer {
@@ -109,7 +114,7 @@ Singleton {
stdout: StdioCollector { id: statOut }
onExited: {
try { root.status = JSON.parse(statOut.text); } catch (e) { root.status = null; }
- root.checkRestart();
+ root.checkBusy();
}
}
diff --git a/desktop/modules/deckit/DeckItDashboardModule.qml b/desktop/modules/deckit/DeckItDashboardModule.qml
index ca033f8..1664976 100644
--- a/desktop/modules/deckit/DeckItDashboardModule.qml
+++ b/desktop/modules/deckit/DeckItDashboardModule.qml
@@ -12,7 +12,7 @@
import QtQuick
import "../.."
-// deck-it's dashboard: its panels, its action icons and the hardware it reads.
+// deck-it's dashboard: its panels, the tablet screen and the hardware it reads.
Module {
name: "deckit-dashboard"
label: "Dashboard"
@@ -21,10 +21,10 @@ Module {
settings: true
group: "deck-it"
dirty: DeckIt.store.dirty
- keywords: ["deck-it", "tablet", "dashboard", "modules", "panels", "actions", "icons", "hardware",
+ keywords: ["deck-it", "tablet", "dashboard", "modules", "panels", "lock", "hardware",
"network", "battery", "cpu", "gpu", "sensor", "dim", "brightness", "backlight"]
readonly property var fields: [
- ["modules", "", "Dashboard parts"], ["dashboard", "actions", "Dashboard actions"],
+ ["modules", "", "Dashboard parts"],
["tablet", "dim_after", "Dim after"], ["tablet", "dim_brightness", "Dim brightness"],
["hardware", "net", "Network interface"], ["hardware", "battery", "Battery"],
["hardware", "cpu_sensor", "CPU sensor"], ["hardware", "gpu", "GPU"],
diff --git a/desktop/modules/deckit/DeckItDashboardPage.qml b/desktop/modules/deckit/DeckItDashboardPage.qml
index 14aba95..8a1f7b6 100644
--- a/desktop/modules/deckit/DeckItDashboardPage.qml
+++ b/desktop/modules/deckit/DeckItDashboardPage.qml
@@ -14,22 +14,13 @@ import "../.."
import "../qtmaildir"
import "Modules.js" as Modules
-// deck-it's Dashboard page: its panels, its action icons, the hardware it reads.
+// deck-it's Dashboard page: its panels, the tablet screen, the hardware it reads.
Column {
id: col
spacing: 6
readonly property var st: DeckIt.store
function def(section, key) { return col.st.fallback(section, key); }
- // The dashboard's action icons: every id deck-it knows is in the
- // defaults' list; the file keeps the ones switched on, in that order.
- readonly property var allActions: col.def("dashboard", "actions") ?? []
- readonly property var actions: col.st.value("dashboard", "actions") ?? col.allActions
- function setAction(id, on) {
- col.st.put("dashboard", "actions",
- col.allActions.filter(a => a === id ? on : col.actions.includes(a)));
- }
-
Small { visible: DeckIt.defaultsError !== ""; color: Theme.red; text: DeckIt.defaultsError }
Heading { objectName: "modules/"; text: "Dashboard parts" }
@@ -43,31 +34,6 @@ Column {
}
}
- Heading { objectName: "dashboard/actions"; text: "Dashboard actions" }
- Small { text: "Icon buttons at the bottom of the tablet's dashboard." }
- Repeater {
- model: col.allActions
- Item {
- id: act
- required property string modelData
- width: col.width
- height: 34
- Text {
- id: actLabel
- anchors { left: parent.left; verticalCenter: parent.verticalCenter }
- width: 160
- text: act.modelData
- color: Theme.subtext
- font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 }
- }
- Switch {
- anchors { left: actLabel.right; leftMargin: 8; verticalCenter: parent.verticalCenter }
- checked: col.actions.includes(act.modelData)
- onToggled: on => col.setAction(act.modelData, on)
- }
- }
- }
-
Heading { text: "Tablet screen" }
Setting { store: col.st; section: "tablet"; key: "dim_after"; label: "Dim after"; kind: "int"; min: 0; max: 3600
placeholder: col.st.placeholder("tablet", "dim_after")
diff --git a/desktop/modules/deckit/DeckItGeneralPage.qml b/desktop/modules/deckit/DeckItGeneralPage.qml
index 776099a..934912a 100644
--- a/desktop/modules/deckit/DeckItGeneralPage.qml
+++ b/desktop/modules/deckit/DeckItGeneralPage.qml
@@ -25,7 +25,7 @@ Column {
readonly property var st: DeckIt.store
function def(section, key) { return col.st.fallback(section, key); }
- Small { text: DeckIt.path + ", only the keys that differ from deck-it's defaults. Saved changes apply when deck-it restarts." }
+ Small { text: DeckIt.path + ", only the keys that differ from deck-it's defaults. Saved changes apply when deck-it restarts (the drawer's Services)." }
Small { visible: DeckIt.defaultsError !== ""; color: Theme.red; text: DeckIt.defaultsError }
Component.onCompleted: DeckIt.watchers++
Component.onDestruction: DeckIt.watchers--
diff --git a/desktop/modules/deckit/DeckItModule.qml b/desktop/modules/deckit/DeckItModule.qml
index f3986e9..1a20170 100644
--- a/desktop/modules/deckit/DeckItModule.qml
+++ b/desktop/modules/deckit/DeckItModule.qml
@@ -15,7 +15,7 @@ import "../.."
import "../qtmaildir"
// deck-it, the tablet dashboard: Server, the first of its four pages, with
-// its state and Restart in the header. See README.md.
+// its state in the header; Start, Stop and Restart are in the drawer's Services. See README.md.
Module {
id: mod
name: "deckit"
@@ -57,11 +57,6 @@ Module {
: Theme.red
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
}
- Button {
- text: DeckIt.restartAt ? "Restarting…" : "Restart"
- enabled: !DeckIt.restartAt
- onClicked: DeckIt.restart()
- }
SaveBar {
dirty: DeckIt.store.dirty; valid: DeckIt.store.valid; error: DeckIt.store.error
onSave: DeckIt.save(); onDiscard: DeckIt.store.discard()
diff --git a/desktop/modules/deckit/DeckItServicesModule.qml b/desktop/modules/deckit/DeckItServicesModule.qml
index 5ad3c3e..6c3fcf5 100644
--- a/desktop/modules/deckit/DeckItServicesModule.qml
+++ b/desktop/modules/deckit/DeckItServicesModule.qml
@@ -22,10 +22,10 @@ Module {
group: "deck-it"
dirty: DeckIt.store.dirty
keywords: ["deck-it", "tablet", "services", "obs", "websocket", "llm", "printer", "k1c", "klipper",
- "moonraker", "build vm", "sbbuilder", "ssh"]
+ "moonraker", "build vm", "sbbuilder", "ssh", "vikunja", "todo"]
readonly property var fields: [
["obs", "host", "OBS host"], ["obs", "port", "OBS port"], ["obs", "password", "OBS password"],
- ["llm", "url", "LLM dashboard URL"], ["k1c", "url", "K1C Moonraker"], ["sbbuilder", "host", "Build VM host"]]
+ ["llm", "url", "LLM dashboard URL"], ["k1c", "url", "K1C Moonraker"], ["todo", "url", "Vikunja URL"], ["todo", "pass", "Vikunja token"], ["sbbuilder", "host", "Build VM host"]]
searchItems: fields.map(f => ({ text: f[2], key: f[0] + "/" + f[1] }))
function refresh() { DeckIt.reload(); }
diff --git a/desktop/modules/deckit/DeckItServicesPage.qml b/desktop/modules/deckit/DeckItServicesPage.qml
index e02cf16..4524895 100644
--- a/desktop/modules/deckit/DeckItServicesPage.qml
+++ b/desktop/modules/deckit/DeckItServicesPage.qml
@@ -32,6 +32,12 @@ Column {
placeholder: col.st.placeholder("llm", "url") }
Setting { store: col.st; section: "k1c"; key: "url"; label: "K1C Moonraker"
placeholder: "http://ip:7125"; hint: "The printer's Moonraker address, for the K1C tab. Empty: no printer." }
+ Setting { store: col.st; section: "xbox"; key: "client_id"; label: "Xbox client id"
+ placeholder: "Azure app client id"; hint: "Your Azure app registration, for the Xbox tab. Sign in on the tab." }
+ Setting { store: col.st; section: "todo"; key: "url"; label: "Vikunja URL"
+ placeholder: "http://host:3456"; hint: "For the Dashboard's todo row. Empty: no row." }
+ Setting { store: col.st; section: "todo"; key: "pass"; label: "Vikunja token"
+ placeholder: "pass entry"; hint: "The pass entry holding a Vikunja API token that reads and updates tasks." }
Setting { store: col.st; section: "sbbuilder"; key: "host"; label: "Build VM host"
placeholder: col.st.placeholder("sbbuilder", "host"); hint: "ssh host alias; runs sbb-remote jobs there." }
}
diff --git a/desktop/modules/deckit/Modules.js b/desktop/modules/deckit/Modules.js
index 7bfbdbc..48a9e79 100644
--- a/desktop/modules/deckit/Modules.js
+++ b/desktop/modules/deckit/Modules.js
@@ -14,10 +14,10 @@
// deck-it's [modules] split for the pages: the ones with a tab of their own,
// and the rest, which only feed the Dashboard. A module deck-it adds later
// lands with the Dashboard ones until it is listed here.
-var TABS = ["windows", "obs", "k1c", "assistant"];
+var TABS = ["windows", "obs", "k1c", "assistant", "vm", "xbox"];
var NAMES = { stats: "System", music: "Music", llm: "LLM usage", tablet: "Tablet",
- sbbuilder: "Build VM", actions: "Action icons", windows: "Windows",
- obs: "OBS", k1c: "K1C printer", assistant: "Assistant" };
+ sbbuilder: "Build VM", actions: "Sleep with PC lock", windows: "Windows",
+ obs: "OBS", k1c: "K1C printer", assistant: "Assistant", vm: "VMs", xbox: "Xbox", todo: "Vikunja todos" };
function tabs(all) { return all.filter(m => TABS.includes(m)); }
function parts(all) { return all.filter(m => !TABS.includes(m)); }
diff --git a/desktop/modules/deckit/README.md b/desktop/modules/deckit/README.md
index 197b382..59e5d4e 100644
--- a/desktop/modules/deckit/README.md
+++ b/desktop/modules/deckit/README.md
@@ -2,12 +2,12 @@
Four settings pages, in their own deck-it sidebar group, for deck-it (the
tablet dashboard, its own repo): whether it starts at login, and its
-`~/.config/deck-it/config.toml`.
+`~/.config/deck-it/config.toml`. Running it is the drawer's: its row on the
+Services page (`modules/services`) has its state, Start, Stop and Restart.
- Server (`DeckItModule`, `DeckItGeneralPage`): the config path, Start
(start at login, Wi-Fi address), Display, Tabs (the tablet's tabs) and
- Advanced (ports, Hyprland config, fallback icon theme). Its header carries deck-it's state and
- Restart.
+ Advanced (ports, Hyprland config, fallback icon theme). Its header carries deck-it's state.
- Dashboard (`DeckItDashboardModule`, `DeckItDashboardPage`): the
Dashboard parts (the modules without a tab), the action icons, the
tablet screen's idle dimming, and Hardware. `Modules.js` says which of deck-it's `[modules]` are tabs and
@@ -42,17 +42,17 @@ Launchers are desktop ids (`[launch] apps`), added from the installed apps
the way the Autostart page picks one, minus terminal apps. Up and Remove edit
the list; the order is the button order on the tablet.
-deck-it reads its config once at start, so a save applies on Restart
-deck-it, which runs `deck-it stop` and then the login command.
-
-While the Server page is open it polls `deck-it status` (JSON: server, display,
-waiting, tablet, extend) every 2s and shows one line in that page's header,
-beside Restart and Save, as the Wallpaper engine page does: green when the
-server runs with a tablet tunnelled (and the display streams, if enabled),
-yellow while starting or waiting for the tablet, red when stopped. A Restart's
-outcome goes to the window's snackbar: "deck-it restarted" once that state is
-green, or what it saw if it is not back within 30s; a `wifi --wait` with no
-tablet in reach ends there.
+deck-it reads its config once at start, so a save applies on the
+Services row's Restart, which runs `deck-it stop` and then the login command; Start
+runs the login command, Stop `deck-it stop`.
+
+While the Server page or the drawer's Services page is open it polls `deck-it
+status` (JSON: server, display, waiting, tablet, extend) every 2s and shows
+one line: green when the server runs with a tablet tunnelled (and the display
+streams, if enabled), yellow while starting or waiting for the tablet, red
+when stopped. A Start, Stop or Restart shows "Starting…" and so on, and
+disables the buttons, until the status shows it done (running or waiting, or
+stopped) or 30s pass.
Check: `node desktop/modules/sbbuilder/test_toml.js`; the deck-it side is
tested in its repo.
diff --git a/desktop/modules/fonts/Fonts.js b/desktop/modules/fonts/Fonts.js
index 5b7d303..d42c784 100644
--- a/desktop/modules/fonts/Fonts.js
+++ b/desktop/modules/fonts/Fonts.js
@@ -12,9 +12,10 @@
// Pure helpers for the fonts page, tested by test_fonts.js under node.
//
-// The model is fonts.json: {base, override}. base is one pixel size for the
-// whole desktop; override maps a system ("qt") or one entry of a section
-// ("rofi:kf-launcher-entry") to its own pixel size. Everything is stored in
+// The model is fonts.json: {base, override, family}. base is one pixel size
+// for the whole desktop; override maps a system ("qt") or one entry of a
+// section ("rofi:kf-launcher-entry") to its own pixel size; family maps a
+// font slot no other config holds (FAMILIES) to an installed family. Everything is stored in
// px and converted where a system wants points: at scale 1 Wayland's logical
// DPI is 96 (gtk-xft-dpi reads 98304, 96 * 1024), so px = pt * 96 / 72.
@@ -30,6 +31,14 @@ const SYSTEMS = [
{ id: "gtk", label: "GTK", unit: "pt", where: "gtk-3.0 and gtk-4.0 settings.ini, .gtkrc-2.0, gsettings", when: "at once for GTK 3 and 4" },
{ id: "kitty", label: "kitty", unit: "pt", where: "kitty.conf, through an include", when: "at once" },
{ id: "groupbar", label: "Hyprland groupbar", unit: "px", where: "keystone.lua, group:groupbar:font_size", when: "at once" },
+ { id: "deckit", label: "deck-it", unit: "px", where: "deck-it's theme.css, from fonts.json", when: "on the tablet within 5 s" },
+];
+
+// deck-it's dim cover clock, sized from deck-it's text as deck.css designs
+// it (8rem, 1.6rem); an override is "deckit:clock" or "deckit:date".
+const DECKIT_CLOCK = [
+ { id: "clock", label: "Clock time", ratio: 8 },
+ { id: "date", label: "Clock date", ratio: 1.6 },
];
// A section is a set of designed sizes that scale together: rofi's fonts,
@@ -40,6 +49,12 @@ const SECTIONS = [
{ id: "hyprlock", label: "hyprlock", unit: "pt", when: "next lock" },
];
+// Font families set here, read by their program from fonts.json itself.
+const FAMILIES = [
+ { id: "deckit-clock", label: "deck-it clock", where: "the time on the tablet's dim cover" },
+ { id: "deckit-date", label: "deck-it date", where: "the date under it" },
+];
+
// A system's or a section's size in px.
function size(m, id) {
const o = m.override[id];
@@ -62,13 +77,21 @@ function withOverride(m, id, px) {
const o = {};
for (const k in m.override) if (k !== id) o[k] = m.override[k];
if (px !== null) o[id] = px;
- return { base: m.base, override: o };
+ return { base: m.base, override: o, family: m.family };
+}
+
+// The model with family id set to name, or unset when name is empty.
+function withFamily(m, id, name) {
+ const f = {};
+ for (const k in m.family) if (k !== id) f[k] = m.family[k];
+ if (name.trim() !== "") f[id] = name.trim();
+ return { base: m.base, override: m.override, family: f };
}
function parseModel(text) {
try {
const j = JSON.parse(text);
- if (typeof j.base === "number") return { base: j.base, override: j.override || {} };
+ if (typeof j.base === "number") return { base: j.base, override: j.override || {}, family: j.family || {} };
} catch (e) {}
return null;
}
@@ -78,7 +101,7 @@ function parseModel(text) {
// from it is an override at its current size. Kept to 0.01px: at 0.1, an
// 11pt body stored as 14.7px scaled rofi's 72pt glyph to 72.2.
function seed(now) {
- const m = { base: 16, override: {} };
+ const m = { base: 16, override: {}, family: {} };
for (const id in now) if (now[id] !== null && Math.abs(now[id] - 16) > 0.05) m.override[id] = Math.round(now[id] * 100) / 100;
return m;
}
diff --git a/desktop/modules/fonts/FontsModule.qml b/desktop/modules/fonts/FontsModule.qml
index 016d85d..76f6ae9 100644
--- a/desktop/modules/fonts/FontsModule.qml
+++ b/desktop/modules/fonts/FontsModule.qml
@@ -33,7 +33,7 @@ Module {
settings: true
group: "Appearance"
dirty: fm.touched
- keywords: ["font", "size", "text", "px", "pt", "qt6ct", "gtk", "kitty", "rofi", "hyprlock", "groupbar", "scale"]
+ keywords: ["font", "size", "text", "px", "pt", "qt6ct", "gtk", "kitty", "rofi", "hyprlock", "groupbar", "scale", "family", "deck-it", "clock", "date", "tablet"]
readonly property string home: Quickshell.env("HOME")
readonly property string config: Quickshell.env("XDG_CONFIG_HOME") || fm.home + "/.config"
@@ -76,7 +76,7 @@ Module {
}
readonly property var saved: { fm.version; return F.parseModel(fm.texts.model ?? "") ?? F.seed(fm.now()); }
- property var draft: ({ base: 16, override: {} })
+ property var draft: ({ base: 16, override: {}, family: {} })
// A reload replaces the draft only while it holds no edits.
onSavedChanged: if (!fm.touched) fm.draft = fm.saved
property bool touched: false
@@ -85,6 +85,7 @@ Module {
function setBase(px) { fm.touched = true; fm.draft = { base: px, override: fm.draft.override }; }
function setOverride(id, px) { fm.touched = true; fm.draft = F.withOverride(fm.draft, id, px); }
+ function setFamily(id, name) { fm.touched = true; fm.draft = F.withFamily(fm.draft, id, name); }
function discard() { fm.touched = false; fm.draft = fm.saved; fm.error = ""; }
function refresh() {
diff --git a/desktop/modules/fonts/FontsPage.qml b/desktop/modules/fonts/FontsPage.qml
index fd2e672..1a58b11 100644
--- a/desktop/modules/fonts/FontsPage.qml
+++ b/desktop/modules/fonts/FontsPage.qml
@@ -11,6 +11,7 @@
import QtQuick
import "../.."
+import "../appearance" as A
import "Fonts.js" as F
// The base size, then a row per system and per section entry: what it is,
@@ -27,9 +28,9 @@ Column {
spacing: 8
- function clamp(px) { return Math.max(page.minPx, Math.min(page.maxPx, px)); }
+ function clamp(px, max) { return Math.max(page.minPx, Math.min(max, px)); }
// A step of 1 in the row's own unit, so a pt row moves by whole points.
- function step(px, unit, d) { return page.clamp(unit === "pt" ? F.toPx(Math.round(F.toPt(px)) + d) : Math.round(px) + d); }
+ function step(px, unit, d, max) { return page.clamp(unit === "pt" ? F.toPx(Math.round(F.toPt(px)) + d) : Math.round(px) + d, max); }
component Small: Text {
color: Theme.subtext
@@ -60,13 +61,14 @@ Column {
property real px: 16
property string unit: "px"
property bool enabled: true
+ property real max: page.maxPx
signal changed(real px)
spacing: 6
opacity: st.enabled ? 1 : 0.45
- Button { text: "−"; enabled: st.enabled; onClicked: st.changed(page.step(st.px, st.unit, -1)) }
+ Button { text: "−"; enabled: st.enabled; onClicked: st.changed(page.step(st.px, st.unit, -1, st.max)) }
Unit { text: F.round(st.px) + " px"; own: st.unit === "px" }
Unit { text: F.round(F.toPt(st.px)) + " pt"; own: st.unit === "pt" }
- Button { text: "+"; enabled: st.enabled; onClicked: st.changed(page.step(st.px, st.unit, 1)) }
+ Button { text: "+"; enabled: st.enabled; onClicked: st.changed(page.step(st.px, st.unit, 1, st.max)) }
}
// A system or a section entry. id is its override key; inherited is the
@@ -79,6 +81,7 @@ Column {
property string unit: "px"
required property real inherited
property string follows: "base"
+ property real max: page.maxPx
readonly property bool own: page.m.override[sr.key] !== undefined
readonly property real px: sr.own ? page.m.override[sr.key] : sr.inherited
objectName: "font:" + sr.key
@@ -116,6 +119,7 @@ Column {
anchors.verticalCenter: parent.verticalCenter
px: sr.px
unit: sr.unit
+ max: sr.max
enabled: sr.own
onChanged: px => page.fonts.setOverride(sr.key, px)
}
@@ -147,7 +151,7 @@ Column {
Heading { text: "Systems" }
Repeater {
- model: F.SYSTEMS.filter(s => s.id !== "groupbar")
+ model: F.SYSTEMS.filter(s => s.id !== "groupbar" && s.id !== "deckit")
SizeRow {
required property var modelData
key: modelData.id
@@ -166,6 +170,26 @@ Column {
inherited: page.m.base
}
+ Heading { text: "deck-it" }
+ SizeRow {
+ key: "deckit"
+ title: "deck-it text"
+ detail: "The tablet page's rem. deck-it reads fonts.json itself; seen on the tablet within 5 s."
+ inherited: page.m.base
+ }
+ Repeater {
+ model: F.DECKIT_CLOCK
+ SizeRow {
+ required property var modelData
+ key: "deckit:" + modelData.id
+ title: modelData.label
+ detail: "On the dim cover, designed at " + modelData.ratio + "× deck-it's text."
+ follows: "deck-it"
+ max: 400
+ inherited: F.size(page.m, "deckit") * modelData.ratio
+ }
+ }
+
// rofi and hyprlock: the section's size, which is its body text, then
// each entry at its designed ratio to the body.
Repeater {
@@ -209,4 +233,41 @@ Column {
}
}
}
+
+ // Families no other config holds; the program reads fonts.json itself.
+ Heading { text: "Families" }
+ Small {
+ x: 8
+ width: parent.width - 16
+ text: "A family installed on this PC, as fc-list names it. Empty keeps the program's own font."
+ }
+ Repeater {
+ model: F.FAMILIES
+ Item {
+ id: fr
+ required property var modelData
+ objectName: "font:" + fr.modelData.id
+ width: page.width
+ height: 48
+ Column {
+ anchors { left: parent.left; leftMargin: 8; right: field.left; rightMargin: 12; verticalCenter: parent.verticalCenter }
+ Text {
+ text: fr.modelData.label
+ color: Theme.text
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
+ }
+ Small { width: parent.width; text: fr.modelData.where }
+ }
+ A.Field {
+ id: field
+ anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter }
+ width: 240
+ value: page.m.family[fr.modelData.id] ?? ""
+ placeholder: "program's font"
+ // Every keystroke, not editingFinished: a click on Save takes no
+ // focus, so a name typed and saved would never reach the draft.
+ onValueChanged: if (value.trim() !== (page.m.family[fr.modelData.id] ?? "")) page.fonts.setFamily(fr.modelData.id, value)
+ }
+ }
+ }
}
diff --git a/desktop/modules/fonts/README.md b/desktop/modules/fonts/README.md
index b887060..c3e2232 100644
--- a/desktop/modules/fonts/README.md
+++ b/desktop/modules/fonts/README.md
@@ -4,7 +4,8 @@ One pixel size for the desktop, in the settings window under Appearance >
Fonts, and an override wherever a system needs its own. Saved as
`~/.config/keystone/fonts.json`:
- { "base": 16, "override": { "qt": 18.67, "rofi:kf-launcher-entry": 22 } }
+ { "base": 16, "override": { "qt": 18.67, "rofi:kf-launcher-entry": 22 },
+ "family": { "deckit-clock": "Some Font" } }
Everything is stored in px. At scale 1 Wayland's logical DPI is 96
(`gtk-xft-dpi` reads 98304, 96 * 1024), so a point is 4/3 of a pixel and
@@ -17,6 +18,7 @@ Everything is stored in px. At scale 1 Wayland's logical DPI is 96
| GTK | gtk-3.0 and gtk-4.0 `settings.ini`, `.gtkrc-2.0`, gsettings `font-name` | pt | at once for GTK 3 and 4 |
| kitty | `~/.config/keystone/kitty-fonts.conf`, included last by `kitty.conf`; SIGUSR1 reloads | pt | at once |
| Hyprland groupbar | `group:groupbar:font_size` line in `keystone.lua` | px | at once |
+| deck-it | reads `fonts.json` itself into its `theme.css`: `deckit`, and the dim cover's `deckit:clock` and `deckit:date` (8 and 1.6 times `deckit` unless set) | px | on the tablet within 5 s |
| rofi | `~/.config/keystone/rofi-fonts.rasi`, imported by udt's `common.rasi` | pt | next open |
| hyprlock | `~/.config/keystone/hyprlock-fonts.conf`, sourced by `hyprlock.conf` | pt | next lock |
@@ -39,7 +41,11 @@ With no `fonts.json`, the page starts from what the files say: base 16 px,
and an override for every system at its current size, so the first save
changes nothing.
-Not handled: font families; the hard-coded `pixelSize` values in the shells
+`family` names a font for a slot no other config holds, read by its
+program from `fonts.json` itself: `deckit-clock` and `deckit-date`, the
+time and the date on deck-it's dim cover. Empty leaves the program's own.
+
+Not handled: the families of the systems above; the hard-coded `pixelSize` values in the shells
(21 of them), which do not follow `Theme.fontSize`; and a `keystone.lua`
save from this page and the Options page at the same moment, which can drop
one line.
diff --git a/desktop/modules/fonts/test_fonts.js b/desktop/modules/fonts/test_fonts.js
index 947bd42..773da64 100644
--- a/desktop/modules/fonts/test_fonts.js
+++ b/desktop/modules/fonts/test_fonts.js
@@ -17,7 +17,7 @@ const fs = require("fs");
const assert = require("assert");
const src = fs.readFileSync(__dirname + "/Fonts.js", "utf8").replace(/^\.pragma library$/m, "");
-const F = new Function(src + "\nreturn { size, entryPx, withOverride, parseModel, seed, qtPt, gtkPt, kittyPt, "
+const F = new Function(src + "\nreturn { DECKIT_CLOCK, size, entryPx, withOverride, withFamily, parseModel, seed, qtPt, gtkPt, kittyPt, "
+ "rofiEntries, hyprlockEntries, setQt, setGtk, gtkFamily, kittyFile, rofiFile, hyprlockFile };")();
const qt = '[Fonts]\nfixed="Inconsolata Nerd Font Mono,14,-1,5,400"\ngeneral="Noto Sans,14,-1,5,400,Regular"\n';
@@ -36,11 +36,16 @@ assert.strictEqual(F.setGtk(gtk2, 12), 'gtk-font-name="Noto Sans, 12"\n');
// The first save changes nothing: what differs from 16px is an override.
const m = F.seed({ quickshell: 16, qt: 14 * 4 / 3, gtk: 10 * 4 / 3, kitty: 20 });
-assert.deepStrictEqual(m, { base: 16, override: { qt: 18.67, gtk: 13.33, kitty: 20 } });
+assert.deepStrictEqual(m, { base: 16, override: { qt: 18.67, gtk: 13.33, kitty: 20 }, family: {} });
assert.strictEqual(F.size(m, "quickshell"), 16);
assert.strictEqual(F.size(F.withOverride(m, "qt", null), "qt"), 16);
assert.strictEqual(F.parseModel("nope"), null);
assert.deepStrictEqual(F.parseModel(JSON.stringify(m)), m);
+// A family survives a size edit; an empty one is dropped.
+const fm = F.withOverride(F.withFamily(m, "deckit-date", " Sedgwick Ave "), "qt", 20);
+assert.deepStrictEqual(fm.family, { "deckit-date": "Sedgwick Ave" });
+assert.deepStrictEqual(F.withFamily(fm, "deckit-date", "").family, {});
+assert.deepStrictEqual(F.parseModel('{"base": 16}').family, {});
const rasi = ['* { font: var(kf-common-font, "Noto Sans 11"); }',
'entry { font: var(kf-launcher-entry, "Noto Sans Bold 15"); }',
@@ -64,4 +69,8 @@ const sr = F.seed({ rofi: 11 * 4 / 3 });
assert.ok(F.rofiFile(sr, [{ name: "kf-a", family: "M", pt: 11 }, { name: "kf-b", family: "M", pt: 72 }]).includes('kf-b: "M 72"'));
assert.strictEqual(F.kittyFile(m).split("\n")[1], "font_size 15");
+// The clock follows deck-it's text at its designed ratio.
+const d = { base: 16, override: { deckit: 20 }, family: {} };
+assert.strictEqual(F.size(d, "deckit") * F.DECKIT_CLOCK[0].ratio, 160);
+
console.log("ok");
diff --git a/desktop/modules/island/IslandCalendarModule.qml b/desktop/modules/island/IslandCalendarModule.qml
new file mode 100644
index 0000000..a029276
--- /dev/null
+++ b/desktop/modules/island/IslandCalendarModule.qml
@@ -0,0 +1,76 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import QtQuick
+import "../.."
+import "../appearance"
+
+// The island bar's settings group, starting with the calendar's.
+Module {
+ id: mod
+ name: "island-calendar"
+ label: "Calendar"
+ // nf-md-calendar, present in Inconsolata Nerd Font.
+ icon: "\u{f00ed}"
+ settings: true
+ group: "Island bar"
+ keywords: ["island", "calendar", "event", "length", "duration", "end time"]
+ searchItems: [{ text: "Default event length", key: "eventMinutes" }]
+
+ // The draft, as typed; dirty while it differs from what is saved.
+ property string draft: String(Prefs.island.eventMinutes)
+ readonly property bool valid: /^\d+$/.test(draft) && +draft >= 5 && +draft <= 1440
+ dirty: draft !== String(Prefs.island.eventMinutes)
+ function refresh() { if (!mod.dirty) mod.draft = String(Prefs.island.eventMinutes); }
+
+ page: Component {
+ Page {
+ title: "Calendar"
+ actions: Component {
+ SaveBar {
+ dirty: mod.dirty; valid: mod.valid
+ error: mod.valid ? "" : "Length is 5 to 1440 minutes."
+ onSave: Prefs.setIsland({ eventMinutes: +mod.draft })
+ onDiscard: mod.draft = String(Prefs.island.eventMinutes)
+ }
+ }
+ Column {
+ objectName: "eventMinutes"
+ width: parent.width
+ spacing: 8
+ Text {
+ width: parent.width
+ wrapMode: Text.WordWrap
+ text: "A new event gets this length, and its end keeps it when the start moves."
+ color: Theme.overlay
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+ Row {
+ spacing: 8
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: "Default event length"
+ color: Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 }
+ }
+ // Read on every change: a click on Save ends no editing.
+ Field { width: 60; value: mod.draft; onValueChanged: mod.draft = value }
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: "minutes"
+ color: Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/desktop/modules/island/IslandClockModule.qml b/desktop/modules/island/IslandClockModule.qml
new file mode 100644
index 0000000..ef8c204
--- /dev/null
+++ b/desktop/modules/island/IslandClockModule.qml
@@ -0,0 +1,247 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import Quickshell
+import QtQuick
+import "../.."
+import "../appearance"
+import "../../island/calendar/Cal.js" as Cal
+
+// How the island shows time and dates: the clock pill, the calendar's day
+// headings, agenda times and hour picker.
+Module {
+ id: mod
+ name: "island-clock"
+ label: "Date and time"
+ // nf-md-clock_outline, present in Inconsolata Nerd Font.
+ icon: "\u{f0150}"
+ settings: true
+ group: "Island bar"
+ keywords: ["island", "clock", "time", "date", "format", "12-hour", "24-hour", "am", "pm", "day", "month"]
+ searchItems: [{ text: "Clock", key: "h12" }, { text: "Date format", key: "dateFormat" }]
+
+ property bool h12: Prefs.island.h12
+ property string dateFormat: Prefs.island.dateFormat
+ dirty: h12 !== Prefs.island.h12 || dateFormat !== Prefs.island.dateFormat
+ function refresh() { if (!mod.dirty) mod.discard(); }
+ function discard() { mod.h12 = Prefs.island.h12; mod.dateFormat = Prefs.island.dateFormat; }
+
+ page: Component {
+ Page {
+ title: "Date and time"
+ actions: Component {
+ SaveBar {
+ dirty: mod.dirty
+ onSave: Prefs.setIsland({ h12: mod.h12, dateFormat: mod.dateFormat })
+ onDiscard: mod.discard()
+ }
+ }
+ Flow {
+ id: body
+ width: parent.width
+ spacing: 32
+ SystemClock { id: now; precision: SystemClock.Minutes }
+ readonly property string today: Cal.today(now.date)
+ // Two made-up events today, one each side of noon.
+ readonly property var events: [
+ { title: "Standup", allDay: false, start: today + "T09:30", end: today + "T10:00", color: "blue" },
+ { title: "Dinner", allDay: false, start: today + "T20:30", end: today + "T22:00", color: "green" }]
+
+ Column {
+ id: controls
+ width: 3 * 120 + 2 * 12
+ spacing: 6
+
+ Heading { text: "Clock" }
+ Hint { text: "The clock pill, the agenda and the hour picker. Event times can also be typed with am and pm (9.30pm)." }
+ Row {
+ objectName: "h12"
+ spacing: 6
+ Tab { text: "24-hour"; selected: !mod.h12; onClicked: mod.h12 = false }
+ Tab { text: "12-hour"; selected: mod.h12; onClicked: mod.h12 = true }
+ }
+
+ Item { width: 1; height: 14 }
+ Heading { text: "Date" }
+ Hint { text: "The clock pill. The calendar spells the month out, in the same order." }
+ Row {
+ objectName: "dateFormat"
+ spacing: 12
+ Repeater {
+ model: Cal.DATE_GROUPS
+ delegate: Column {
+ required property var modelData
+ width: 120
+ spacing: 2
+ Text {
+ text: modelData.title
+ color: Theme.subtext
+ bottomPadding: 4
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+ Repeater {
+ model: modelData.formats
+ delegate: Rectangle {
+ required property string modelData
+ readonly property bool on: mod.dateFormat === modelData
+ width: 120
+ height: 26
+ radius: 6
+ color: on ? Qt.alpha(Theme.accent, 0.25)
+ : pick.containsMouse ? Qt.alpha(Theme.surface, 0.8) : "transparent"
+ border.width: on ? 1 : 0
+ border.color: Qt.alpha(Theme.accent, 0.5)
+ Text {
+ anchors { left: parent.left; leftMargin: 8; verticalCenter: parent.verticalCenter }
+ text: Qt.formatDate(now.date, parent.modelData)
+ color: parent.on ? Theme.text : Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 }
+ }
+ MouseArea {
+ id: pick
+ anchors.fill: parent
+ hoverEnabled: true
+ cursorShape: Qt.PointingHandCursor
+ onClicked: mod.dateFormat = parent.modelData
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Beside the controls when there is room, below them when not.
+ Column {
+ width: Math.max(220, Math.min(400, body.width - controls.width - body.spacing))
+ spacing: 6
+ Heading { text: "Preview" }
+ Hint { text: "With the unsaved choice." }
+ // A mock of the island: the clock pill at rest, and the
+ // calendar panel's heading, agenda and hour picker below it.
+ Rectangle {
+ width: parent.width
+ height: mock.implicitHeight + 32
+ radius: 12
+ color: Qt.alpha(Theme.surface, 0.35)
+
+ Column {
+ id: mock
+ anchors { fill: parent; margins: 16 }
+ spacing: 14
+
+ Rectangle {
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: pillRow.implicitWidth + 28
+ height: 34
+ radius: 17
+ color: Qt.alpha(Theme.base, 0.92)
+ border.width: 1
+ border.color: Qt.alpha(Theme.text, 0.12)
+ Row {
+ id: pillRow
+ anchors.centerIn: parent
+ spacing: 10
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: Qt.formatDateTime(now.date, Cal.shortDateFmt(mod.dateFormat))
+ color: Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
+ }
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: Qt.formatDateTime(now.date, Cal.timeFmt(mod.h12))
+ color: Theme.text
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize; weight: Font.DemiBold }
+ }
+ }
+ }
+
+ Rectangle {
+ width: parent.width
+ height: panelCol.implicitHeight + 24
+ radius: 17
+ color: Qt.alpha(Theme.base, 0.92)
+ border.width: 1
+ border.color: Qt.alpha(Theme.text, 0.12)
+ Column {
+ id: panelCol
+ anchors { fill: parent; margins: 12 }
+ spacing: 6
+ Text {
+ text: Qt.formatDate(now.date, Cal.dayFmt(mod.dateFormat, true))
+ color: Theme.text
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
+ }
+ Repeater {
+ model: body.events
+ delegate: Row {
+ required property var modelData
+ spacing: 8
+ Rectangle { width: 3; height: 16; radius: 1; color: Theme[modelData.color] }
+ Text {
+ width: mod.h12 ? 92 : 82
+ text: Cal.timeLabel(modelData, body.today, mod.h12)
+ color: Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 5 }
+ }
+ Text {
+ text: modelData.title
+ color: Theme.text
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+ }
+ }
+ Text {
+ text: "When " + Qt.formatDate(now.date, Cal.dayFmt(mod.dateFormat, false))
+ color: Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+ Row {
+ spacing: 2
+ Repeater {
+ model: [8, 9, 10, 11, 12]
+ delegate: Rectangle {
+ required property int modelData
+ width: 34
+ height: 26
+ radius: 6
+ color: modelData === 9 ? Qt.alpha(Theme.accent, 0.35) : "transparent"
+ Text {
+ anchors.centerIn: parent
+ text: Cal.hourLabel(parent.modelData, mod.h12)
+ color: Theme.text
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ component Heading: Text {
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3; bold: true }
+ color: Theme.text
+ }
+
+ component Hint: Text {
+ width: parent ? parent.width : 0
+ wrapMode: Text.WordWrap
+ color: Theme.overlay
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+}
diff --git a/desktop/modules/island/IslandPillsModule.qml b/desktop/modules/island/IslandPillsModule.qml
new file mode 100644
index 0000000..4a3e09d
--- /dev/null
+++ b/desktop/modules/island/IslandPillsModule.qml
@@ -0,0 +1,140 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import QtQuick
+import "../.."
+
+// The order of the island's pills, dragged into place.
+Module {
+ id: mod
+ name: "island-pills"
+ label: "Pills"
+ // nf-md-view_column, present in Inconsolata Nerd Font.
+ icon: "\u{f056d}"
+ settings: true
+ group: "Island bar"
+ keywords: ["island", "pills", "order", "layout", "clock", "player", "status", "obs"]
+ searchItems: [{ text: "Pill order", key: "pills" }]
+
+ readonly property var names: ({ media: "Player", clock: "Clock", status: "Status", obs: "OBS" })
+ property var draft: Prefs.island.pills
+ dirty: JSON.stringify(draft) !== JSON.stringify(Prefs.island.pills)
+ function refresh() { if (!mod.dirty) mod.draft = Prefs.island.pills; }
+ function moveTo(from, to) {
+ const d = mod.draft.slice();
+ d.splice(to, 0, d.splice(from, 1)[0]);
+ mod.draft = d;
+ }
+
+ page: Component {
+ Page {
+ title: "Pills"
+ actions: Component {
+ SaveBar {
+ dirty: mod.dirty
+ onSave: Prefs.setIsland({ pills: mod.draft })
+ onDiscard: mod.draft = Prefs.island.pills
+ }
+ }
+ Column {
+ objectName: "pills"
+ width: parent.width
+ spacing: 8
+ Text {
+ width: parent.width
+ wrapMode: Text.WordWrap
+ text: "Drag to reorder, left to right; the bar marks the screen's centre. Player shows only while something plays, OBS only while it runs."
+ color: Theme.overlay
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+ // Fixed slots, the centre bar between the second and third.
+ // A dropped pill takes the slot nearest where it lands.
+ Item {
+ id: strip
+ readonly property real slot: 96
+ readonly property real mid: 24
+ function slotX(i) { return i * slot + (i >= 2 ? mid : 0); }
+ // While a pill is dragged: where it came from and the slot
+ // it would land in; the others step aside for it.
+ property int from: -1
+ property int to: -1
+ function nearest(x) {
+ let to = 0;
+ for (let j = 1; j < 4; j++)
+ if (Math.abs(slotX(j) - x) < Math.abs(slotX(to) - x)) to = j;
+ return to;
+ }
+ function shown(i) {
+ if (from < 0 || i === from) return i;
+ if (from < to && i > from && i <= to) return i - 1;
+ if (to < from && i >= to && i < from) return i + 1;
+ return i;
+ }
+ width: slotX(4)
+ height: 32
+
+ Text {
+ x: strip.slotX(2) - strip.mid
+ width: strip.mid
+ anchors.verticalCenter: parent.verticalCenter
+ horizontalAlignment: Text.AlignHCenter
+ text: "|"
+ color: Theme.accent
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize }
+ }
+
+ Repeater {
+ model: mod.draft
+ delegate: Rectangle {
+ id: pill
+ required property string modelData
+ required property int index
+ x: strip.slotX(strip.shown(index))
+ Behavior on x {
+ enabled: !grab.drag.active
+ NumberAnimation { duration: 150; easing.type: Easing.OutCubic }
+ }
+ z: grab.drag.active ? 1 : 0
+ width: strip.slot - 6
+ height: strip.height
+ radius: 7
+ color: grab.drag.active ? Qt.alpha(Theme.accent, 0.4) : Qt.alpha(Theme.accent, 0.25)
+ border.width: 1
+ border.color: Qt.alpha(Theme.accent, 0.5)
+ Text {
+ anchors.centerIn: parent
+ text: mod.names[pill.modelData]
+ color: Theme.text
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
+ }
+ MouseArea {
+ id: grab
+ anchors.fill: parent
+ preventStealing: true
+ cursorShape: grab.drag.active ? Qt.ClosedHandCursor : Qt.OpenHandCursor
+ drag { target: pill; axis: Drag.XAxis; minimumX: 0; maximumX: strip.slotX(3) }
+ onPressed: { strip.from = pill.index; strip.to = pill.index; }
+ onPositionChanged: if (grab.drag.active) strip.to = strip.nearest(pill.x)
+ onReleased: {
+ const from = strip.from, to = strip.nearest(pill.x);
+ strip.from = -1;
+ // A move rebuilds the delegates; staying put needs the binding back.
+ if (to !== from) mod.moveTo(from, to);
+ else pill.x = Qt.binding(() => strip.slotX(strip.shown(pill.index)));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/desktop/modules/mail/MailPage.qml b/desktop/modules/mail/MailPage.qml
index 1b41412..03ce71a 100644
--- a/desktop/modules/mail/MailPage.qml
+++ b/desktop/modules/mail/MailPage.qml
@@ -67,13 +67,13 @@ Column {
onLoadFailed: page.readHeartbeat("")
}
- Item {
- width: parent.width
- implicitHeight: totalText.implicitHeight
+ SectionHeader {
+ divider: false
+ glyph: "\uf0e0"
+ label: "Accounts"
Text {
- id: totalText
- anchors.right: parent.right
+ anchors { right: parent.right; bottom: parent.bottom }
// A dash rather than a possibly-wrong number while any account is
// still unknown.
text: Accounts.anyUnknown ? "—" : `${Accounts.total} unread`
@@ -195,7 +195,7 @@ Column {
}
}
- Rectangle { width: parent.width; height: 1; color: Qt.alpha(Theme.text, 0.12) }
+ SectionHeader { glyph: "\uf21e"; label: "Watcher" }
// Watcher health. Green when idling, yellow when a folder gave up, red
// when there is no fresh heartbeat at all.
@@ -219,7 +219,7 @@ Column {
}
}
- Rectangle { width: parent.width; height: 1; color: Qt.alpha(Theme.text, 0.12) }
+ Rectangle { width: parent.width; height: 1; color: Qt.alpha(Theme.text, 0.3) }
Row {
anchors.right: parent.right
diff --git a/desktop/modules/mimeapps/MimeApps.js b/desktop/modules/mimeapps/MimeApps.js
new file mode 100644
index 0000000..dfadf28
--- /dev/null
+++ b/desktop/modules/mimeapps/MimeApps.js
@@ -0,0 +1,148 @@
+.pragma library
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Pure helpers for the default apps page, tested by test_mimeapps.js under
+// node. Every edit works on the text of mimeapps.list and touches only the
+// one line it means: other sections ([Added Associations] included),
+// comments and blank lines survive byte for byte. The file is walked line by
+// line, never cut "up to the next [" (AGENTS.md, the INI note).
+
+const SECTION = "[Default Applications]";
+
+// The role rows, each setting its whole group of types at once.
+const ROLES = [
+ { label: "Browser", mimes: ["text/html", "application/xhtml+xml", "x-scheme-handler/http", "x-scheme-handler/https"] },
+ { label: "Mail", mimes: ["x-scheme-handler/mailto"] },
+ { label: "Text", mimes: ["text/plain"] },
+ { label: "PDF", mimes: ["application/pdf"] },
+ { label: "Image", mimes: ["image/png", "image/jpeg", "image/gif", "image/webp", "image/svg+xml"] },
+ { label: "Video", mimes: ["video/mp4", "video/x-matroska", "video/webm"] },
+ { label: "Audio", mimes: ["audio/mpeg", "audio/flac", "audio/ogg", "audio/x-wav"] },
+ { label: "Files", mimes: ["inode/directory"] },
+ { label: "Archive", mimes: ["application/zip", "application/x-tar", "application/x-7z-compressed", "application/gzip"] },
+];
+
+// The trailing newline is dropped on split and always put back on join.
+function lines(text) { return text === "" ? [] : text.replace(/\n$/, "").split("\n"); }
+function join(ls) { return ls.join("\n") + "\n"; }
+
+// The key of a "key=value" line, null for a comment, header or blank.
+function keyOf(line) {
+ const m = /^\s*([^#=\s[][^=]*?)\s*=/.exec(line);
+ return m ? m[1] : null;
+}
+
+// [header index, end index (exclusive)] of the section, or null.
+function section(ls) {
+ const start = ls.findIndex(l => l.trim() === SECTION);
+ if (start < 0) return null;
+ let end = start + 1;
+ while (end < ls.length && !/^\s*\[/.test(ls[end])) end++;
+ return [start, end];
+}
+
+// { mime: desktopId } from [Default Applications]. A value is a ;-list and
+// its first item is the default.
+function parse(text) {
+ const ls = lines(text), s = section(ls), out = {};
+ if (!s) return out;
+ for (let i = s[0] + 1; i < s[1]; i++) {
+ const k = keyOf(ls[i]);
+ if (k === null) continue;
+ const id = ls[i].slice(ls[i].indexOf("=") + 1).split(";").map(x => x.trim()).find(x => x);
+ if (id) out[k] = id;
+ }
+ return out;
+}
+
+function set(text, mime, id) {
+ const ls = lines(text);
+ let s = section(ls);
+ if (!s) {
+ if (ls.length > 0 && ls[ls.length - 1].trim() !== "") ls.push("");
+ ls.push(SECTION);
+ s = [ls.length - 1, ls.length];
+ }
+ const line = mime + "=" + id + ";";
+ // The first match is rewritten and later duplicates dropped, since parse()
+ // lets the last one win and a leftover would undo the edit.
+ let first = -1;
+ for (let i = s[0] + 1; i < s[1]; i++) {
+ if (keyOf(ls[i]) !== mime) continue;
+ if (first < 0) { ls[i] = line; first = i; }
+ else { ls.splice(i, 1); i--; s[1]--; }
+ }
+ if (first >= 0) return join(ls);
+ // After the last non-blank line, so a blank line before the next header stays.
+ let at = s[1];
+ while (at > s[0] + 1 && ls[at - 1].trim() === "") at--;
+ ls.splice(at, 0, line);
+ return join(ls);
+}
+
+// The header stays even when its last entry goes, so the text written is
+// never empty (FileView.setText("") writes nothing, AGENTS.md).
+function remove(text, mime) {
+ const ls = lines(text), s = section(ls);
+ if (!s) return text;
+ let hit = false;
+ for (let i = s[0] + 1; i < s[1]; i++)
+ if (keyOf(ls[i]) === mime) { ls.splice(i, 1); i--; s[1]--; hit = true; }
+ return hit ? join(ls) : text;
+}
+
+// The applications directories in XDG order, the user's first.
+function dirs(home, dataHome, dataDirs) {
+ return [dataHome || home + "/.local/share"]
+ .concat((dataDirs || "/usr/local/share:/usr/share").split(":"))
+ .filter(d => d)
+ .map(d => d.replace(/\/+$/, "") + "/applications");
+}
+
+// grep -rH '^MimeType=' output -> { desktopId: [mimes] }. The id is the path
+// under applications/ with "/" as "-" (desktop entry spec); the first
+// directory to list an id wins, which is the user's when it has one.
+function scan(out, appDirs) {
+ const apps = {};
+ for (const line of out.split("\n")) {
+ const i = line.indexOf(":MimeType=");
+ if (i < 0) continue;
+ const path = line.slice(0, i);
+ const dir = appDirs.find(d => path.startsWith(d + "/"));
+ if (!dir) continue;
+ const id = path.slice(dir.length + 1).replace(/\//g, "-");
+ if (id in apps) continue;
+ apps[id] = line.slice(i + ":MimeType=".length).split(";").map(m => m.trim()).filter(m => m);
+ }
+ return apps;
+}
+
+// The app most of a role's types point at ("" when none is set), and how
+// many distinct apps they point at.
+function role(defaults, mimes) {
+ const n = {};
+ for (const m of mimes) if (defaults[m]) n[defaults[m]] = (n[defaults[m]] || 0) + 1;
+ const ids = Object.keys(n).sort((a, b) => n[b] - n[a]);
+ return { id: ids[0] || "", apps: ids.length };
+}
+
+// The ids declaring at least one of the types.
+function handlers(apps, mimes) {
+ return Object.keys(apps).filter(id => apps[id].some(m => mimes.includes(m)));
+}
+
+// Every type any installed app declares, sorted.
+function allMimes(apps) {
+ const seen = {};
+ for (const id in apps) for (const m of apps[id]) seen[m] = true;
+ return Object.keys(seen).sort();
+}
diff --git a/desktop/modules/mimeapps/MimeAppsModule.qml b/desktop/modules/mimeapps/MimeAppsModule.qml
new file mode 100644
index 0000000..bd6ab83
--- /dev/null
+++ b/desktop/modules/mimeapps/MimeAppsModule.qml
@@ -0,0 +1,106 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import Quickshell
+import Quickshell.Io
+import QtQuick
+import "../.."
+import "MimeApps.js" as M
+
+// The default application per file type, from the user's mimeapps.list,
+// the file xdg-mime and xdg-open read. The page owns the file rather than
+// running xdg-mime, which can set an entry but not remove one.
+Module {
+ id: mm
+ name: "mimeapps"
+ label: "Default apps"
+ // nf-fa-external_link, present in Inconsolata Nerd Font.
+ icon: ""
+ settings: true
+ group: "Desktop"
+ keywords: ["xdg", "xdg-mime", "xdg-open", "mime", "mimeapps", "open with", "file type",
+ "association", "browser", "mail", "pdf", "image", "video", "audio"]
+
+ readonly property string home: Quickshell.env("HOME")
+ readonly property string file: (Quickshell.env("XDG_CONFIG_HOME") || mm.home + "/.config") + "/mimeapps.list"
+ readonly property var dirs: M.dirs(mm.home, Quickshell.env("XDG_DATA_HOME"), Quickshell.env("XDG_DATA_DIRS"))
+
+ // The file's text as last read or written: FileView.text() lags
+ // setText() (AGENTS.md), so edits build on this copy.
+ property string text: ""
+ // What the page edits; nothing reaches the file until Save. It follows
+ // the file while there are no unsaved edits.
+ property string draft: ""
+ dirty: mm.draft !== mm.text
+ // No save before the first read, which would replace the file with
+ // only the edit.
+ property bool loaded: false
+ property string error: ""
+ property string notice: ""
+ readonly property var defaults: M.parse(mm.draft)
+ // { desktopId: [mimes] }, from the .desktop files.
+ property var apps: ({})
+
+ searchItems: M.ROLES.map(r => ({ text: r.label, key: r.label }))
+ .concat(Object.keys(mm.defaults).sort().map(m => ({ text: m, key: m })))
+
+ function refresh() {
+ fv.reload();
+ scanner.running = false;
+ scanner.running = true;
+ }
+ function stage(t) { mm.draft = t; mm.notice = ""; mm.error = ""; }
+ function discard() { mm.draft = mm.text; mm.notice = ""; mm.error = ""; }
+ function save() {
+ if (!mm.loaded) { mm.error = "mimeapps.list not read yet."; return; }
+ mm.error = "";
+ mm.text = mm.draft;
+ fv.setText(mm.draft);
+ }
+ // The file as read: the draft follows it unless edits are pending.
+ function took(t) {
+ if (!mm.dirty) mm.draft = t;
+ mm.text = t;
+ mm.loaded = true;
+ }
+
+ property FileView fv: FileView {
+ path: mm.file
+ printErrors: false
+ watchChanges: true
+ onFileChanged: reload()
+ onLoaded: mm.took(text())
+ // A missing file is an empty one; the first write creates it.
+ onLoadFailed: err => {
+ if (err === FileViewError.FileNotFound) mm.took("");
+ else mm.error = "Cannot read " + path + ": " + FileViewError.toString(err);
+ }
+ onSaved: mm.notice = "saved"
+ onSaveFailed: err => mm.error = "Cannot write " + path + ": " + FileViewError.toString(err)
+ }
+
+ property Process scanner: Process {
+ command: ["sh", "-c", 'for d; do [ -d "$d" ] && grep -RH --include="*.desktop" "^MimeType=" "$d"; done; true', "sh"]
+ .concat(mm.dirs)
+ stdout: StdioCollector { onStreamFinished: mm.apps = M.scan(text, mm.dirs) }
+ }
+
+ page: Component {
+ Page {
+ title: "Default apps"
+ actions: Component {
+ SaveBar { dirty: mm.dirty; notice: mm.notice; error: mm.error
+ onSave: mm.save(); onDiscard: mm.discard() }
+ }
+ MimeAppsPage { width: parent.width; ma: mm }
+ }
+ }
+}
diff --git a/desktop/modules/mimeapps/MimeAppsPage.qml b/desktop/modules/mimeapps/MimeAppsPage.qml
new file mode 100644
index 0000000..8ebe880
--- /dev/null
+++ b/desktop/modules/mimeapps/MimeAppsPage.qml
@@ -0,0 +1,313 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import Quickshell
+import QtQuick
+import "../.."
+import "MimeApps.js" as M
+
+// Roles first (one row sets a group of types), then every explicit entry in
+// [Default Applications], then a search to add any type an installed app
+// declares. Each row opens an app picker below itself; one picker at a time.
+Column {
+ id: page
+
+ spacing: 6
+
+ // The module, under a name of its own: a property named after the
+ // module's id binds to itself (AGENTS.md).
+ required property var ma
+ // The row whose picker is open, by key; "" when none.
+ property string editing: ""
+ property string query: ""
+ property bool all: false
+ property string addQuery: ""
+
+ readonly property var defaults: page.ma.defaults
+ readonly property var explicit: Object.keys(page.defaults).sort()
+ readonly property bool entriesReady: DesktopEntries.applications.values.length > 0
+ // Types matching the add search that are not set yet.
+ readonly property var addHits: {
+ const q = page.addQuery.trim().toLowerCase();
+ if (q === "") return [];
+ return M.allMimes(page.ma.apps).filter(m => m.includes(q) && !(m in page.defaults)).slice(0, 8);
+ }
+
+ // mimeapps.list ids carry ".desktop", DesktopEntry ids do not.
+ function entry(id) { return id ? DesktopEntries.byId(id.replace(/\.desktop$/, "")) : null; }
+ function name(id) { const e = page.entry(id); return e ? e.name : id; }
+
+ // The picker's apps: those declaring one of the types, or every
+ // visible app with "show all apps" on; filtered by the search.
+ // ponytail: first 10 matches; a narrower search finds the rest.
+ function candidates(mimes) {
+ const q = page.query.trim().toLowerCase();
+ const ids = page.all
+ ? DesktopEntries.applications.values.filter(a => !a.noDisplay).map(a => a.id + ".desktop")
+ : M.handlers(page.ma.apps, mimes);
+ return ids.map(id => {
+ const e = page.entry(id);
+ return { id: id, name: e ? e.name : id, icon: e ? e.icon : "" };
+ })
+ .filter(a => q === "" || a.name.toLowerCase().includes(q) || a.id.toLowerCase().includes(q))
+ .sort((a, b) => a.name.localeCompare(b.name))
+ .slice(0, 10);
+ }
+ function pick(mimes, id) {
+ page.ma.stage(mimes.reduce((t, m) => M.set(t, m, id), page.ma.draft));
+ page.editing = "";
+ page.query = "";
+ page.all = false;
+ page.addQuery = "";
+ }
+ function toggle(key) {
+ page.editing = page.editing === key ? "" : key;
+ page.query = "";
+ page.all = false;
+ }
+
+ component Small: Text {
+ color: Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+
+ component Heading: Text {
+ topPadding: 14
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize; bold: true }
+ color: Theme.text
+ }
+
+ component Field: Rectangle {
+ id: field
+ property string text: ""
+ property string placeholder: ""
+ signal edited(string text)
+ height: 34
+ radius: 8
+ color: Theme.surface
+ TextInput {
+ activeFocusOnTab: true
+ anchors { fill: parent; leftMargin: 10; rightMargin: 10 }
+ verticalAlignment: TextInput.AlignVCenter
+ clip: true
+ selectByMouse: true
+ color: Theme.text
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
+ text: field.text
+ onTextEdited: field.edited(text)
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ visible: parent.text === ""
+ text: field.placeholder
+ color: Theme.subtext
+ font: parent.font
+ }
+ }
+ }
+
+ // One row: the app's icon, a title, what it maps to, Change (and
+ // Remove for an explicit entry), and its picker when open. Items with
+ // anchors, not Rows: a Row sizes to its children (AGENTS.md).
+ component Assoc: Column {
+ id: assoc
+ // The picker key and what a search hit scrolls to.
+ property string key: ""
+ property string title: ""
+ property var mimes: []
+ property string appId: ""
+ property string status: ""
+ property bool stale: false
+ property bool removable: false
+ readonly property bool open: page.editing === assoc.key
+ objectName: assoc.key
+ width: page.width
+ spacing: 4
+
+ Item {
+ width: parent.width
+ height: 44
+
+ Image {
+ id: appIcon
+ anchors { left: parent.left; verticalCenter: parent.verticalCenter }
+ width: 24; height: 24
+ sourceSize: Qt.size(24, 24)
+ source: { const e = page.entry(assoc.appId); return e ? Quickshell.iconPath(e.icon, true) : ""; }
+ }
+ Text {
+ id: titleText
+ anchors { left: appIcon.right; leftMargin: 10; right: change.left; rightMargin: 8; top: parent.top; topMargin: 4 }
+ elide: Text.ElideRight
+ text: assoc.title
+ color: Theme.text
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 }
+ }
+ Small {
+ anchors { left: titleText.left; right: titleText.right; top: titleText.bottom; topMargin: 2 }
+ elide: Text.ElideRight
+ color: assoc.stale ? Theme.red : Theme.subtext
+ text: assoc.status
+ }
+ Button {
+ id: change
+ anchors { right: del.visible ? del.left : parent.right; rightMargin: del.visible ? 6 : 0; verticalCenter: parent.verticalCenter }
+ text: assoc.open ? "Close" : "Change"
+ onClicked: page.toggle(assoc.key)
+ }
+ Button {
+ id: del
+ visible: assoc.removable
+ anchors { right: parent.right; verticalCenter: parent.verticalCenter }
+ text: "Remove"
+ danger: true
+ onClicked: page.ma.stage(M.remove(page.ma.draft, assoc.mimes[0]))
+ }
+ }
+
+ Column {
+ visible: assoc.open
+ width: parent.width
+ spacing: 4
+
+ Field {
+ width: parent.width
+ placeholder: "search apps"
+ text: page.query
+ onEdited: t => page.query = t
+ }
+ Item {
+ width: parent.width
+ height: 32
+ Switch {
+ id: allSwitch
+ anchors { left: parent.left; verticalCenter: parent.verticalCenter }
+ checked: page.all
+ onToggled: on => page.all = on
+ }
+ Small {
+ anchors { left: allSwitch.right; leftMargin: 10; verticalCenter: parent.verticalCenter }
+ text: "Show all apps, not only those declaring the type"
+ }
+ }
+ Repeater {
+ id: picks
+ model: assoc.open ? page.candidates(assoc.mimes) : []
+
+ delegate: Rectangle {
+ id: app
+ required property var modelData
+ width: page.width
+ height: 32
+ radius: 8
+ color: app.modelData.id === assoc.appId ? Qt.alpha(Theme.accent, 0.22)
+ : appArea.containsMouse ? Qt.alpha(Theme.text, 0.06) : "transparent"
+
+ Image {
+ id: pickIcon
+ anchors { left: parent.left; leftMargin: 8; verticalCenter: parent.verticalCenter }
+ width: 20; height: 20
+ sourceSize: Qt.size(20, 20)
+ source: app.modelData.icon ? Quickshell.iconPath(app.modelData.icon, true) : ""
+ }
+ Text {
+ anchors { left: pickIcon.right; leftMargin: 10; right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter }
+ elide: Text.ElideRight
+ text: app.modelData.name + " " + app.modelData.id
+ color: Theme.text
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 }
+ }
+ MouseArea {
+ id: appArea
+ anchors.fill: parent
+ hoverEnabled: true
+ cursorShape: Qt.PointingHandCursor
+ onClicked: page.pick(assoc.mimes, app.modelData.id)
+ }
+ }
+ }
+ Small {
+ visible: picks.count === 0
+ width: parent.width
+ wrapMode: Text.Wrap
+ text: page.all ? "No app matches." : "No installed app declares this type. Turn on Show all apps."
+ }
+ }
+ }
+
+ Small {
+ width: parent.width
+ wrapMode: Text.Wrap
+ text: "What xdg-open uses, from " + page.ma.file + ". Nothing is written until Save."
+ }
+
+ Text {
+ visible: page.ma.error !== ""
+ width: parent.width
+ wrapMode: Text.Wrap
+ text: page.ma.error
+ color: Theme.red
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+
+ Heading { text: "Roles" }
+
+ Repeater {
+ model: M.ROLES
+ delegate: Assoc {
+ required property var modelData
+ readonly property var st: M.role(page.defaults, modelData.mimes)
+ key: modelData.label
+ title: modelData.label
+ mimes: modelData.mimes
+ appId: st.id
+ status: st.apps === 0 ? "not set"
+ : page.name(st.id) + (st.apps > 1 ? " · mixed (" + st.apps + " apps)" : "")
+ }
+ }
+
+ Heading { text: "Explicit" }
+
+ Repeater {
+ model: page.explicit
+ delegate: Assoc {
+ required property string modelData
+ key: modelData
+ title: modelData
+ mimes: [modelData]
+ appId: page.defaults[modelData]
+ // Only once DesktopEntries has filled, or every row flashes red.
+ stale: page.entriesReady && page.entry(appId) === null
+ status: stale ? "not installed: " + appId : page.name(appId)
+ removable: true
+ }
+ }
+
+ Heading { text: "Add" }
+
+ Field {
+ width: parent.width
+ placeholder: "search file types, e.g. image/avif"
+ text: page.addQuery
+ onEdited: t => page.addQuery = t
+ }
+
+ // A type is written only once an app is picked; then it moves to Explicit.
+ Repeater {
+ model: page.addHits
+ delegate: Assoc {
+ required property string modelData
+ key: "+" + modelData
+ title: modelData
+ mimes: [modelData]
+ status: "not set"
+ }
+ }
+}
diff --git a/desktop/modules/mimeapps/README.md b/desktop/modules/mimeapps/README.md
new file mode 100644
index 0000000..4d960d7
--- /dev/null
+++ b/desktop/modules/mimeapps/README.md
@@ -0,0 +1,30 @@
+# mimeapps
+
+The settings window's **Default apps** page: the default application per
+file type, from `$XDG_CONFIG_HOME/mimeapps.list` (the file `xdg-mime` and
+`xdg-open` read).
+
+- **Roles**: Browser, Mail, Text, PDF, Image, Video, Audio, Files, Archive.
+ Each sets its whole group of types (`ROLES` in `MimeApps.js`) at once and
+ shows the app most of them point at, or how many apps when they disagree.
+- **Explicit**: every `[Default Applications]` entry, with Change and
+ Remove. An entry whose app is not installed shows its id in red.
+- **Add**: search any type an installed app declares; it is written once an
+ app is picked.
+
+The picker lists the apps whose `.desktop` declares the type (one `grep` over
+the XDG applications directories, since Quickshell's `DesktopEntry` has no
+`mimeTypes`), or every app with "Show all apps".
+
+Edits are staged in a draft; Save in the header writes them, Discard drops
+them, as on the other settings pages.
+
+Only `[Default Applications]` is edited; `[Added Associations]`, comments and
+other sections are left as they are. Not handled: system-wide and
+desktop-specific `mimeapps.list` files.
+
+The file is written directly rather than through `xdg-mime default`, which
+cannot remove an entry. `DesktopEntry.id` has no `.desktop` suffix while
+mimeapps.list ids do, so lookups strip it.
+
+Test: `node desktop/modules/mimeapps/test_mimeapps.js`.
diff --git a/desktop/modules/mimeapps/test_mimeapps.js b/desktop/modules/mimeapps/test_mimeapps.js
new file mode 100644
index 0000000..7f629db
--- /dev/null
+++ b/desktop/modules/mimeapps/test_mimeapps.js
@@ -0,0 +1,77 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Run: node desktop/modules/mimeapps/test_mimeapps.js
+// MimeApps.js is a QML library, so its .pragma line is stripped before node
+// evaluates it.
+
+const fs = require("fs");
+const assert = require("assert");
+
+const src = fs.readFileSync(__dirname + "/MimeApps.js", "utf8").replace(/^\.pragma library$/m, "");
+const M = new Function(src + "\nreturn { ROLES, parse, set, remove, scan, dirs, role, handlers, allMimes };")();
+
+// Added Associations is not read as defaults; comments, blank lines and
+// other sections survive every edit byte for byte.
+const file = "[Added Associations]\ntext/plain=qpdfview.desktop;\n\n"
+ + "[Default Applications]\n# browser\ntext/html=firefox.desktop\ntext/plain=featherpad.desktop;okular.desktop;\n\n"
+ + "[Other]\nk=v\n";
+assert.deepStrictEqual(M.parse(file), { "text/html": "firefox.desktop", "text/plain": "featherpad.desktop" });
+assert.deepStrictEqual(M.parse(""), {});
+
+// set: in place, or after the section's last entry (before its blank line),
+// or a new section at the end, or the section alone in an empty file.
+assert.strictEqual(M.set(file, "text/html", "chromium.desktop"),
+ file.replace("text/html=firefox.desktop", "text/html=chromium.desktop;"));
+assert.strictEqual(M.set(file, "image/png", "lximage-qt.desktop"),
+ file.replace("okular.desktop;\n", "okular.desktop;\nimage/png=lximage-qt.desktop;\n"));
+assert.strictEqual(M.set("[Added Associations]\na/b=x.desktop;\n", "a/b", "y.desktop"),
+ "[Added Associations]\na/b=x.desktop;\n\n[Default Applications]\na/b=y.desktop;\n");
+assert.strictEqual(M.set("", "a/b", "y.desktop"), "[Default Applications]\na/b=y.desktop;\n");
+// A key that only starts with the type is a different key.
+assert.strictEqual(M.set("[Default Applications]\ntext/plainx=a.desktop;\n", "text/plain", "b.desktop"),
+ "[Default Applications]\ntext/plainx=a.desktop;\ntext/plain=b.desktop;\n");
+
+// remove: only that line; the header stays, so the text is never empty.
+assert.strictEqual(M.remove(file, "text/html"), file.replace("text/html=firefox.desktop\n", ""));
+assert.strictEqual(M.remove(file, "nope/x"), file);
+assert.strictEqual(M.remove("[Default Applications]\na/b=y.desktop;\n", "a/b"), "[Default Applications]\n");
+
+// Duplicate keys: parse takes the last; set edits the first and drops the rest; remove drops all.
+const dup = "[Default Applications]\ntext/html=a.desktop;\ntext/html=b.desktop;\n";
+assert.strictEqual(M.parse(dup)["text/html"], "b.desktop");
+assert.strictEqual(M.set(dup, "text/html", "c.desktop"), "[Default Applications]\ntext/html=c.desktop;\n");
+assert.strictEqual(M.remove(dup, "text/html"), "[Default Applications]\n");
+
+// dirs: the user's first, trailing slashes dropped.
+const dirs = M.dirs("/home/you", "", "/usr/local/share/:/usr/share");
+assert.deepStrictEqual(dirs, ["/home/you/.local/share/applications", "/usr/local/share/applications", "/usr/share/applications"]);
+assert.deepStrictEqual(M.dirs("/home/you", "/x", ""), ["/x/applications", "/usr/local/share/applications", "/usr/share/applications"]);
+
+// scan: the first dir wins for one id; a subdirectory joins with "-".
+const out = "/home/you/.local/share/applications/firefox.desktop:MimeType=text/html;\n"
+ + "/usr/share/applications/firefox.desktop:MimeType=text/html;image/png;\n"
+ + "/usr/share/applications/kde4/okular.desktop:MimeType=application/pdf;\n";
+assert.deepStrictEqual(M.scan(out, dirs), { "firefox.desktop": ["text/html"], "kde4-okular.desktop": ["application/pdf"] });
+assert.deepStrictEqual(M.scan("", dirs), {});
+// A CRLF .desktop file leaves a \r on the line; it is not a mime type.
+assert.deepStrictEqual(M.scan("/usr/share/applications/a.desktop:MimeType=a/b;c/d;\r\n", dirs), { "a.desktop": ["a/b", "c/d"] });
+
+// role: the app most types point at, and how many distinct apps.
+assert.deepStrictEqual(M.role({ a: "x.desktop", b: "y.desktop", c: "x.desktop" }, ["a", "b", "c", "d"]), { id: "x.desktop", apps: 2 });
+assert.deepStrictEqual(M.role({}, ["a"]), { id: "", apps: 0 });
+
+assert.deepStrictEqual(M.handlers({ "f.desktop": ["text/html"], "o.desktop": ["application/pdf"] }, ["text/html", "x/y"]), ["f.desktop"]);
+assert.deepStrictEqual(M.allMimes({ f: ["b", "a"], g: ["a"] }), ["a", "b"]);
+
+for (const r of M.ROLES) assert.ok(r.label && r.mimes.length > 0, r.label);
+
+console.log("ok");
diff --git a/desktop/modules/network/NetworkModule.qml b/desktop/modules/network/NetworkModule.qml
index 0310475..186d15b 100644
--- a/desktop/modules/network/NetworkModule.qml
+++ b/desktop/modules/network/NetworkModule.qml
@@ -104,6 +104,66 @@ Module {
property Process notifyProc: Process {}
+ // Ookla's CLI, run on demand. It lives here rather than in the page so a
+ // test survives the drawer closing and its result is still there on
+ // reopen. --format=jsonl streams one event per line: testStart, then
+ // ping, download and upload events carrying `progress` (0..1) and the
+ // running `bandwidth` (bytes/s), then one result (measured: 5 ping, 72
+ // download, 104 upload events on a gigabit line).
+ property var speedResult: null // {down, up, ping, server} or null
+ property string speedPhase: "" // ping | download | upload while running
+ property real speedProgress: 0
+ property real speedLive: 0 // Mbit/s, the current phase's running figure
+ property var speedDown: [] // Mbit/s samples, for the page's graph
+ property var speedUp: []
+ readonly property bool speedRunning: speedProc.running
+ function runSpeedtest() {
+ mod.speedResult = null;
+ mod.speedPhase = "";
+ mod.speedProgress = 0;
+ mod.speedLive = 0;
+ mod.speedDown = [];
+ mod.speedUp = [];
+ mod.error = "";
+ speedProc.running = false;
+ speedProc.running = true;
+ }
+
+ property Process speedProc: Process {
+ command: [Quickshell.env("HOME") + "/bin/speedtest", "--format=jsonl",
+ "--accept-license", "--accept-gdpr"]
+ stdout: SplitParser {
+ onRead: line => {
+ let r;
+ try { r = JSON.parse(line); } catch (e) { return; }
+ const ev = r[r.type];
+ if (r.type === "ping") {
+ mod.speedPhase = "ping";
+ mod.speedProgress = ev.progress;
+ mod.speedLive = 0;
+ } else if (r.type === "download" || r.type === "upload") {
+ const mbit = ev.bandwidth * 8 / 1e6;
+ mod.speedPhase = r.type;
+ mod.speedProgress = ev.progress;
+ mod.speedLive = mbit;
+ if (r.type === "download") mod.speedDown = mod.speedDown.concat([mbit]);
+ else mod.speedUp = mod.speedUp.concat([mbit]);
+ } else if (r.type === "result") {
+ mod.speedResult = {
+ down: r.download.bandwidth * 8 / 1e6,
+ up: r.upload.bandwidth * 8 / 1e6,
+ ping: r.ping.latency,
+ server: r.server.name + ", " + r.server.location
+ };
+ }
+ }
+ }
+ onExited: code => {
+ mod.speedPhase = "";
+ if (!mod.speedResult) mod.error = "Speedtest failed (exit " + code + ")";
+ }
+ }
+
property Process ipProc: Process {
command: ["ip", "-j", "-4", "addr", "show"]
stdout: StdioCollector {
diff --git a/desktop/modules/network/NetworkPage.qml b/desktop/modules/network/NetworkPage.qml
index e0f32e8..563251e 100644
--- a/desktop/modules/network/NetworkPage.qml
+++ b/desktop/modules/network/NetworkPage.qml
@@ -36,23 +36,7 @@ Column {
// The rates are Perf's, sampled always, so the graph opens on the last
// minute rather than empty.
- Row {
- spacing: 6
-
- Text {
- anchors.verticalCenter: parent.verticalCenter
- text: String.fromCodePoint(0xF012A)
- font { family: Theme.iconFamily; pixelSize: Theme.fontSize - 2 }
- color: Theme.subtext
- }
-
- Text {
- anchors.verticalCenter: parent.verticalCenter
- text: "Traffic · " + Perf.iface
- font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
- color: Theme.subtext
- }
- }
+ SectionHeader { divider: false; glyph: String.fromCodePoint(0xF012A); label: "Traffic · " + Perf.iface }
Canvas {
id: graph
@@ -230,29 +214,105 @@ Column {
}
}
- Rectangle { width: page.width; height: 1; color: Qt.alpha(Theme.text, 0.12) }
+ // --- Speedtest ---
- // --- Wired ---
+ // The run and its result live in the module (see there).
+ SectionHeader { glyph: "\uf0e4"; label: "Speedtest" }
- Row {
- visible: page.net.wiredDevices.length > 0
- spacing: 6
+ Item {
+ width: page.width
+ implicitHeight: Math.max(speedBtn.implicitHeight, speedText.implicitHeight)
- Text {
+ Button {
+ id: speedBtn
anchors.verticalCenter: parent.verticalCenter
- text: "\uef44"
- font { family: Theme.iconFamily; pixelSize: Theme.fontSize - 2 }
- color: Theme.subtext
+ text: page.net.speedRunning ? "Testing…" : "Speedtest"
+ onClicked: if (!page.net.speedRunning) page.net.runSpeedtest()
}
Text {
- anchors.verticalCenter: parent.verticalCenter
- text: "Wired"
- font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2; bold: true }
- color: Theme.subtext
+ id: speedText
+ anchors { right: parent.right; verticalCenter: parent.verticalCenter }
+ text: {
+ const n = page.net, r = n.speedResult;
+ if (r) return "↓ " + r.down.toFixed(0) + " ↑ " + r.up.toFixed(0)
+ + " Mbit/s · " + r.ping.toFixed(0) + " ms";
+ if (n.speedPhase === "ping") return "Ping…";
+ if (n.speedPhase) return (n.speedPhase === "download" ? "↓ " : "↑ ")
+ + n.speedLive.toFixed(0) + " Mbit/s";
+ return "";
+ }
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
+ font.features: { "tnum": 1 }
+ color: page.net.speedPhase === "download" ? Theme.teal
+ : page.net.speedPhase === "upload" ? Theme.peach : Theme.text
+ }
+ }
+
+ // The current phase's progress, coloured like its curve below.
+ Rectangle {
+ width: page.width
+ height: 4
+ radius: 2
+ visible: page.net.speedRunning
+ color: Qt.alpha(Theme.text, 0.12)
+ Rectangle {
+ width: parent.width * page.net.speedProgress
+ height: parent.height
+ radius: 2
+ color: page.net.speedPhase === "upload" ? Theme.peach
+ : page.net.speedPhase === "download" ? Theme.teal : Theme.subtext
+ Behavior on width { NumberAnimation { duration: 150 } }
}
}
+ // Both runs on one Mbit/s scale, each stretched to the full width, so
+ // their shapes compare directly; drawn live and kept with the result.
+ Canvas {
+ id: speedGraph
+ width: page.width
+ height: 60
+ visible: page.net.speedDown.length > 0
+ onPaint: {
+ const ctx = getContext("2d");
+ ctx.reset();
+ const d = page.net.speedDown, u = page.net.speedUp;
+ const max = Math.max(1, ...d, ...u);
+ const line = (data, color) => {
+ if (data.length < 2) return;
+ ctx.strokeStyle = color;
+ ctx.lineWidth = 1.5;
+ ctx.beginPath();
+ data.forEach((v, i) => {
+ const x = width * i / (data.length - 1);
+ const y = height - 1 - (height - 2) * v / max;
+ if (i) ctx.lineTo(x, y); else ctx.moveTo(x, y);
+ });
+ ctx.stroke();
+ };
+ line(d, Theme.teal);
+ line(u, Theme.peach);
+ }
+ Connections {
+ target: page.net
+ function onSpeedDownChanged() { speedGraph.requestPaint(); }
+ function onSpeedUpChanged() { speedGraph.requestPaint(); }
+ }
+ }
+
+ Text {
+ width: page.width
+ visible: page.net.speedResult !== null
+ text: page.net.speedResult ? page.net.speedResult.server : ""
+ elide: Text.ElideRight
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 }
+ color: Theme.subtext
+ }
+
+ // --- Wired ---
+
+ SectionHeader { visible: page.net.wiredDevices.length > 0; glyph: "\uef44"; label: "Wired" }
+
Repeater {
model: page.net.wiredDevices
@@ -281,33 +341,14 @@ Column {
}
}
- Rectangle { width: page.width; height: 1; visible: page.net.wiredDevices.length > 0; color: Qt.alpha(Theme.text, 0.12) }
-
// --- Wifi ---
- Item {
- width: page.width
- implicitHeight: Math.max(wifiLabel.implicitHeight, wifiSwitch.implicitHeight)
-
- Text {
- id: wifiLabel
- anchors { left: wifiGlyph.right; leftMargin: 6; verticalCenter: parent.verticalCenter }
- text: "Wi-Fi"
- font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 1; bold: true }
- color: Theme.text
- }
-
- Text {
- id: wifiGlyph
- anchors.verticalCenter: parent.verticalCenter
- text: "\uf1eb"
- font { family: Theme.iconFamily; pixelSize: Theme.fontSize - 2 }
- color: Theme.subtext
- }
+ SectionHeader {
+ glyph: "\uf1eb"
+ label: "Wi-Fi"
Switch {
- id: wifiSwitch
- anchors { right: parent.right; verticalCenter: parent.verticalCenter }
+ anchors { right: parent.right; bottom: parent.bottom }
enabled: Networking.wifiHardwareEnabled
checked: page.net.wifiOn
onToggled: on => Networking.wifiEnabled = on
diff --git a/desktop/modules/notes/NotesPage.qml b/desktop/modules/notes/NotesPage.qml
index c4563e0..8130c7e 100644
--- a/desktop/modules/notes/NotesPage.qml
+++ b/desktop/modules/notes/NotesPage.qml
@@ -221,6 +221,7 @@ Item {
model: Notes.filter(page.owner.notes, search.text)
boundsBehavior: Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar {}
+ WheelScroll { parent: list; anchors.fill: parent; flick: list }
delegate: Rectangle {
id: row
diff --git a/desktop/modules/perf/Perf.js b/desktop/modules/perf/Perf.js
index eb0dbd7..b94e5b6 100644
--- a/desktop/modules/perf/Perf.js
+++ b/desktop/modules/perf/Perf.js
@@ -44,6 +44,24 @@ function load(prev, cur) {
return Math.max(0, Math.min(100, 100 * (1 - (cur.idle - prev.idle) / dt)));
}
+// gpu.sh's line as numbers: [vram, rcs busy, rcs clock, ccs busy, ccs clock],
+// null when it printed nothing.
+function gpuSample(text) {
+ const n = text.trim().split(/\s+/).map(Number);
+ return n.length === 5 && n.every(Number.isFinite) ? n : null;
+}
+
+// {render, compute} percent busy between two gpuSample()s, each null when
+// its clock did not move. A client exiting mid-sample takes its cycles with
+// it, so a dip below zero is clamped.
+function gpuLoad(prev, cur) {
+ const pct = (b, c) => {
+ if (!prev || !cur || cur[c] <= prev[c]) return null;
+ return Math.max(0, Math.min(100, 100 * (cur[b] - prev[b]) / (cur[c] - prev[c])));
+ };
+ return { render: pct(1, 2), compute: pct(3, 4) };
+}
+
// {total, used} in bytes; used is MemTotal - MemAvailable.
function meminfo(text) {
const kb = key => {
diff --git a/desktop/modules/perf/Perf.qml b/desktop/modules/perf/Perf.qml
index 5fcf0ab..33b5cbc 100644
--- a/desktop/modules/perf/Perf.qml
+++ b/desktop/modules/perf/Perf.qml
@@ -56,6 +56,9 @@ Singleton {
property var temps: [] // [{label, value, warn, crit}], value null if unread
property var disks: [] // Perf.js df rows
property var vram: null // bytes
+ property var gpu: null // gpuSample, the last scan
+ property var gpuRender: null // percent, rcs
+ property var gpuCompute: null // percent, ccs
property var fan: null // rpm
property var rx: [] // bytes/s, newest last
property var tx: []
@@ -181,18 +184,27 @@ Singleton {
root.temps = t;
if (fanView.path) { fanView.reload(); root.fan = root.num(fanView); }
- if (!vramProc.running) vramProc.running = true;
+ if (!gpuProc.running) gpuProc.running = true;
}
}
// ponytail: a shell glob over every fd on the system, ~14ms every 2s,
// always; gate it on the panel again if that shows up. Only the user's own processes are readable, so a
// system service's GPU use is not counted, as in conky.
- // Summed in vram.sh, so JS gets one number, never the scan itself.
+ // Summed in gpu.sh, so JS gets five numbers, never the scan itself.
Process {
- id: vramProc
- command: ["sh", `${Quickshell.shellDir}/modules/perf/vram.sh`]
- stdout: StdioCollector { onStreamFinished: root.vram = text.trim() === "" ? null : Number(text) }
+ id: gpuProc
+ command: ["sh", `${Quickshell.shellDir}/modules/perf/gpu.sh`]
+ stdout: StdioCollector {
+ onStreamFinished: {
+ const cur = P.gpuSample(text);
+ const l = P.gpuLoad(root.gpu, cur);
+ root.vram = cur ? cur[0] : null;
+ root.gpuRender = l.render;
+ root.gpuCompute = l.compute;
+ root.gpu = cur;
+ }
+ }
}
// --- network ------------------------------------------------------------
diff --git a/desktop/modules/perf/PerfPanel.qml b/desktop/modules/perf/PerfPanel.qml
index 784284a..8ea4af6 100644
--- a/desktop/modules/perf/PerfPanel.qml
+++ b/desktop/modules/perf/PerfPanel.qml
@@ -320,13 +320,32 @@ Column {
// --- GPU ----------------------------------------------------------------
- // No utilisation: xe exposes no busy percentage.
+ // Busy per engine from fdinfo's cycle counters: render is games, compute
+ // local LLMs; the headline is the busier of the two.
Card {
+ readonly property var busy: Perf.gpuRender === null && Perf.gpuCompute === null ? null
+ : Math.max(Perf.gpuRender ?? 0, Perf.gpuCompute ?? 0)
title: "GPU · " + Perf.gpuName
- headline: panel.deg(panel.gpuTemp.value)
- headlineColor: panel.tone(panel.gpuTemp.value, panel.gpuTemp.warn, panel.gpuTemp.crit)
+ headline: busy === null ? "--" : Math.round(busy) + "%"
+ headlineColor: panel.tone(busy, 25, 75)
Pair {
+ label: "Render"
+ value: Perf.gpuRender === null ? "--" : Math.round(Perf.gpuRender) + "%"
+ }
+ Bar {
+ frac: (Perf.gpuRender ?? 0) / 100
+ fill: panel.tone(Perf.gpuRender, 25, 75)
+ }
+ Pair {
+ label: "Compute"
+ value: Perf.gpuCompute === null ? "--" : Math.round(Perf.gpuCompute) + "%"
+ }
+ Bar {
+ frac: (Perf.gpuCompute ?? 0) / 100
+ fill: panel.tone(Perf.gpuCompute, 25, 75)
+ }
+ Pair {
label: "VRAM"
value: Perf.vram === null ? "--" : P.bytes(Perf.vram) + " / " + P.bytes(Perf.vramTotal)
}
@@ -335,6 +354,11 @@ Column {
fill: panel.tone(panel.pct(Perf.vram, Perf.vramTotal), 25, 75)
}
Pair {
+ label: "Temperature"
+ value: panel.deg(panel.gpuTemp.value)
+ valueColor: panel.tone(panel.gpuTemp.value, panel.gpuTemp.warn, panel.gpuTemp.crit)
+ }
+ Pair {
label: "Fan"
value: Perf.fan === null ? "--" : Perf.fan + " rpm"
}
diff --git a/desktop/modules/perf/README.md b/desktop/modules/perf/README.md
index d5ae0b3..9fdbc6e 100644
--- a/desktop/modules/perf/README.md
+++ b/desktop/modules/perf/README.md
@@ -2,10 +2,12 @@
The figures the conky dashboard used to show, as a drawer page of cards, one
per row; the page scrolls. CPU load with a bar per core, the CPU model and
-RAM; every temperature as a tile; the Arc B580's VRAM and fan (no
-utilisation, xe exposes none); the five mounts with their usage; and
+RAM; every temperature as a tile; the Arc B580's render and compute load
+(games and local LLMs, from fdinfo's cycle counters), VRAM, temperature and
+fan; the five mounts with their usage; and
`~/.cache` with its five largest children. `Perf.qml` reads them; `Perf.js`
-holds the parsing, tested by `node desktop/modules/perf/test_perf.js`.
+holds the parsing, tested by `node desktop/modules/perf/test_perf.js`;
+`gpu.sh` sums the fdinfo scan, tested by `sh desktop/modules/perf/test_gpu.sh`.
The tile shows CPU and RAM, and a dot for the worst of these, yellow or red:
@@ -27,7 +29,7 @@ into the LAN depends on the ISP's fixed address. The fetch is
never a mismatch: the old value goes stale after 4 hours and shows as a dash.
Everything is sampled always, including per-core load, the network rate,
-VRAM (a scan of every fdinfo, ~14ms every 2s) and the fan. The network rate
+GPU load and VRAM (a scan of every fdinfo, ~14ms every 2s) and the fan. The network rate
is drawn by the network page, which reads it from here, so its graph opens
on the last minute of history instead of empty. The mount list, `br0`, the GPU name and the 12 GiB VRAM
size are constants in `Perf.qml`.
diff --git a/desktop/modules/perf/vram.sh b/desktop/modules/perf/gpu.sh
index 83db27d..31f8a6e 100755
--- a/desktop/modules/perf/vram.sh
+++ b/desktop/modules/perf/gpu.sh
@@ -11,10 +11,14 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-# VRAM in bytes from the fdinfo scan: drm-resident-vram0 of every xe fd,
-# counted once per drm-client-id because a client holds several fds. Prints
-# nothing when no xe client is found. With a file argument it reads that
-# instead of scanning, for test_vram.sh.
+# GPU from the fdinfo scan, every xe fd counted once per drm-client-id
+# because a client holds several fds. Prints one line, "vram rcs_busy
+# rcs_clock ccs_busy ccs_clock": VRAM in bytes (drm-resident-vram0), then
+# per engine the busy cycles summed over clients and the GPU's cycle
+# counter, which Perf.js turns into a percentage between two scans. rcs is
+# render (games), ccs compute (local LLMs). Prints nothing when no xe
+# client is found. With a file argument it reads that instead of scanning,
+# for test_gpu.sh.
#
# Summed here rather than in JS: a process holding thousands of DRM fds
# makes the scan a few hundred KB, which is a lot of string churn to parse
@@ -28,6 +32,7 @@
scan() {
if [ -n "$1" ]; then cat "$1"
else grep -sH -e '^drm-driver' -e '^drm-client-id' -e '^drm-resident-vram0' \
+ -e '^drm-cycles-[rc]cs' -e '^drm-total-cycles-[rc]cs' \
/proc/[0-9]*/fdinfo/* 2>/dev/null
fi
}
@@ -45,10 +50,16 @@ scan "$1" | awk -F: '
id = d[p, "drm-client-id"]
if (d[p, "drm-driver"] != "xe" || id == "" || (id in seen)) continue
if (split(d[p, "drm-resident-vram0"], n, " ") < 1 || n[1] !~ /^[0-9]+$/) continue
+ for (i = 1; i <= 2; i++) {
+ e = i == 1 ? "rcs" : "ccs"
+ busy[e] += d[p, "drm-cycles-" e]
+ c = d[p, "drm-total-cycles-" e] + 0
+ if (c > clock[e]) clock[e] = c
+ }
seen[id]
u = n[2] == "KiB" ? 1024 : n[2] == "MiB" ? 1048576 : n[2] == "GiB" ? 1073741824 : 1
total += n[1] * u
any = 1
}
- if (any) printf "%.0f\n", total
+ if (any) printf "%.0f %.0f %.0f %.0f %.0f\n", total, busy["rcs"], clock["rcs"], busy["ccs"], clock["ccs"]
}'
diff --git a/desktop/modules/perf/test_vram.sh b/desktop/modules/perf/test_gpu.sh
index 7ef4ade..8467c74 100755
--- a/desktop/modules/perf/test_vram.sh
+++ b/desktop/modules/perf/test_gpu.sh
@@ -11,8 +11,8 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-# vram.sh: summed once per xe client id, units honoured, other drivers
-# ignored; nothing at all when no xe client is found.
+# gpu.sh: VRAM and engine cycles summed once per xe client id, units
+# honoured, other drivers ignored; nothing at all when no xe client is found.
set -e
dir=$(dirname "$0")
tmp=$(mktemp)
@@ -22,19 +22,25 @@ printf '%s\n' \
"/proc/1/fdinfo/7:drm-driver: xe" \
"/proc/1/fdinfo/7:drm-client-id: 38" \
"/proc/1/fdinfo/7:drm-resident-vram0: 1024 KiB" \
+ "/proc/1/fdinfo/7:drm-cycles-rcs: 30" \
+ "/proc/1/fdinfo/7:drm-total-cycles-rcs: 1000" \
"/proc/1/fdinfo/10:drm-driver: xe" \
"/proc/1/fdinfo/10:drm-client-id: 38" \
"/proc/1/fdinfo/10:drm-resident-vram0: 1024 KiB" \
+ "/proc/1/fdinfo/10:drm-cycles-rcs: 30" \
+ "/proc/1/fdinfo/10:drm-total-cycles-rcs: 1000" \
"/proc/2/fdinfo/5:drm-driver: xe" \
"/proc/2/fdinfo/5:drm-client-id: 40" \
"/proc/2/fdinfo/5:drm-resident-vram0: 2 MiB" \
+ "/proc/2/fdinfo/5:drm-cycles-ccs: 7" \
+ "/proc/2/fdinfo/5:drm-total-cycles-ccs: 900" \
"/proc/3/fdinfo/4:drm-driver: amdgpu" \
"/proc/3/fdinfo/4:drm-client-id: 1" \
"/proc/3/fdinfo/4:drm-resident-vram0: 9 GiB" > "$tmp"
-got=$(sh "$dir/vram.sh" "$tmp")
-[ "$got" = $((1024 * 1024 + 2 * 1024 * 1024)) ] || { echo "vram: got '$got'"; exit 1; }
+got=$(sh "$dir/gpu.sh" "$tmp")
+[ "$got" = "$((1024 * 1024 + 2 * 1024 * 1024)) 30 1000 7 900" ] || { echo "gpu: got '$got'"; exit 1; }
: > "$tmp"
-got=$(sh "$dir/vram.sh" "$tmp")
+got=$(sh "$dir/gpu.sh" "$tmp")
[ -z "$got" ] || { echo "empty: got '$got'"; exit 1; }
echo ok
diff --git a/desktop/modules/perf/test_perf.js b/desktop/modules/perf/test_perf.js
index d5856e8..a1a068d 100644
--- a/desktop/modules/perf/test_perf.js
+++ b/desktop/modules/perf/test_perf.js
@@ -20,7 +20,7 @@ const src = fs.readFileSync(__dirname + "/Perf.js", "utf8")
.replace(/^\.pragma library$/m, "");
const P = new Function(src + "\nreturn { cpuTimes, load, meminfo, df, rate, " +
"hwmonMap, lanAddr, cpuModel, du, band, worst, isIPv4, parsePubip, formatPubip, " +
- "ipCheck, due, push, bytes, speed, procs, sockets, netProcs };")();
+ "ipCheck, due, push, bytes, speed, procs, sockets, netProcs, gpuSample, gpuLoad };")();
// cpuTimes: aggregate first, then cores; idle is idle + iowait.
const stat = [
@@ -183,4 +183,11 @@ assert.deepStrictEqual(P.netProcs([{ key: "a", name: "firefox", rx: 5000, tx: 10
[{ name: "firefox", rx: 3000, tx: 0 }]);
assert.deepStrictEqual(P.netProcs([], later, 0), []);
+
+// gpu.sh: five numbers or nothing; load per engine between two scans.
+assert.strictEqual(P.gpuSample(""), null);
+const g1 = P.gpuSample("100 0 1000 0 1000\n"), g2 = P.gpuSample("100 200 2000 900 2000");
+assert.deepStrictEqual(P.gpuLoad(g1, g2), { render: 20, compute: 90 });
+assert.deepStrictEqual(P.gpuLoad(null, g2), { render: null, compute: null });
+assert.deepStrictEqual(P.gpuLoad(g2, [100, 0, 3000, 0, 2000]), { render: 0, compute: null });
console.log("test_perf: ok");
diff --git a/desktop/modules/services/README.md b/desktop/modules/services/README.md
new file mode 100644
index 0000000..982a6b8
--- /dev/null
+++ b/desktop/modules/services/README.md
@@ -0,0 +1,41 @@
+# services
+
+The drawer's Services tile: every quickshell shell, deck-it and the desktop's
+daemons, one row each, with Start when stopped and Stop and Restart when
+running. Their state is read every 2s while the page is open. Runtime only:
+what starts at login is the settings window's Autostart page, deck-it's
+settings are its four pages there.
+
+Shells are the directories in the repo holding a `shell.qml`, running when
+`qs list --all` shows an instance on one. Start, Restart and Restart all run
+`reload.sh`, wrapped by `restart.sh`, which then sends one notification
+naming the shells that came back, or a critical one naming those that did
+not. Back means a `qs` instance on the shell's config path under a pid it did
+not have before, within 5s: the old instance can linger in the list for a
+moment after `qs kill`. It is the process, not the config: a shell that starts
+with a broken component counts as back. Stop is `qs kill -p <dir>`. The
+desktop row has no Stop, since that shell draws the drawer; its Restart works
+because every action is started with `Quickshell.execDetached`, outside the
+desktop shell's process, so the script carries on and starts the new one. A
+hung desktop shell cannot be restarted from here; `./reload.sh` from a
+terminal remains the way out.
+
+deck-it's row goes through `DeckIt.control()` (`modules/deckit`): Start runs
+the login command, Stop `deck-it stop`, Restart both. Its detail line is
+`deck-it status`, and the buttons wait until it shows the result or 30s pass.
+
+The daemons are listed in `Services.js`: a label, a piece of the daemon's
+`autostart.lua` line and its `pgrep`/`pkill` arguments. Start runs that
+enabled line through `hyprctl dispatch hl.dsp.exec_cmd(...)`, as the Autostart
+page's Try does, so a `[workspace]` rule applies as at login and the command
+lives only in `autostart.lua`; with no enabled line the row says "not in
+autostart" and offers no Start. Stop is `pkill`, then up to 5s for the
+process to exit, which hyprsunset needs: it holds Hyprland's CTM manager until
+it is gone, and a second one dies. Restart is Stop then Start. A `-f` pattern
+brackets one letter (`[t]v-mpris\.py`) so it never matches the `sh -c` that
+passes it to pgrep or pkill.
+
+The Hypridle and Hyprsunset settings pages restart their daemon to apply a
+save; that is theirs, not a duplicate of these rows.
+
+Check: `node desktop/modules/services/test_services.js`.
diff --git a/desktop/modules/services/Services.js b/desktop/modules/services/Services.js
new file mode 100644
index 0000000..d9aab80
--- /dev/null
+++ b/desktop/modules/services/Services.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+.pragma library
+
+// The daemons the drawer's Services page starts and stops, tested by
+// test_services.js under node.
+//
+// Each is [label, a piece of its autostart.lua line, pgrep/pkill arguments].
+// Its start command is that enabled line, so the command lives only in
+// autostart.lua. A -f pattern brackets one letter, so it never matches the
+// sh -c that runs pgrep or pkill with the pattern as an argument.
+const DAEMONS = [
+ ["desktop-assistant", "desktop-assistant/assistant.py", ["-f", "desktop-assistant/[a]ssistant\\.py"]],
+ ["cal-notif", "cal-notif daemon", ["-f", "[c]al-notif daemon"]],
+ ["tv-mpris", "tv-mpris.py", ["-f", "[t]v-mpris\\.py"]],
+ ["mail-watcher", "mail-watcher.sh", ["-f", "[m]ail-watcher\\.sh"]],
+ ["mail-notify", "mail-notify.sh", ["-f", "[m]ail-notify\\.sh"]],
+ ["hypridle", "hypridle", ["-x", "hypridle"]],
+ ["hyprsunset", "hyprsunset", ["-x", "hyprsunset"]],
+ ["polkit agent", "hyprpolkitagent", ["-x", "hyprpolkitagent"]],
+ ["notifyd", "notifyd", ["-x", "notifyd"]],
+ ["playerctld", "playerctld", ["-x", "playerctld"]],
+ ["conky", "conky", ["-x", "conky"]],
+ ["clipboard history", "cliphist store", ["-f", "[w]l-paste --watch cliphist"]],
+];
+
+// [{label, args, start}] from Autostart.js's parsed entries: start is the
+// first enabled line holding the daemon's piece, "" when there is none.
+function daemons(entries) {
+ return DAEMONS.map(([label, piece, args]) => {
+ const e = entries.find(e => e.enabled && e.cmd.includes(piece));
+ return { label, args, start: e ? e.cmd : "" };
+ });
+}
diff --git a/desktop/modules/services/ServicesModule.qml b/desktop/modules/services/ServicesModule.qml
new file mode 100644
index 0000000..7512793
--- /dev/null
+++ b/desktop/modules/services/ServicesModule.qml
@@ -0,0 +1,135 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import Quickshell
+import Quickshell.Io
+import QtQuick
+import "../.."
+import "../deckit"
+import "../autostart/Autostart.js" as A
+import "Services.js" as S
+
+// The drawer's Services: every quickshell shell, deck-it and the desktop's
+// daemons, each with Start, Stop and Restart. Their state is read every 2s
+// while the page is open. Started detached, so an action outlives the qs that
+// started it: restarting the desktop shell from its own drawer works, the
+// drawer just closes until the new process is up.
+Module {
+ id: sm
+ name: "services"
+ label: "Services"
+ // nf-fa-cogs, present in Inconsolata Nerd Font; escaped, so it survives editing.
+ icon: "\uf085"
+ keywords: ["services", "restart", "reload", "start", "stop", "quickshell", "qs", "shells",
+ "daemon", "deck-it", "process"]
+
+ readonly property string root: Quickshell.shellDir + "/.."
+ // [{name, running}], one per directory holding a shell.qml.
+ property var shells: []
+ // [{label, args, start, running}], Services.js's daemons.
+ property var daemons: []
+ property int watchers: 0
+
+ // An empty name restarts every shell the page lists. A stopped shell
+ // restarts into a start: reload.sh only starts what is not running.
+ function restartShell(name) {
+ Quickshell.execDetached(["sh", Quickshell.shellDir + "/modules/services/restart.sh", sm.root]
+ .concat(name ? [name] : sm.shells.map(s => s.name)));
+ repoll.restart();
+ }
+
+ function stopShell(name) {
+ Quickshell.execDetached(["qs", "kill", "-p", sm.root + "/" + name]);
+ repoll.restart();
+ }
+
+ // Stop is pkill, then up to 5s for the process to go: hyprsunset holds
+ // Hyprland's CTM manager until it exits, and a second one dies. Start runs
+ // the autostart.lua line through Hyprland, so its [workspace] rule
+ // applies as at login.
+ function daemon(d, op) {
+ const start = op === "stop" || !d.start ? "" : 'hl.dsp.exec_cmd("' + A.quote(d.start) + '")';
+ Quickshell.execDetached(["sh", "-c",
+ 'start=$1; kill=$2; shift 2; '
+ + 'if [ "$kill" = 1 ]; then pkill "$@"; '
+ + 'for i in $(seq 50); do pgrep "$@" >/dev/null || break; sleep 0.1; done; fi; '
+ + '[ -z "$start" ] || hyprctl dispatch "$start"',
+ "sh", start, op === "start" ? "0" : "1"].concat(d.args));
+ repoll.restart();
+ }
+
+ function refresh() {
+ shellProc.rows = [];
+ shellProc.running = false;
+ shellProc.running = true;
+ if (!daemonProc.running) daemonProc.running = true;
+ }
+
+ // reload.sh waits a second before it returns; read again after that.
+ property Timer repoll: Timer {
+ interval: 2000
+ onTriggered: sm.refresh()
+ }
+ property Timer poll: Timer {
+ interval: 2000
+ repeat: true
+ running: sm.watchers > 0
+ onTriggered: sm.refresh()
+ }
+
+ property FileView autostart: FileView {
+ path: DeckIt.autostartFile
+ watchChanges: true
+ printErrors: false
+ onFileChanged: reload()
+ onLoaded: sm.refresh()
+ }
+
+ // A shell is running when qs lists an instance on its config path.
+ property Process shellProc: Process {
+ property var rows: []
+ command: ["sh", "-c", 'cd "$1" || exit 1; up=$(qs list --all 2>/dev/null); '
+ + 'for f in */shell.qml; do case "$up" in '
+ + '*"Config path: $PWD/$f"*) s=running ;; *) s=stopped ;; esac; '
+ + 'printf "%s\\t%s\\n" "${f%/shell.qml}" "$s"; done', "sh", sm.root]
+ stdout: SplitParser {
+ onRead: line => {
+ const f = line.split("\t");
+ if (f.length === 2) shellProc.rows.push({ name: f[0], running: f[1] === "running" });
+ }
+ }
+ onExited: {
+ sm.shells = shellProc.rows;
+ sm.searchItems = shellProc.rows.map(s => ({ text: s.name, key: "shell:" + s.name }))
+ .concat(S.DAEMONS.map(x => ({ text: x[0], key: "daemon:" + x[0] })));
+ }
+ }
+
+ // One 1 or 0 per daemon, in Services.js's order; every daemon has a
+ // flag and a pattern.
+ property Process daemonProc: Process {
+ command: ["sh", "-c", 'while [ $# -gt 1 ]; do pgrep "$1" "$2" >/dev/null && echo 1 || echo 0; shift 2; done',
+ "sh"].concat([].concat(...S.DAEMONS.map(x => x[2])))
+ stdout: StdioCollector { id: daemonOut }
+ onExited: {
+ const up = daemonOut.text.split("\n");
+ sm.daemons = S.daemons(A.parse(sm.autostart.text()))
+ .map((d, i) => Object.assign(d, { running: up[i] === "1" }));
+ }
+ }
+
+ page: Component {
+ Page {
+ title: "Services"
+ ServicesPage { width: parent.width; services: sm }
+ }
+ }
+}
diff --git a/desktop/modules/services/ServicesPage.qml b/desktop/modules/services/ServicesPage.qml
new file mode 100644
index 0000000..652f9da
--- /dev/null
+++ b/desktop/modules/services/ServicesPage.qml
@@ -0,0 +1,91 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import QtQuick
+import "../.."
+import "../ai"
+import "../deckit"
+
+// Shells, deck-it and the daemons, one row each: Start when stopped, Stop and
+// Restart when running. The desktop shell has no Stop: it draws this page.
+Column {
+ id: page
+
+ required property var services
+
+ spacing: 8
+
+ Component.onCompleted: { page.services.watchers++; DeckIt.watchers++; page.services.refresh(); }
+ Component.onDestruction: { page.services.watchers--; DeckIt.watchers--; }
+
+ SectionHeader { divider: false; glyph: "\uf120"; label: "Shells" }
+
+ AiRow {
+ width: page.width
+ title: "All shells"
+ detail: "Restarts every one, this drawer included"
+ on: true
+ action: "Restart all"
+ onTriggered: page.services.restartShell("")
+ }
+
+ Repeater {
+ model: page.services.shells
+
+ AiRow {
+ required property var modelData
+ readonly property bool self: modelData.name === "desktop"
+ objectName: "shell:" + modelData.name
+ width: page.width
+ title: modelData.name
+ on: modelData.running
+ detail: (modelData.running ? "Running" : "Stopped") + (self ? " · hosts this drawer" : "")
+ action: !modelData.running ? "Start" : self ? "" : "Stop"
+ restartable: modelData.running
+ onTriggered: modelData.running ? page.services.stopShell(modelData.name)
+ : page.services.restartShell(modelData.name)
+ onRestart: page.services.restartShell(modelData.name)
+ }
+ }
+
+ SectionHeader { glyph: String.fromCodePoint(0xF0ECE); label: "deck-it" }
+
+ AiRow {
+ width: page.width
+ title: "deck-it"
+ detail: ({ start: "Starting…", stop: "Stopping…", restart: "Restarting…" })[DeckIt.busy] ?? DeckIt.summary
+ on: DeckIt.running
+ busy: DeckIt.busy !== ""
+ action: DeckIt.busy ? "" : DeckIt.running ? "Stop" : "Start"
+ restartable: DeckIt.running && !DeckIt.busy
+ onTriggered: DeckIt.control(DeckIt.running ? "stop" : "start")
+ onRestart: DeckIt.control("restart")
+ }
+
+ SectionHeader { glyph: "\uf085"; label: "Daemons" }
+
+ Repeater {
+ model: page.services.daemons
+
+ AiRow {
+ required property var modelData
+ objectName: "daemon:" + modelData.label
+ width: page.width
+ title: modelData.label
+ on: modelData.running
+ detail: modelData.running ? "Running" : modelData.start ? "Stopped" : "Stopped · not in autostart"
+ action: modelData.running ? "Stop" : modelData.start ? "Start" : ""
+ restartable: modelData.running && modelData.start !== ""
+ onTriggered: page.services.daemon(modelData, modelData.running ? "stop" : "start")
+ onRestart: page.services.daemon(modelData, "restart")
+ }
+ }
+}
diff --git a/desktop/modules/shells/restart.sh b/desktop/modules/services/restart.sh
index 2975d41..2975d41 100755
--- a/desktop/modules/shells/restart.sh
+++ b/desktop/modules/services/restart.sh
diff --git a/desktop/modules/services/test_services.js b/desktop/modules/services/test_services.js
new file mode 100644
index 0000000..9f9be4e
--- /dev/null
+++ b/desktop/modules/services/test_services.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Run: node desktop/modules/services/test_services.js
+// Both files are QML libraries, so their .pragma lines are stripped first.
+
+const fs = require("fs");
+const assert = require("assert");
+
+const lib = (f, names) => new Function(fs.readFileSync(f, "utf8").replace(/^\.pragma library$/m, "")
+ + `\nreturn { ${names} };`)();
+const A = lib(__dirname + "/../autostart/Autostart.js", "parse");
+const S = lib(__dirname + "/Services.js", "daemons, DAEMONS");
+
+const entries = A.parse([
+ 'hl.on("hyprland.start", function()',
+ ' hl.exec_cmd("[workspace special:dash silent] conky -c ~/.config/conky/conky.conf")',
+ ' -- hl.exec_cmd("hypridle")',
+ ' hl.exec_cmd("python3 -u ~/x/desktop-assistant/assistant.py >> \\"$XDG_RUNTIME_DIR/a.log\\" 2>&1")',
+ 'end)',
+].join("\n"));
+
+const d = Object.fromEntries(S.daemons(entries).map(x => [x.label, x]));
+assert.strictEqual(d.conky.start, "[workspace special:dash silent] conky -c ~/.config/conky/conky.conf");
+assert.strictEqual(d["desktop-assistant"].start,
+ 'python3 -u ~/x/desktop-assistant/assistant.py >> "$XDG_RUNTIME_DIR/a.log" 2>&1');
+assert.strictEqual(d.hypridle.start, ""); // commented out
+assert.strictEqual(d.notifyd.start, ""); // absent
+assert.deepStrictEqual(d.hypridle.args, ["-x", "hypridle"]);
+
+// Every -f pattern matches its line but not itself (the sh running pgrep).
+for (const [label, piece, [flag, pat]] of S.DAEMONS) {
+ if (flag !== "-f") continue;
+ const re = new RegExp(pat);
+ assert.ok(!re.test(pat), label + " matches its own pattern");
+ assert.ok(re.test(piece) || re.test("wl-paste --watch " + piece), label + " misses its line");
+}
+console.log("services ok");
diff --git a/desktop/modules/shells/README.md b/desktop/modules/shells/README.md
deleted file mode 100644
index 16a93b5..0000000
--- a/desktop/modules/shells/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# shells
-
-Every directory in the repo holding a `shell.qml`, with whether `qs list
---all` shows an instance on it, and a Restart (or Start, when it is not
-running) per row plus a Restart all. All three run `reload.sh`, so a button
-does what the script does from a terminal, wrapped by `restart.sh`, which
-then sends one notification naming the shells that came back, or a critical
-one naming those that did not. Back means a `qs` instance on the shell's
-config path under a pid it did not have before, within 5s: the old instance
-can linger in the list for a moment after `qs kill`. It is the process, not
-the config: a shell that starts with a broken component counts as back.
-
-The script is started with `Quickshell.execDetached`, which leaves it outside
-the desktop shell's process: restarting `desktop` from here kills the process
-drawing the page and the script carries on and starts the new one. The
-settings window closes with it and is not reopened. The new shell inherits
-the desktop shell's environment, which is the one Hyprland's autostart gave
-it.
-
-A hung desktop shell cannot be restarted from here, since the page is part of
-it. `./reload.sh` from a terminal remains the way out.
diff --git a/desktop/modules/shells/ShellsModule.qml b/desktop/modules/shells/ShellsModule.qml
deleted file mode 100644
index 1a747ac..0000000
--- a/desktop/modules/shells/ShellsModule.qml
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2 as
-// published by the Free Software Foundation.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-import Quickshell
-import Quickshell.Io
-import QtQuick
-import "../.."
-
-// Every shell in the repo, running or not, with a restart through reload.sh,
-// wrapped by restart.sh, which notifies once the shells are back. Started
-// detached, so it outlives the qs that started it:
-// restarting the desktop shell from its own settings window works, the
-// window just closes until the new process is up.
-Module {
- id: sm
- name: "shells"
- label: "Shells"
- // nf-fa-refresh, present in Inconsolata Nerd Font.
- icon: ""
- settings: true
- group: "Desktop"
- keywords: ["restart", "reload", "quickshell", "qs", "process", "start"]
-
- readonly property string root: Quickshell.shellDir + "/.."
- // [{name, running}], one per directory holding a shell.qml.
- property var shells: []
-
- // An empty name restarts every shell the page lists.
- function restart(name) {
- Quickshell.execDetached(["sh", Quickshell.shellDir + "/modules/shells/restart.sh", sm.root]
- .concat(name ? [name] : sm.shells.map(s => s.name)));
- repoll.restart();
- }
-
- function refresh() {
- proc.rows = [];
- proc.running = false;
- proc.running = true;
- }
-
- // reload.sh waits a second before it returns; read the list after that.
- property Timer repoll: Timer {
- interval: 2000
- onTriggered: sm.refresh()
- }
-
- // A shell is running when qs lists an instance on its config path.
- property Process proc: Process {
- property var rows: []
- command: ["sh", "-c", 'cd "$1" || exit 1; up=$(qs list --all 2>/dev/null); '
- + 'for f in */shell.qml; do case "$up" in '
- + '*"Config path: $PWD/$f"*) s=running ;; *) s=stopped ;; esac; '
- + 'printf "%s\\t%s\\n" "${f%/shell.qml}" "$s"; done', "sh", sm.root]
- stdout: SplitParser {
- onRead: line => {
- const f = line.split("\t");
- if (f.length === 2) proc.rows.push({ name: f[0], running: f[1] === "running" });
- }
- }
- onExited: {
- sm.shells = proc.rows;
- sm.searchItems = proc.rows.map(s => ({ text: s.name, key: "shell:" + s.name }));
- }
- }
-
- page: Component {
- Page {
- title: "Shells"
- ShellsPage { width: parent.width; shells: sm }
- }
- }
-}
diff --git a/desktop/modules/shells/ShellsPage.qml b/desktop/modules/shells/ShellsPage.qml
deleted file mode 100644
index abbb2b1..0000000
--- a/desktop/modules/shells/ShellsPage.qml
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2 as
-// published by the Free Software Foundation.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-import QtQuick
-import "../.."
-import "../ai"
-
-// One row per shell, Restart when it runs and Start when it does not, both
-// through reload.sh. The desktop row restarts the process drawing this page.
-Column {
- id: page
-
- required property var shells
-
- spacing: 8
-
- Component.onCompleted: page.shells.refresh()
-
- AiRow {
- width: page.width
- title: "All shells"
- detail: "Restarts every one, this window included"
- on: true
- action: "Restart all"
- onTriggered: page.shells.restart("")
- }
-
- Repeater {
- model: page.shells.shells
-
- AiRow {
- required property var modelData
- objectName: "shell:" + modelData.name
- width: page.width
- title: modelData.name
- on: modelData.running
- detail: (modelData.running ? "Running" : "Stopped")
- + (modelData.name === "desktop" ? " · hosts this window" : "")
- action: modelData.running ? "Restart" : "Start"
- onTriggered: page.shells.restart(modelData.name)
- }
- }
-}
diff --git a/desktop/modules/sound/Player.qml b/desktop/modules/sound/Player.qml
index e32a1b9..7522d80 100644
--- a/desktop/modules/sound/Player.qml
+++ b/desktop/modules/sound/Player.qml
@@ -12,6 +12,7 @@
pragma Singleton
import Quickshell
+import Quickshell.Io
import Quickshell.Services.Mpris
import QtQuick
@@ -59,6 +60,38 @@ Singleton {
// per track, so the path can repeat while the image behind it changes.
// The cache buster makes Image reload instead of showing the last cover.
readonly property string artUrl:
- (current?.trackArtUrl ?? "") === "" ? ""
- : current.trackArtUrl + "#" + encodeURIComponent(title)
+ (current?.trackArtUrl ?? "") !== ""
+ ? current.trackArtUrl + "#" + encodeURIComponent(title)
+ : (videoUrl !== "" && thumbFor === videoUrl)
+ ? "file://" + thumbPath + "#" + encodeURIComponent(videoUrl) : ""
+
+ // Haruna clears mpris:artUrl for every video on purpose (so the task
+ // manager shows the live window), so a local video with no cover gets a
+ // frame grabbed by ffmpeg instead. One file, overwritten per video; the
+ // URL fragment above makes Image reload it.
+ readonly property string videoUrl: {
+ const url = String(current?.metadata?.["xesam:url"] ?? "");
+ return (current?.trackArtUrl ?? "") === "" && url.startsWith("file://")
+ && /\.(mp4|m4v|mkv|webm|avi|mov|wmv|flv|mpe?g|ts|ogv)$/i.test(url) ? url : "";
+ }
+ readonly property string thumbPath: (Quickshell.env("XDG_RUNTIME_DIR") || "/tmp") + "/qs-video-thumb.jpg"
+ property string thumbFor: ""
+
+ onVideoUrlChanged: grab()
+ Component.onCompleted: grab()
+
+ function grab() {
+ if (videoUrl === "") return;
+ thumb.running = false;
+ thumb.url = videoUrl;
+ thumb.command = ["ffmpeg", "-y", "-v", "error", "-i", decodeURIComponent(videoUrl.slice(7)),
+ "-vf", "thumbnail,scale=480:-2", "-frames:v", "1", thumbPath];
+ thumb.running = true;
+ }
+
+ Process {
+ id: thumb
+ property string url: ""
+ onExited: code => { if (code === 0) root.thumbFor = url; }
+ }
}
diff --git a/desktop/modules/sound/SoundPage.qml b/desktop/modules/sound/SoundPage.qml
index 3f39c48..f220b61 100644
--- a/desktop/modules/sound/SoundPage.qml
+++ b/desktop/modules/sound/SoundPage.qml
@@ -128,22 +128,15 @@ Column {
width: page.width
spacing: 6
- Item {
- width: parent.width
- implicitHeight: name.implicitHeight
-
- Text {
- id: name
- anchors.left: parent.left
- text: modelData.label
- font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 1; bold: true }
- color: Theme.text
- }
+ SectionHeader {
+ divider: modelData.label !== "Output"
+ glyph: String.fromCodePoint(modelData.label === "Output" ? 0xF04C3 : 0xF036C)
+ label: modelData.label
// State glyph and level, clickable to mute/unmute.
Row {
id: levelRow
- anchors { right: parent.right; verticalCenter: parent.verticalCenter }
+ anchors { right: parent.right; bottom: parent.bottom }
spacing: 6
Text {
@@ -269,11 +262,7 @@ Column {
spacing: 10
visible: page.service.streams.length > 0
- Text {
- text: "Applications"
- font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 1; bold: true }
- color: Theme.text
- }
+ SectionHeader { glyph: String.fromCodePoint(0xF003B); label: "Applications" }
Repeater {
model: page.service.streams
diff --git a/desktop/modules/status/README.md b/desktop/modules/status/README.md
index ea069d6..15bb122 100644
--- a/desktop/modules/status/README.md
+++ b/desktop/modules/status/README.md
@@ -1,9 +1,10 @@
# status
-Desktop modes as state: `dnd`, `presentation`, `nolock` and `quiet`, owned by
-the `Status` singleton and stored as files under `$XDG_RUNTIME_DIR`. A fifth,
-`status.gaming`, is written only by the shell's game detector; it is not a
-mode `statusctl` exposes.
+Desktop modes as state: `dnd`, `presentation`, `nolock`, `quiet` and `nolamp`, owned by
+the `Status` singleton and stored as files under `$XDG_RUNTIME_DIR`. Two more,
+`status.gaming`, written only by the shell's game detector, and `status.xbox`,
+written only by deck-it while the Xbox runs a game, are not modes `statusctl`
+exposes; either one turns presentation on.
## The files are the interface
@@ -11,7 +12,9 @@ mode `statusctl` exposes.
$XDG_RUNTIME_DIR/status.presentation
$XDG_RUNTIME_DIR/status.nolock
$XDG_RUNTIME_DIR/status.quiet
+ $XDG_RUNTIME_DIR/status.nolamp
$XDG_RUNTIME_DIR/status.gaming
+ $XDG_RUNTIME_DIR/status.xbox
Each holds `0` or `1`; a missing file means off. That directory is tmpfs, so a
reboot resets every mode and there is no cleanup code. A shell restart does
@@ -63,7 +66,7 @@ asks `statusctl quiet get` and plays nothing on a 1. `~/bin/notify-sound` is a
symlink to the repo copy, like `statusctl`.
notify-sound claude Claude Code's Notification hook
- notify-sound <event> opencode-notifier's command hook
+ notify-sound <event> <session> opencode-notifier's command hook
The opencode notifier runs its command for every event, `session_started` and
`user_message` included, so an argument with no sound plays nothing; only
@@ -71,6 +74,12 @@ The opencode notifier runs its command for every event, `session_started` and
are off in `opencode-notifier.json`, and it rereads that file on every event,
so neither change needs an opencode restart.
+`nolamp` keeps the agent lamp (the sibling agent-lamp repo) dark. The shell
+does nothing with it: agent-lamp's renderer reads the file each second and
+restores the bulb while it is 1, keeping the agents' states for when it
+turns off. `notify-sound` forwards the opencode notifier's two arguments
+(`<event> <session>`) to `agent-lamp`, before the quiet check.
+
## Game detection
Presentation is set automatically while a game runs, so a fullscreen game does
@@ -110,8 +119,9 @@ without touching the manual half, so a bar widget would otherwise read
class with its own icon, and `toggle` is refused while it holds: the detector
reasserts the file within its poll, so the write would not stick. `set` is
still allowed, since the manual half is worth setting for when the game exits.
-The watch therefore follows `status.gaming` as well as its own file, and emits
-only on a real change so an unchanged rewrite draws nothing.
+The watch therefore follows `status.gaming` and `status.xbox` as well as its
+own file, and emits only on a real change so an unchanged rewrite draws
+nothing. `status.xbox` counts as gaming in all of this.
## The checks
diff --git a/desktop/modules/status/StatusPage.qml b/desktop/modules/status/StatusPage.qml
index 4741bcc..5a00ded 100644
--- a/desktop/modules/status/StatusPage.qml
+++ b/desktop/modules/status/StatusPage.qml
@@ -61,6 +61,20 @@ Column {
color: Qt.alpha(Theme.text, 0.08)
}
+ StatusRow {
+ width: page.width
+ mode: "nolamp"
+ label: "No lamp"
+ description: "Keeps the agent lamp dark, for a film. Agents still notify on screen."
+ value: Status.nolamp
+ }
+
+ Rectangle {
+ width: page.width
+ height: 1
+ color: Qt.alpha(Theme.text, 0.08)
+ }
+
LockRow {
width: page.width
}
diff --git a/desktop/modules/status/notify-sound b/desktop/modules/status/notify-sound
index c028b3e..36efaaa 100755
--- a/desktop/modules/status/notify-sound
+++ b/desktop/modules/status/notify-sound
@@ -15,7 +15,7 @@
# silence both. Their popups do not come through here and are unaffected.
#
# notify-sound claude Claude Code's Notification hook
-# notify-sound <opencode-notifier event> the notifier's command hook
+# notify-sound <event> <session> the opencode notifier's command hook
#
# An argument with no sound plays nothing. That is deliberate: the opencode
# notifier runs its command for every event, session_started and
@@ -24,6 +24,14 @@
set -u
here="$(dirname "$(readlink -f "$0")")"
+
+# opencode's notifier passes its event and session id: forward them to the
+# agent lamp, before the quiet check, since quiet mutes sound and not light.
+# Claude Code passes one argument and has hooks of its own for the lamp.
+if [[ $# -eq 2 ]] && command -v agent-lamp >/dev/null; then
+ agent-lamp "$1" "$2" </dev/null >/dev/null 2>&1 &
+fi
+
[[ "$("$here/statusctl" quiet get)" == "1" ]] && exit 0
dir="${NOTIFY_SOUND_DIR:-$HOME/Music/notify}"
diff --git a/desktop/modules/status/statusctl b/desktop/modules/status/statusctl
index 718ee39..69dc5a1 100755
--- a/desktop/modules/status/statusctl
+++ b/desktop/modules/status/statusctl
@@ -25,7 +25,7 @@
set -u
-MODES="dnd presentation nolock quiet"
+MODES="dnd presentation nolock quiet nolamp"
DIR="${XDG_RUNTIME_DIR:-/tmp}"
usage() {
@@ -83,17 +83,22 @@ tooltip() {
case "$1" in
activated) printf '%s: on' "$mode" ;;
deactivated) printf '%s: off' "$mode" ;;
- gaming) printf '%s: on (auto: game or call)' "$mode" ;;
+ gaming) printf '%s: on (auto: game, call or Xbox)' "$mode" ;;
esac
}
-# The shell's game detector owns status.gaming and presentation is the OR of
-# the two, so the CLI has to read it to agree with the shell. It is not a mode
-# in MODES: nothing here may write it, and only presentation is affected.
+# The shell's game detector owns status.gaming, deck-it owns status.xbox (a
+# game on the Xbox), and presentation is the OR of them and its own file, so
+# the CLI has to read both to agree with the shell. Neither is a mode in
+# MODES: nothing here may write them, and only presentation is affected.
gaming_on() {
- local v=""
- [[ -e "$DIR/status.gaming" ]] && v="$(tr -d '[:space:]' < "$DIR/status.gaming" 2>/dev/null)"
- [[ "$v" == "1" ]]
+ local f v
+ for f in status.gaming status.xbox; do
+ v=""
+ [[ -e "$DIR/$f" ]] && v="$(tr -d '[:space:]' < "$DIR/$f" 2>/dev/null)"
+ [[ "$v" == "1" ]] && return 0
+ done
+ return 1
}
# A missing file is the off state, not a distinct condition: read_mode already
@@ -158,14 +163,14 @@ case "$action" in
exec 3< <(inotifywait -q -m -e create,close_write,moved_to,delete --format '%f' "$DIR" 2>/dev/null)
watcher=$!
trap 'kill "$watcher" 2>/dev/null' EXIT TERM INT
- # Presentation also follows status.gaming, so a game starting or
- # ending redraws the widget. Emitting only on a real change keeps a
+ # Presentation also follows status.gaming and status.xbox, so a game
+ # starting or ending redraws the widget. Emitting only on a real change keeps a
# write of an unchanged value from firing a duplicate line.
last="$(state_now)"
while read -r changed <&3; do
case "$changed" in
"status.$mode") ;;
- status.gaming) [[ "$mode" == "presentation" ]] || continue ;;
+ status.gaming|status.xbox) [[ "$mode" == "presentation" ]] || continue ;;
*) continue ;;
esac
now="$(state_now)"
diff --git a/desktop/modules/status/test-notify-sound.sh b/desktop/modules/status/test-notify-sound.sh
index 9571d4c..d70893f 100755
--- a/desktop/modules/status/test-notify-sound.sh
+++ b/desktop/modules/status/test-notify-sound.sh
@@ -13,7 +13,8 @@
#
# The one runnable check for notify-sound. A fake paplay first on PATH
# records what it was asked to play, and XDG_RUNTIME_DIR is a temporary
-# directory, so no sound plays and the live quiet mode is untouched.
+# directory, so no sound plays and the live quiet mode is untouched. A fake
+# agent-lamp records its arguments, so the real lamp is never driven.
#
# Usage: ./test-notify-sound.sh (exit 0 = all passed)
@@ -27,6 +28,8 @@ export NOTIFY_SOUND_DIR="/sounds"
mkdir "$tmp/bin"
printf '#!/bin/sh\nprintf "%%s\\n" "$1" >> "%s/played"\n' "$tmp" > "$tmp/bin/paplay"
chmod +x "$tmp/bin/paplay"
+printf '#!/bin/sh\nprintf "%%s %%s\\n" "$1" "$2" >> "%s/lamp"\n' "$tmp" > "$tmp/bin/agent-lamp"
+chmod +x "$tmp/bin/agent-lamp"
export PATH="$tmp/bin:$PATH"
pass=0
@@ -64,5 +67,15 @@ check "quiet mutes permission" "" "$(play permission)"
"$here/statusctl" quiet set 0
check "quiet off plays again" "/sounds/claude-attention.opus" "$(play claude)"
+# Two arguments (opencode's event and session) are forwarded to agent-lamp,
+# even in quiet mode; Claude's single argument never is.
+rm -f "$tmp/lamp"
+"$here/notify-sound" claude
+"$here/notify-sound" permission ses1
+"$here/statusctl" quiet set 1
+"$here/notify-sound" complete ses2
+sleep 0.2
+check "lamp forward" "permission ses1|complete ses2" "$(paste -sd'|' "$tmp/lamp" 2>/dev/null)"
+
printf '\n%d passed, %d failed\n' "$pass" "$fail"
[[ "$fail" -eq 0 ]]
diff --git a/desktop/modules/status/test-statusctl.sh b/desktop/modules/status/test-statusctl.sh
index 170101c..0c51968 100755
--- a/desktop/modules/status/test-statusctl.sh
+++ b/desktop/modules/status/test-statusctl.sh
@@ -149,11 +149,34 @@ kill "$watcher5" 2>/dev/null
wait "$watcher5" 2>/dev/null
check "first write, created by link, redraws" "1" "$(grep -c '"class": *"gaming"' "$out5")"
+# deck-it writes status.xbox while the Xbox runs a game; it holds
+# presentation on the same way, so the watch follows it too.
+rm -f "$tmp/status.gaming" "$tmp/status.presentation"
+out6="$tmp/watch6.out"
+"$ctl" presentation watch > "$out6" 2>/dev/null &
+watcher6=$!
+sleep 0.3
+printf '1\n' > "$tmp/status.xbox.tmp"
+mv -f "$tmp/status.xbox.tmp" "$tmp/status.xbox"
+sleep 0.5
+kill "$watcher6" 2>/dev/null
+wait "$watcher6" 2>/dev/null
+check "xbox game redraws as gaming" "1" "$(grep -c '"class": *"gaming"' "$out6")"
+"$ctl" presentation toggle 2>/dev/null
+check "toggle refused while the xbox plays" "1" "$?"
+rm -f "$tmp/status.xbox"
+
# quiet is a plain mode like dnd.
"$ctl" quiet set 1
check "quiet set 1" "1" "$("$ctl" quiet get)"
"$ctl" quiet toggle
check "quiet toggle from 1" "0" "$("$ctl" quiet get)"
+# nolamp keeps agent-lamp's bulb dark; a plain mode like quiet.
+"$ctl" nolamp set 1
+check "nolamp set 1" "1" "$("$ctl" nolamp get)"
+"$ctl" nolamp toggle
+check "nolamp toggle from 1" "0" "$("$ctl" nolamp get)"
+
printf '\n%d passed, %d failed\n' "$pass" "$fail"
[[ "$fail" -eq 0 ]]
diff --git a/desktop/shell.qml b/desktop/shell.qml
index f5ca7d4..db7a165 100644
--- a/desktop/shell.qml
+++ b/desktop/shell.qml
@@ -22,9 +22,10 @@ import "modules/appearance"
import "modules/assistant"
import "modules/autostart"
import "modules/deckit"
+import "modules/island"
import "modules/qtmaildir"
import "modules/sbbuilder"
-import "modules/shells"
+import "modules/services"
import "modules/bluetooth"
import "modules/clipboard"
import "modules/fonts"
@@ -32,6 +33,7 @@ import "modules/git"
import "modules/hyprland"
import "modules/kdeconnect"
import "modules/mail"
+import "modules/mimeapps"
import "modules/monitors"
import "modules/network"
import "modules/notes"
@@ -92,6 +94,7 @@ ShellRoot {
ClipboardModule {},
UpdatesModule {},
VmModule {},
+ ServicesModule {},
AiModule {},
UserModule {},
NotesModule {},
@@ -106,12 +109,15 @@ ShellRoot {
SunsetModule {},
IdleModule {},
NotificationsModule {},
+ MimeAppsModule {},
AutostartModule {},
- ShellsModule {},
BindsModule {},
OptionsModule {},
MonitorsModule {},
ObsScenesModule {},
+ IslandPillsModule {},
+ IslandClockModule {},
+ IslandCalendarModule {},
// deck-it's four pages, one draft.
DeckItModule {},
DeckItDashboardModule {},