swaync: port s6 -> systemd
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
# configuration:
|
# configuration:
|
||||||
# - defaults: /run/current-system/etc/profiles/per-user/colin/etc/xdg/swaync/
|
# - defaults: /run/current-system/etc/profiles/per-user/colin/etc/xdg/swaync/
|
||||||
# - `man 5 swaync`
|
# - `man 5 swaync`
|
||||||
# - view document tree: `GTK_DEBUG=interactive swaync` (`s6 stop swaync` first)
|
# - view document tree: `GTK_DEBUG=interactive swaync` (`systemctl stop swaync` first)
|
||||||
# - examples:
|
# - examples:
|
||||||
# - thread: <https://github.com/ErikReider/SwayNotificationCenter/discussions/183>
|
# - thread: <https://github.com/ErikReider/SwayNotificationCenter/discussions/183>
|
||||||
# - buttons-grid and menubar: <https://gist.github.com/JannisPetschenka/fb00eec3efea9c7fff8c38a01ce5d507>
|
# - buttons-grid and menubar: <https://gist.github.com/JannisPetschenka/fb00eec3efea9c7fff8c38a01ce5d507>
|
||||||
@@ -32,12 +32,15 @@ in
|
|||||||
pname = "swaync-service-dispatcher";
|
pname = "swaync-service-dispatcher";
|
||||||
srcRoot = ./.;
|
srcRoot = ./.;
|
||||||
pkgs = [
|
pkgs = [
|
||||||
"s6"
|
"systemdMinimal"
|
||||||
"s6-rc"
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
sandbox.whitelistS6 = true;
|
sandbox.whitelistSystemctl = true;
|
||||||
sandbox.keepPidsAndProc = true; #< XXX: not sure why, but swaync segfaults under load without this!
|
sandbox.keepPidsAndProc = true; #< XXX: not sure why, but swaync segfaults under load without this!
|
||||||
|
|
||||||
|
suggestedPrograms = [
|
||||||
|
"systemctl"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
sane.programs.swaync-fbcli = {
|
sane.programs.swaync-fbcli = {
|
||||||
@@ -106,7 +109,7 @@ in
|
|||||||
"user" # mpris; portal
|
"user" # mpris; portal
|
||||||
"system" # backlight
|
"system" # backlight
|
||||||
];
|
];
|
||||||
sandbox.whitelistS6 = true;
|
sandbox.whitelistSystemctl = true;
|
||||||
sandbox.whitelistWayland = true;
|
sandbox.whitelistWayland = true;
|
||||||
sandbox.extraPaths = [
|
sandbox.extraPaths = [
|
||||||
"/sys/class/backlight"
|
"/sys/class/backlight"
|
||||||
|
@@ -1,9 +1,5 @@
|
|||||||
#!/usr/bin/env nix-shell
|
#!/usr/bin/env nix-shell
|
||||||
#!nix-shell -i bash -p bash -p s6 -p s6-rc
|
#!nix-shell -i bash -p bash -p systemdMinimal
|
||||||
|
|
||||||
# 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"
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "swaync-service-dispatcher <action> <service>"
|
echo "swaync-service-dispatcher <action> <service>"
|
||||||
@@ -27,22 +23,15 @@ log() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkActive() {
|
checkActive() {
|
||||||
# simulate a dry-run start. if no actions would be performed, then the service is up.
|
systemctl is-active "$service.service" > /dev/null && echo true || echo false
|
||||||
# alternative is s6-svstat, but that doesn't support oneshots
|
|
||||||
local s6Output=$(s6-rc -n 0 -b start "$service")
|
|
||||||
if [ -z "$s6Output" ]; then
|
|
||||||
echo true
|
|
||||||
else
|
|
||||||
echo false
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
startService() {
|
startService() {
|
||||||
log "startService: $service"
|
log "startService: $service"
|
||||||
s6-rc -b start "$service"
|
systemctl start "$service"
|
||||||
}
|
}
|
||||||
stopService() {
|
stopService() {
|
||||||
log "stopService: $service"
|
log "stopService: $service"
|
||||||
s6-rc -b stop "$service"
|
systemctl stop "$service"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
@@ -59,7 +48,7 @@ case "$action" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
# these aren't needed by swaync; just handy because i can never remember how to use s6
|
# these aren't needed by swaync; just handy for testing/debugging
|
||||||
(up)
|
(up)
|
||||||
startService
|
startService
|
||||||
;;
|
;;
|
||||||
|
Reference in New Issue
Block a user