aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/services/Services.js
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-18 17:04:57 +0100
committerDanilo M. <danix@danix.xyz>2026-11-18 17:04:57 +0100
commite55c1f32b383c53d12dc7c2b3c5e2e6ccb146cdc (patch)
treefee3f3ced727f01c7bc630418a6e0b47d347df40 /desktop/modules/services/Services.js
parent44f947c642fe842fae80c7407399265aa47e9909 (diff)
downloadquickshell-e55c1f32b383c53d12dc7c2b3c5e2e6ccb146cdc.tar.gz
quickshell-e55c1f32b383c53d12dc7c2b3c5e2e6ccb146cdc.zip
feat(services): one drawer page to start, stop and restart services
Running things is a runtime operation, so it belongs in the drawer, not the settings window. The drawer's deck-it tile and keystone's Shells page become one Services tile: every quickshell shell, deck-it, and the desktop's long-running daemons (desktop-assistant, cal-notif, tv-mpris, mail-watcher, mail-notify, hypridle, hyprsunset, the polkit agent, notifyd, playerctld, conky and cliphist's watcher), each with Start, Stop and Restart. A daemon's start command is its enabled autostart.lua line, run through hyprctl dispatch hl.dsp.exec_cmd as Autostart's Try does, so conky keeps its workspace rule and no command is copied out of autostart.lua. Services.js holds only the label, the piece of the line that finds it and the pgrep/pkill arguments. Stop waits up to 5s for the process to exit, which hyprsunset needs to free Hyprland's CTM manager. -f patterns bracket a letter so pgrep and pkill never match the sh that runs them. Checked: test_services.js; the pgrep list reports all twelve daemons running; a playerctld restart through the same command came back under a new pid. QML's JS engine has no Array.flatMap, hence the concat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/services/Services.js')
-rw-r--r--desktop/modules/services/Services.js43
1 files changed, 43 insertions, 0 deletions
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 : "" };
+ });
+}