aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/services/Services.js
blob: d9aab80a1cb8a150e1ecdcd1e495d1edae895fb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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 : "" };
    });
}