swaync: port to s6
This commit is contained in:
parent
ddef2d0bfc
commit
86400f45d6
|
@ -1,5 +1,6 @@
|
||||||
{ pkgs }:
|
{ pkgs }:
|
||||||
let
|
let
|
||||||
|
# TODO: move ALL of the scripts into just one helper.
|
||||||
systemctl-toggle' = pkgs.writeShellApplication {
|
systemctl-toggle' = pkgs.writeShellApplication {
|
||||||
name = "systemctl-toggle";
|
name = "systemctl-toggle";
|
||||||
runtimeInputs = [
|
runtimeInputs = [
|
||||||
|
@ -30,6 +31,35 @@ let
|
||||||
};
|
};
|
||||||
print-systemd-active = "${print-systemd-active'}/bin/print-systemd-active";
|
print-systemd-active = "${print-systemd-active'}/bin/print-systemd-active";
|
||||||
|
|
||||||
|
s6-toggle' = pkgs.writeShellApplication {
|
||||||
|
name = "s6-toggle";
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.s6
|
||||||
|
pkgs.s6-rc
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
service="$1"
|
||||||
|
if [ "$(s6-svstat -o wantedup "$XDG_RUNTIME_DIR/s6/live/servicedirs/$service")" = "true" ]; then
|
||||||
|
s6-rc stop "$service"
|
||||||
|
else
|
||||||
|
s6-rc start "$service"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
s6-toggle = "${s6-toggle'}/bin/s6-toggle";
|
||||||
|
|
||||||
|
print-s6-active' = pkgs.writeShellApplication {
|
||||||
|
name = "print-s6-active";
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.s6
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
# s6-svstat's native output is "true"/"false" as expected by swaync
|
||||||
|
s6-svstat -o wantedup "$XDG_RUNTIME_DIR/s6/live/servicedirs/$1"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
print-s6-active = "${print-s6-active'}/bin/print-s6-active";
|
||||||
|
|
||||||
systemServiceButton = name: label: {
|
systemServiceButton = name: label: {
|
||||||
# XXX: this is surely broken, due to sandboxing/perms
|
# XXX: this is surely broken, due to sandboxing/perms
|
||||||
inherit label;
|
inherit label;
|
||||||
|
@ -41,8 +71,8 @@ let
|
||||||
userServiceButton = name: label: {
|
userServiceButton = name: label: {
|
||||||
inherit label;
|
inherit label;
|
||||||
type = "toggle";
|
type = "toggle";
|
||||||
command = "${systemctl-toggle} --user ${name}";
|
command = "${s6-toggle} ${name}";
|
||||||
update-command = "${print-systemd-active} --user ${name}";
|
update-command = "${print-s6-active} ${name}";
|
||||||
active = true;
|
active = true;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
Loading…
Reference in New Issue
Block a user