swaync: refactor

This commit is contained in:
2024-03-24 08:36:12 +00:00
parent 92d8d42997
commit ce991c8887

View File

@@ -1,6 +1,6 @@
{ pkgs }:
let
systemctl-toggle = pkgs.writeShellApplication {
systemctl-toggle' = pkgs.writeShellApplication {
name = "systemctl-toggle";
runtimeInputs = [
pkgs.systemd
@@ -13,8 +13,9 @@ let
fi
'';
};
systemctl-toggle = "${systemctl-toggle'}/bin/systemctl-toggle";
printIsActive = pkgs.writeShellApplication {
print-is-active' = pkgs.writeShellApplication {
name = "print-is-active";
runtimeInputs = [
pkgs.systemd
@@ -27,13 +28,14 @@ let
fi
'';
};
print-is-active = "${print-is-active'}/bin/print-is-active";
in
{
gps = {
type = "toggle";
label = ""; # GPS services; other icons: gps, ⌖, 🛰, 🌎, 
command = "/run/wrappers/bin/sudo ${systemctl-toggle}/bin/systemctl-toggle eg25-control-gps";
update-command = "${printIsActive}/bin/print-is-active eg25-control-gps.service";
command = "/run/wrappers/bin/sudo ${systemctl-toggle} eg25-control-gps";
update-command = "${print-is-active} eg25-control-gps.service";
active = true;
};
cell-modem = {
@@ -41,64 +43,64 @@ in
label = "󰺐"; # icons: 5g, 📡, 📱, ᯤ, ⚡, , 🌐, 📶, 🗼, 󰀂, , 󰺐, 󰩯
# modem and NetworkManager auto-establishes a connection when powered.
# though some things like `wg-home` VPN tunnel will remain routed over the old interface.
command = "/run/wrappers/bin/sudo ${systemctl-toggle}/bin/systemctl-toggle eg25-control-powered";
update-command = "${printIsActive}/bin/print-is-active eg25-control-powered.service";
command = "/run/wrappers/bin/sudo ${systemctl-toggle} eg25-control-powered";
update-command = "${print-is-active} eg25-control-powered.service";
active = true;
};
vpn = {
type = "toggle";
label = "vpn::hn"; # route all traffic through servo; useful to debug moby's networking
command = "/run/wrappers/bin/sudo ${systemctl-toggle}/bin/systemctl-toggle wg-quick-vpn-servo";
update-command = "${printIsActive}/bin/print-is-active wg-quick-vpn-servo.service";
command = "/run/wrappers/bin/sudo ${systemctl-toggle} wg-quick-vpn-servo";
update-command = "${print-is-active} wg-quick-vpn-servo.service";
active = true;
};
gnome-calls = {
type = "toggle";
label = "SIP";
command = "${systemctl-toggle}/bin/systemctl-toggle --user gnome-calls";
update-command = "${printIsActive}/bin/print-is-active --user gnome-calls";
command = "${systemctl-toggle} --user gnome-calls";
update-command = "${print-is-active} --user gnome-calls";
active = true;
};
geary = {
type = "toggle";
label = "󰇮"; # email (Geary); other icons: ✉, [E], 📧, 󰇮
command = "${systemctl-toggle}/bin/systemctl-toggle --user geary";
update-command = "${printIsActive}/bin/print-is-active --user geary";
command = "${systemctl-toggle} --user geary";
update-command = "${print-is-active} --user geary";
active = true;
};
abaddon = {
type = "toggle";
label = "󰊴"; # Discord chat client; icons: 󰊴, 🎮
command = "${systemctl-toggle}/bin/systemctl-toggle --user abaddon";
update-command = "${printIsActive}/bin/print-is-active --user abaddon";
command = "${systemctl-toggle} --user abaddon";
update-command = "${print-is-active} --user abaddon";
active = true;
};
dissent = {
type = "toggle";
label = "󰊴"; # Discord chat client; icons: 󰊴, 🎮
command = "${systemctl-toggle}/bin/systemctl-toggle --user dissent";
update-command = "${printIsActive}/bin/print-is-active --user dissent";
command = "${systemctl-toggle} --user dissent";
update-command = "${print-is-active} --user dissent";
active = true;
};
signal-desktop = {
type = "toggle";
label = "💬"; # Signal messenger; other icons: 󰍦
command = "${systemctl-toggle}/bin/systemctl-toggle --user signal-desktop";
update-command = "${printIsActive}/bin/print-is-active --user signal-desktop";
command = "${systemctl-toggle} --user signal-desktop";
update-command = "${print-is-active} --user signal-desktop";
active = true;
};
dino = {
type = "toggle";
label = "XMPP"; # XMPP calls (jingle)
command = "${systemctl-toggle}/bin/systemctl-toggle --user dino";
update-command = "${printIsActive}/bin/print-is-active --user dino";
command = "${systemctl-toggle} --user dino";
update-command = "${print-is-active} --user dino";
active = true;
};
fractal = {
type = "toggle";
label = "[m]"; # Matrix messages
command = "${systemctl-toggle}/bin/systemctl-toggle --user fractal";
update-command = "${printIsActive}/bin/print-is-active --user fractal";
command = "${systemctl-toggle} --user fractal";
update-command = "${print-is-active} --user fractal";
active = true;
};
}