swaylock: fix quoting problem

This commit is contained in:
lelgenio 2023-02-27 16:39:31 -03:00
parent 007895fcb5
commit 17e6f9ecee

View file

@ -2,6 +2,8 @@
let let
inherit (pkgs.uservars) key accent font theme; inherit (pkgs.uservars) key accent font theme;
inherit (theme) color; inherit (theme) color;
asScript = filename: text: toString (pkgs.writeShellScript filename text);
in in
{ {
services.swayidle = { services.swayidle = {
@ -12,10 +14,10 @@ in
} }
{ {
timeout = 1800; timeout = 1800;
command = '' command = asScript "swayidle-suspend-monitors" ''
mpc status | grep "^[playing]" > /dev/null || ${pkgs.sway}/bin/swaymsg "output * dpms off" ${pkgs.mpc_cli}/bin/mpc status | grep "^[playing]" > /dev/null || ${pkgs.sway}/bin/swaymsg "output * dpms off"
''; '';
resumeCommand = '' resumeCommand = asScript "swayidle-wakeup-monitors" ''
${pkgs.sway}/bin/swaymsg "output * dpms on" ${pkgs.sway}/bin/swaymsg "output * dpms on"
''; '';
} }
@ -27,7 +29,9 @@ in
} }
{ {
event = "after-resume"; event = "after-resume";
command = ''swaymsg "output * dpms on"''; command = asScript "after-resume" ''
${pkgs.sway}/bin/swaymsg "output * dpms on"
'';
} }
]; ];
}; };