swaync: remove unused systemd integrations
it's all s6 now
This commit is contained in:
parent
1b4300dbeb
commit
133c1b3699
|
@ -8,11 +8,11 @@
|
|||
|
||||
{ pkgs }:
|
||||
let
|
||||
serviceButton = svcType: name: label: {
|
||||
serviceButton = name: label: {
|
||||
inherit label;
|
||||
type = "toggle";
|
||||
command = "swaync-service-dispatcher toggle ${svcType} ${name}";
|
||||
update-command = "swaync-service-dispatcher print ${svcType} ${name}";
|
||||
command = "swaync-service-dispatcher toggle ${name}";
|
||||
update-command = "swaync-service-dispatcher print ${name}";
|
||||
active = true;
|
||||
};
|
||||
in
|
||||
|
@ -46,14 +46,14 @@ in
|
|||
# 🇲 𝐌 ₘ m̄ m⃞ m̋⃞ M⃞
|
||||
# - discord
|
||||
# 🎮
|
||||
gps = serviceButton "s6" "eg25-control-gps" "";
|
||||
cell-modem = serviceButton "s6" "eg25-control-powered" "";
|
||||
gps = serviceButton "eg25-control-gps" "";
|
||||
cell-modem = serviceButton "eg25-control-powered" "";
|
||||
|
||||
gnome-calls = serviceButton "s6" "gnome-calls" "";
|
||||
geary = serviceButton "s6" "geary" "";
|
||||
abaddon = serviceButton "s6" "abaddon" " ";
|
||||
dissent = serviceButton "s6" "dissent" " ";
|
||||
signal-desktop = serviceButton "s6" "signal-desktop" "";
|
||||
dino = serviceButton "s6" "dino" "";
|
||||
fractal = serviceButton "s6" "fractal" "[m]";
|
||||
gnome-calls = serviceButton "gnome-calls" "";
|
||||
geary = serviceButton "geary" "";
|
||||
abaddon = serviceButton "abaddon" " ";
|
||||
dissent = serviceButton "dissent" " ";
|
||||
signal-desktop = serviceButton "signal-desktop" "";
|
||||
dino = serviceButton "dino" "";
|
||||
fractal = serviceButton "fractal" "[m]";
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# configuration:
|
||||
# - defaults: /run/current-system/etc/profiles/per-user/colin/etc/xdg/swaync/
|
||||
# - `man 5 swaync`
|
||||
# - view document tree: `GTK_DEBUG=interactive swaync` (`systemctl stop --user swaync` first)
|
||||
# - view document tree: `GTK_DEBUG=interactive swaync` (`s6 stop swaync` first)
|
||||
# - examples:
|
||||
# - thread: <https://github.com/ErikReider/SwayNotificationCenter/discussions/183>
|
||||
# - buttons-grid and menubar: <https://gist.github.com/JannisPetschenka/fb00eec3efea9c7fff8c38a01ce5d507>
|
||||
|
@ -28,7 +28,6 @@ in
|
|||
pkgs = [
|
||||
"s6"
|
||||
"s6-rc"
|
||||
"systemd"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
@ -62,7 +61,7 @@ in
|
|||
default = {};
|
||||
};
|
||||
|
||||
# prevent dbus from automatically activating swaync so i can manage it as a systemd service instead
|
||||
# prevent dbus from automatically activating swaync so i can manage it as a service instead
|
||||
packageUnwrapped = pkgs.rmDbusServices (pkgs.swaynotificationcenter.overrideAttrs (upstream: {
|
||||
version = "0.10.1-unstable-2024-04-16";
|
||||
# toggling the panel on 0.10.1 sometimes causes toggle-buttons to toggle.
|
||||
|
@ -102,23 +101,6 @@ in
|
|||
"/sys/class/backlight"
|
||||
"/sys/devices"
|
||||
];
|
||||
sandbox.extraRuntimePaths = [
|
||||
# systemd/private allows one to `systemctl --user {status,start,stop,...}`
|
||||
# notably, it does *not* allow for `systemd-run` (that's dbus: org.freedesktop.systemd1.Manager.StartTransientUnit).
|
||||
# that doesn't necessarily mean this is entirely safe against privilege escalation though.
|
||||
# TODO: audit the safety of this systemd sandboxing.
|
||||
# few alternatives:
|
||||
# - superd
|
||||
# - simply `xdg-open app://dino`, etc. `pkill` to stop, `pgrep` to query.
|
||||
# - more robust: `xdg-open sane-service://start?service=dino`
|
||||
# - still need `pgrep` to query if it's running, or have the service mark a pid file
|
||||
# - dbus activation for each app
|
||||
"systemd/private"
|
||||
];
|
||||
sandbox.extraConfig = [
|
||||
# systemctl calls seem to require same pid namespace
|
||||
"--sanebox-keep-namespace" "pid"
|
||||
];
|
||||
|
||||
# glib/gio applications support many notification backends ("portal", "gtk", "freedesktop", ...).
|
||||
# swaync implements only the `org.freedesktop.Notifications` dbus interface ("freedesktop"/fdo).
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p s6 -p s6-rc -p systemd
|
||||
#!nix-shell -i bash -p s6 -p s6-rc
|
||||
|
||||
# for default $PATH to take precedence over nix-shell PATH if invoked interactively,
|
||||
# otherwise we invoke a s6-rc which does not know where to find files.
|
||||
export PATH="/etc/profiles/per-user/$(whoami)/bin:/run/current-system/sw/bin:$PATH"
|
||||
|
||||
action="$1"
|
||||
type="$2"
|
||||
service="$3"
|
||||
service="$2"
|
||||
|
||||
log() {
|
||||
if [ -n "$SWAYNC_DEBUG" ]; then
|
||||
|
@ -16,38 +15,17 @@ log() {
|
|||
}
|
||||
|
||||
checkActive() {
|
||||
case "$type" in
|
||||
systemd)
|
||||
systemctl is-active "$service.service" > /dev/null && echo true || echo false
|
||||
;;
|
||||
s6)
|
||||
# simulate a dry-run start. if no actions would be performed, then the service is up.
|
||||
# alternative is s6-svstat, but that doesn't support oneshots
|
||||
test -z "$(s6-rc -n 0 -b start "$service")" && echo true || echo false
|
||||
;;
|
||||
esac
|
||||
}
|
||||
startService() {
|
||||
log "startService: $service"
|
||||
case "$type" in
|
||||
systemd)
|
||||
/run/wrappers/bin/sudo systemctl start "$service"
|
||||
;;
|
||||
s6)
|
||||
s6-rc -b start "$service"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
stopService() {
|
||||
log "stopService: $service"
|
||||
case "$type" in
|
||||
systemd)
|
||||
/run/wrappers/bin/sudo systemctl stop "$service"
|
||||
;;
|
||||
s6)
|
||||
s6-rc -b stop "$service"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
case "$action" in
|
||||
|
|
Loading…
Reference in New Issue
Block a user