aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/services/Services.js
diff options
context:
space:
mode:
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 : "" };
+ });
+}