hyprland/sway: simplify idle script

This commit is contained in:
Aly Raffauf 2024-05-29 12:10:19 -04:00
parent 95f0784531
commit 96fd8a6c17
2 changed files with 11 additions and 9 deletions

View file

@ -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 {

View file

@ -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' \''