swaync: split the buttons out of the main config file
This commit is contained in:
parent
1c4ef84ec7
commit
92d8d42997
104
hosts/common/programs/swaynotificationcenter/buttons.nix
Normal file
104
hosts/common/programs/swaynotificationcenter/buttons.nix
Normal file
|
@ -0,0 +1,104 @@
|
|||
{ pkgs }:
|
||||
let
|
||||
systemctl-toggle = pkgs.writeShellApplication {
|
||||
name = "systemctl-toggle";
|
||||
runtimeInputs = [
|
||||
pkgs.systemd
|
||||
];
|
||||
text = ''
|
||||
if systemctl is-active "$@"; then
|
||||
systemctl stop "$@"
|
||||
else
|
||||
systemctl start "$@"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
printIsActive = pkgs.writeShellApplication {
|
||||
name = "print-is-active";
|
||||
runtimeInputs = [
|
||||
pkgs.systemd
|
||||
];
|
||||
text = ''
|
||||
if systemctl is-active "$@"; then
|
||||
echo true
|
||||
else
|
||||
echo false
|
||||
fi
|
||||
'';
|
||||
};
|
||||
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";
|
||||
active = true;
|
||||
};
|
||||
cell-modem = {
|
||||
type = "toggle";
|
||||
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";
|
||||
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";
|
||||
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";
|
||||
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";
|
||||
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";
|
||||
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";
|
||||
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";
|
||||
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";
|
||||
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";
|
||||
active = true;
|
||||
};
|
||||
}
|
|
@ -17,34 +17,8 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.sane.programs.swaynotificationcenter;
|
||||
|
||||
systemctl-toggle = pkgs.writeShellApplication {
|
||||
name = "systemctl-toggle";
|
||||
runtimeInputs = [
|
||||
pkgs.systemd
|
||||
];
|
||||
text = ''
|
||||
if systemctl is-active "$@"; then
|
||||
systemctl stop "$@"
|
||||
else
|
||||
systemctl start "$@"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
printIsActive = pkgs.writeShellApplication {
|
||||
name = "print-is-active";
|
||||
runtimeInputs = [
|
||||
pkgs.systemd
|
||||
];
|
||||
text = ''
|
||||
if systemctl is-active "$@"; then
|
||||
echo true
|
||||
else
|
||||
echo false
|
||||
fi
|
||||
'';
|
||||
};
|
||||
buttons = import ./buttons.nix { inherit pkgs; };
|
||||
scripts = import ./scripts.nix { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
sane.programs.swaynotificationcenter = {
|
||||
|
@ -142,9 +116,7 @@ in
|
|||
hide-on-clear = true; #< hide control center when clicking "clear all"
|
||||
hide-on-action = true;
|
||||
script-fail-notify = true;
|
||||
scripts = import ./scripts.nix {
|
||||
inherit pkgs;
|
||||
};
|
||||
inherit scripts;
|
||||
widgets = [
|
||||
# what to show in the notification center (and in which order).
|
||||
# these are configurable further via `widget-config`.
|
||||
|
@ -168,94 +140,26 @@ in
|
|||
};
|
||||
buttons-grid = {
|
||||
actions =
|
||||
# {
|
||||
# type = "toggle";
|
||||
# label = "feedbackd";
|
||||
# command = "${systemctl-toggle}/bin/systemctl-toggle --user feedbackd";
|
||||
# active = "${pkgs.systemd}/bin/systemctl is-active --user feedbackd.service";
|
||||
# }
|
||||
lib.optionals config.sane.programs.eg25-control.enabled [
|
||||
{
|
||||
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";
|
||||
active = true;
|
||||
}
|
||||
{
|
||||
type = "toggle";
|
||||
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";
|
||||
active = true;
|
||||
}
|
||||
buttons.gps
|
||||
buttons.cell-modem
|
||||
] ++ lib.optionals false [
|
||||
{
|
||||
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";
|
||||
active = true;
|
||||
}
|
||||
buttons.vpn
|
||||
] ++ lib.optionals config.sane.programs.calls.config.autostart [
|
||||
{
|
||||
type = "toggle";
|
||||
label = "SIP";
|
||||
command = "${systemctl-toggle}/bin/systemctl-toggle --user gnome-calls";
|
||||
update-command = "${printIsActive}/bin/print-is-active --user gnome-calls";
|
||||
active = true;
|
||||
}
|
||||
buttons.gnome-calls
|
||||
] ++ lib.optionals config.sane.programs."gnome.geary".enabled [
|
||||
{
|
||||
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";
|
||||
active = true;
|
||||
}
|
||||
buttons.geary
|
||||
# ] ++ lib.optionals config.sane.programs.abaddon.enabled [
|
||||
# # XXX: disabled in favor of dissent: abaddon has troubles auto-connecting at start
|
||||
# {
|
||||
# type = "toggle";
|
||||
# label = ""; # Discord chat client; icons: , 🎮
|
||||
# command = "${systemctl-toggle}/bin/systemctl-toggle --user abaddon";
|
||||
# update-command = "${printIsActive}/bin/print-is-active --user abaddon";
|
||||
# active = true;
|
||||
# }
|
||||
# buttons.abaddon
|
||||
] ++ lib.optionals config.sane.programs.dissent.enabled [
|
||||
{
|
||||
type = "toggle";
|
||||
label = ""; # Discord chat client; icons: , 🎮
|
||||
command = "${systemctl-toggle}/bin/systemctl-toggle --user dissent";
|
||||
update-command = "${printIsActive}/bin/print-is-active --user dissent";
|
||||
active = true;
|
||||
}
|
||||
buttons.dissent
|
||||
] ++ lib.optionals config.sane.programs.signal-desktop.enabled [
|
||||
{
|
||||
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";
|
||||
active = true;
|
||||
}
|
||||
buttons.signal-desktop
|
||||
] ++ lib.optionals config.sane.programs.dino.enabled [
|
||||
{
|
||||
type = "toggle";
|
||||
label = "XMPP"; # XMPP calls (jingle)
|
||||
command = "${systemctl-toggle}/bin/systemctl-toggle --user dino";
|
||||
update-command = "${printIsActive}/bin/print-is-active --user dino";
|
||||
active = true;
|
||||
}
|
||||
buttons.dino
|
||||
] ++ lib.optionals config.sane.programs.fractal.enabled [
|
||||
{
|
||||
type = "toggle";
|
||||
label = "[m]"; # Matrix messages
|
||||
command = "${systemctl-toggle}/bin/systemctl-toggle --user fractal";
|
||||
update-command = "${printIsActive}/bin/print-is-active --user fractal";
|
||||
active = true;
|
||||
}
|
||||
buttons.fractal
|
||||
];
|
||||
};
|
||||
dnd = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user