From 96fd8a6c173115bf06f5d5839d9b43d6b128c15f Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Wed, 29 May 2024 12:10:19 -0400 Subject: [PATCH] hyprland/sway: simplify idle script --- homeManagerModules/desktop/hyprland/default.nix | 15 ++++++++------- homeManagerModules/desktop/sway/default.nix | 5 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/homeManagerModules/desktop/hyprland/default.nix b/homeManagerModules/desktop/hyprland/default.nix index cc08816b..be44a7a8 100644 --- a/homeManagerModules/desktop/hyprland/default.nix +++ b/homeManagerModules/desktop/hyprland/default.nix @@ -76,6 +76,7 @@ wayland.windowManager.hyprland.package = inputs.hyprland.packages.${pkgs.system}.hyprland; wayland.windowManager.hyprland.extraConfig = let modifier = "SUPER"; + hyprctl = lib.getExe' config.wayland.windowManager.hyprland.package "hyprctl"; # Default apps browser = config.alyraffauf.desktop.defaultApps.webBrowser.exe; @@ -112,11 +113,11 @@ timeout 240 '${lib.getExe pkgs.brightnessctl} -s set 10' \ resume '${lib.getExe pkgs.brightnessctl} -r' \ timeout 300 '${lock}' \ - timeout 330 '${lib.getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms off' \ - resume '${lib.getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms on' \ + timeout 330 '${hyprctl} dispatch dpms off' \ + resume '${hyprctl} dispatch dpms on' \ ${ if config.alyraffauf.desktop.hyprland.autoSuspend - then ''timeout 900 '${lib.getExe' pkgs.systemd "systemctl"} suspend' \'' + then '' timeout 900 'sleep 2 && ${lib.getExe' pkgs.systemd "systemctl"} suspend' \'' else ''\'' } ''; @@ -145,10 +146,10 @@ monitor = desc:LG Electronics LG ULTRAWIDE 311NTAB5M720,preferred,auto,1.25,vrr,2 # mauville # Turn off the internal display when lid is closed. - bindl=,switch:on:Lid Switch,exec,hyprctl keyword monitor "eDP-1, disable" - bindl=,switch:off:Lid Switch,exec,hyprctl keyword monitor "$framework" - bindl=,switch:off:Lid Switch,exec,hyprctl keyword monitor "$t440p" - bindl=,switch:off:Lid Switch,exec,hyprctl keyword monitor "$yoga9i" + bindl=,switch:on:Lid Switch,exec,${hyprctl} keyword monitor "eDP-1, disable" + bindl=,switch:off:Lid Switch,exec,${hyprctl} keyword monitor "$framework" + bindl=,switch:off:Lid Switch,exec,${hyprctl} keyword monitor "$t440p" + bindl=,switch:off:Lid Switch,exec,${hyprctl} keyword monitor "$yoga9i" # unscale XWayland apps xwayland { diff --git a/homeManagerModules/desktop/sway/default.nix b/homeManagerModules/desktop/sway/default.nix index 96b567e9..b2786804 100644 --- a/homeManagerModules/desktop/sway/default.nix +++ b/homeManagerModules/desktop/sway/default.nix @@ -80,6 +80,7 @@ wayland.windowManager.sway.config = let modifier = "Mod4"; + swaymsg = lib.getExe' config.wayland.windowManager.sway.package "swaymsg"; # Default apps browser = config.alyraffauf.desktop.defaultApps.webBrowser.exe; @@ -114,8 +115,8 @@ timeout 240 '${lib.getExe pkgs.brightnessctl} -s set 10' \ resume '${lib.getExe pkgs.brightnessctl} -r' \ timeout 300 '${lock}' \ - timeout 330 '${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} "output * dpms off"' \ - resume '${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} "output * dpms on"' \ + timeout 330 '${swaymsg} "output * dpms off"' \ + resume '${swaymsg} "output * dpms on"' \ ${ if config.alyraffauf.desktop.sway.autoSuspend then ''timeout 900 '${lib.getExe' pkgs.systemd "systemctl"} suspend' \''