aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AGENTS.md8
-rw-r--r--desktop/Page.qml31
-rw-r--r--desktop/Prefs.qml23
-rw-r--r--desktop/Settings.qml6
-rw-r--r--desktop/assistant/Assistant.qml15
-rw-r--r--desktop/assistant/Files.js5
-rw-r--r--desktop/assistant/test_files.js4
-rw-r--r--desktop/island/ClockPill.qml5
-rw-r--r--desktop/island/Island.qml33
-rw-r--r--desktop/island/calendar/Cal.js83
-rw-r--r--desktop/island/calendar/CalendarPanel.qml74
-rw-r--r--desktop/island/calendar/EventEditor.qml39
-rw-r--r--desktop/island/calendar/test_cal.js36
-rw-r--r--desktop/modules/appearance/README.md19
-rw-r--r--desktop/modules/appearance/WallColors.js70
-rw-r--r--desktop/modules/appearance/WallpaperTab.qml90
-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.qml53
-rw-r--r--desktop/modules/deckit/DeckIt.qml43
-rw-r--r--desktop/modules/deckit/DeckItGeneralPage.qml2
-rw-r--r--desktop/modules/deckit/DeckItModule.qml7
-rw-r--r--desktop/modules/deckit/DeckItServicesPage.qml2
-rw-r--r--desktop/modules/deckit/Modules.js4
-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/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.qml92
-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/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.qml8
-rw-r--r--shared/Status.qml19
59 files changed, 1883 insertions, 332 deletions
diff --git a/AGENTS.md b/AGENTS.md
index 6f637c6..e91dc54 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -12,12 +12,14 @@ any of them runs alone, and running one does not require the others. `desktop/`
modules.
desktop/ the drawer (SUPER alone): user details, sound, mail, VMs, status,
- performance, clipboard, updates; the Sonix player; and the settings
+ performance, clipboard, updates, services; the Sonix player; and the settings
window for pages set once: wallpaper, transitions, theme, theme status,
- icons, sunset, idle (the former appearance shell), notifications, autostart, shells,
+ icons, sunset, idle (the former appearance shell), notifications, autostart,
the assistant's daemon and presets, qtmaildir, git,
Hyprland's keyboard shortcuts, options and monitors, fonts, the Sonix boot logo,
- deck-it (the tablet dashboard's autostart and config)
+ deck-it (the tablet dashboard's autostart and config),
+ the island bar (pill order, date and time format, the calendar's
+ default event length)
island/ top-centre pills on DP-1: clock, volume, Sonix player, tray, layout,
privacy, calendar, OBS
assistant/ the assistant canvas on SUPER+Home, a view over desktop-assistant
diff --git a/desktop/Page.qml b/desktop/Page.qml
index eb1c5c0..02b2da8 100644
--- a/desktop/Page.qml
+++ b/desktop/Page.qml
@@ -138,6 +138,27 @@ Item {
anchors.topMargin: 12
clip: true
contentWidth: availableWidth
+ // Faster wheel scrolling than Qt's defaults (2500, 1500); the
+ // sidebar and the landing page in Settings.qml use the same pair.
+ Component.onCompleted: {
+ scroll.contentItem.maximumFlickVelocity = 8000;
+ scroll.contentItem.flickDeceleration = 4000;
+ }
+
+ // 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
@@ -146,6 +167,16 @@ Item {
}
}
+ // A click on empty page space focuses the page, for the keys above.
+ // Beneath the content, so fields and buttons keep their clicks; it takes
+ // no wheel (no onWheel) and the Flickable still steals drags from it.
+ MouseArea {
+ parent: holder
+ z: -1
+ anchors.fill: parent
+ 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/Settings.qml b/desktop/Settings.qml
index 6b81586..2e151a9 100644
--- a/desktop/Settings.qml
+++ b/desktop/Settings.qml
@@ -228,6 +228,9 @@ Scope {
// Without it a scrolled list draws over the search box.
clip: true
model: root.found
+ // Faster wheel scrolling, as Page.qml.
+ maximumFlickVelocity: 8000
+ flickDeceleration: 4000
// A group's heading above its first entry, then the entry.
delegate: Column {
@@ -449,6 +452,9 @@ Scope {
contentHeight: about.height
clip: true
boundsBehavior: Flickable.StopAtBounds
+ // Faster wheel scrolling, as Page.qml.
+ maximumFlickVelocity: 8000
+ flickDeceleration: 4000
ScrollBar.vertical: ScrollBar {}
Column {
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/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/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..1d18503 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"
@@ -62,13 +63,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..f11225b 100644
--- a/desktop/island/Island.qml
+++ b/desktop/island/Island.qml
@@ -298,13 +298,24 @@ PanelWindow {
}
}
- // 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 +328,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 +346,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 +354,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/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/CalendarPanel.qml b/desktop/island/calendar/CalendarPanel.qml
index 7d42f7d..fef672c 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,7 +82,7 @@ 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;
}
@@ -113,12 +114,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 +143,7 @@ Item {
Grid {
columns: 7
spacing: 2
+ visible: !panel.pickingTime
Repeater {
model: [0, 1, 2, 3, 4, 5, 6]
@@ -208,6 +212,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 +291,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 +327,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/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/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/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..cf41a4d 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
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..0875a5d 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 {
@@ -680,15 +699,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/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/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/DeckItServicesPage.qml b/desktop/modules/deckit/DeckItServicesPage.qml
index e02cf16..5ef0273 100644
--- a/desktop/modules/deckit/DeckItServicesPage.qml
+++ b/desktop/modules/deckit/DeckItServicesPage.qml
@@ -32,6 +32,8 @@ 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: "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..7c345cf 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" };
+ obs: "OBS", k1c: "K1C printer", assistant: "Assistant", vm: "VMs", xbox: "Xbox" };
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/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..cc392db
--- /dev/null
+++ b/desktop/modules/services/ServicesPage.qml
@@ -0,0 +1,92 @@
+// 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"
+import "../qtmaildir"
+
+// 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--; }
+
+ Heading { text: "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)
+ }
+ }
+
+ Heading { text: "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")
+ }
+
+ Heading { text: "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/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..a4e2764 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"
@@ -92,6 +93,7 @@ ShellRoot {
ClipboardModule {},
UpdatesModule {},
VmModule {},
+ ServicesModule {},
AiModule {},
UserModule {},
NotesModule {},
@@ -107,11 +109,13 @@ ShellRoot {
IdleModule {},
NotificationsModule {},
AutostartModule {},
- ShellsModule {},
BindsModule {},
OptionsModule {},
MonitorsModule {},
ObsScenesModule {},
+ IslandPillsModule {},
+ IslandClockModule {},
+ IslandCalendarModule {},
// deck-it's four pages, one draft.
DeckItModule {},
DeckItDashboardModule {},
diff --git a/shared/Status.qml b/shared/Status.qml
index f32cd35..727f32b 100644
--- a/shared/Status.qml
+++ b/shared/Status.qml
@@ -33,9 +33,10 @@ Singleton {
readonly property bool dnd: dndFile.value
// Set by the game detector below, on its own file so it never fights the
// manual toggle: presentation is the OR, and a game ending clears only its
- // half. A manual "on" therefore survives a game session.
- readonly property bool gaming: gamingFile.value
- readonly property bool presentation: presFile.value || gamingFile.value
+ // half. A manual "on" therefore survives a game session. status.xbox is
+ // the same for a game on the Xbox, written by deck-it's xbox module.
+ readonly property bool gaming: gamingFile.value || xboxFile.value
+ readonly property bool presentation: presFile.value || gaming
// Stored as "auto-lock disabled", so the missing-file default of off is
// the wanted default of locking on. The row inverts it for the label.
readonly property bool nolock: nolockFile.value
@@ -43,9 +44,13 @@ Singleton {
// sound scripts read the file through statusctl, so this is only the
// drawer's view of it.
readonly property bool quiet: quietFile.value
+ // Keeps agent-lamp's bulb dark; agent-lamp reads the file itself, so
+ // this is only the drawer's view of it.
+ readonly property bool nolamp: nolampFile.value
readonly property int activeCount: (root.dnd ? 1 : 0) + (root.presentation ? 1 : 0)
+ (root.nolock ? 1 : 0) + (root.quiet ? 1 : 0)
+ + (root.nolamp ? 1 : 0)
// Set once by shell.qml. IdleInhibitor does nothing with a null window,
// and the singleton has no window of its own to offer.
@@ -81,6 +86,8 @@ Singleton {
nolockFile.write(on);
} else if (name === "quiet") {
quietFile.write(on);
+ } else if (name === "nolamp") {
+ nolampFile.write(on);
}
}
@@ -97,12 +104,13 @@ Singleton {
else if (name === "presentation") root.setMode("presentation", !root.presentation);
else if (name === "nolock") root.setMode("nolock", !root.nolock);
else if (name === "quiet") root.setMode("quiet", !root.quiet);
+ else if (name === "nolamp") root.setMode("nolamp", !root.nolamp);
}
// The detector calls this every poll; a write on an unchanged value would
// still land as an atomic write and re-fire the FileView watch for nothing.
function setGaming(on) {
- if (on !== root.gaming) gamingFile.write(on);
+ if (on !== gamingFile.value) gamingFile.write(on);
}
// The timed disable re-enables itself. Runs only while a deadline is
@@ -224,6 +232,9 @@ Singleton {
ModeFile { id: presFile; path: root.dir + "/status.presentation" }
ModeFile { id: nolockFile; path: root.dir + "/status.nolock" }
ModeFile { id: quietFile; path: root.dir + "/status.quiet" }
+ ModeFile { id: nolampFile; path: root.dir + "/status.nolamp" }
// Written only by the game detector above, never by statusctl.
ModeFile { id: gamingFile; path: root.dir + "/status.gaming" }
+ // Written only by deck-it while the Xbox runs a game.
+ ModeFile { id: xboxFile; path: root.dir + "/status.xbox" }
}