2024-03-24 08:33:03 +00:00
|
|
|
{ pkgs }:
|
|
|
|
let
|
2024-03-24 08:36:12 +00:00
|
|
|
systemctl-toggle' = pkgs.writeShellApplication {
|
2024-03-24 08:33:03 +00:00
|
|
|
name = "systemctl-toggle";
|
|
|
|
runtimeInputs = [
|
|
|
|
pkgs.systemd
|
|
|
|
];
|
|
|
|
text = ''
|
|
|
|
if systemctl is-active "$@"; then
|
|
|
|
systemctl stop "$@"
|
|
|
|
else
|
|
|
|
systemctl start "$@"
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
2024-03-24 08:36:12 +00:00
|
|
|
systemctl-toggle = "${systemctl-toggle'}/bin/systemctl-toggle";
|
2024-03-24 08:33:03 +00:00
|
|
|
|
2024-03-24 08:36:12 +00:00
|
|
|
print-is-active' = pkgs.writeShellApplication {
|
2024-03-24 08:33:03 +00:00
|
|
|
name = "print-is-active";
|
|
|
|
runtimeInputs = [
|
|
|
|
pkgs.systemd
|
|
|
|
];
|
|
|
|
text = ''
|
|
|
|
if systemctl is-active "$@"; then
|
|
|
|
echo true
|
|
|
|
else
|
|
|
|
echo false
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
2024-03-24 08:36:12 +00:00
|
|
|
print-is-active = "${print-is-active'}/bin/print-is-active";
|
2024-03-24 08:42:30 +00:00
|
|
|
|
|
|
|
systemServiceButton = name: label: {
|
|
|
|
# XXX: this is surely broken, due to sandboxing/perms
|
|
|
|
inherit label;
|
2024-03-24 08:33:03 +00:00
|
|
|
type = "toggle";
|
2024-03-24 08:42:30 +00:00
|
|
|
command = "/run/wrappers/bin/sudo ${systemctl-toggle} ${name}";
|
|
|
|
update-command = "${print-is-active} ${name}.service";
|
2024-03-24 08:33:03 +00:00
|
|
|
active = true;
|
|
|
|
};
|
2024-03-24 08:42:30 +00:00
|
|
|
userServiceButton = name: label: {
|
|
|
|
inherit label;
|
2024-03-24 08:33:03 +00:00
|
|
|
type = "toggle";
|
2024-03-24 08:42:30 +00:00
|
|
|
command = "${systemctl-toggle} --user ${name}";
|
|
|
|
update-command = "${print-is-active} --user ${name}";
|
2024-03-24 08:33:03 +00:00
|
|
|
active = true;
|
|
|
|
};
|
2024-03-24 08:42:30 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
gps = systemServiceButton "eg25-control-gps" ""; # GPS services; other icons: gps, ⌖, 🛰, 🌎,
|
|
|
|
cell-modem = systemServiceButton "eg25-control-powered" ""; # icons: 5g, 📡, 📱, ᯤ, ⚡, , 🌐, 📶, 🗼, , , ,
|
|
|
|
vpn = systemServiceButton "wg-quick-vpn-servo" "vpn::hn";
|
|
|
|
|
|
|
|
gnome-calls = userServiceButton "gnome-calls" "SIP";
|
|
|
|
geary = userServiceButton "geary" ""; # email (Geary); other icons: ✉, [E], 📧,
|
|
|
|
abaddon = userServiceButton "abaddon" ""; # Discord chat client; icons: , 🎮
|
|
|
|
dissent = userServiceButton "dissent" ""; # Discord chat client; icons: , 🎮
|
|
|
|
signal-desktop = userServiceButton "signal-desktop" "💬"; # Signal messenger; other icons:
|
|
|
|
dino = userServiceButton "dino" "XMPP"; # XMPP calls (jingle)
|
|
|
|
fractal = userServiceButton "fractal" "[m]"; # Matrix messages
|
2024-03-24 08:33:03 +00:00
|
|
|
}
|