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