From 17e6f9ecee7529903390b9596b03b7683d2cc4db Mon Sep 17 00:00:00 2001 From: lelgenio Date: Mon, 27 Feb 2023 16:39:31 -0300 Subject: [PATCH] swaylock: fix quoting problem --- user/sway/swayidle.nix | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/user/sway/swayidle.nix b/user/sway/swayidle.nix index 697a1cc..d21f40c 100644 --- a/user/sway/swayidle.nix +++ b/user/sway/swayidle.nix @@ -2,6 +2,8 @@ let inherit (pkgs.uservars) key accent font theme; inherit (theme) color; + + asScript = filename: text: toString (pkgs.writeShellScript filename text); in { services.swayidle = { @@ -12,10 +14,10 @@ in } { timeout = 1800; - command = '' - mpc status | grep "^[playing]" > /dev/null || ${pkgs.sway}/bin/swaymsg "output * dpms off" + command = asScript "swayidle-suspend-monitors" '' + ${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" ''; } @@ -27,7 +29,9 @@ in } { event = "after-resume"; - command = ''swaymsg "output * dpms on"''; + command = asScript "after-resume" '' + ${pkgs.sway}/bin/swaymsg "output * dpms on" + ''; } ]; };