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.package = inputs.hyprland.packages.${pkgs.system}.hyprland;
wayland.windowManager.hyprland.extraConfig = let wayland.windowManager.hyprland.extraConfig = let
modifier = "SUPER"; modifier = "SUPER";
hyprctl = lib.getExe' config.wayland.windowManager.hyprland.package "hyprctl";
# Default apps # Default apps
browser = config.alyraffauf.desktop.defaultApps.webBrowser.exe; browser = config.alyraffauf.desktop.defaultApps.webBrowser.exe;
@ -112,11 +113,11 @@
timeout 240 '${lib.getExe pkgs.brightnessctl} -s set 10' \ timeout 240 '${lib.getExe pkgs.brightnessctl} -s set 10' \
resume '${lib.getExe pkgs.brightnessctl} -r' \ resume '${lib.getExe pkgs.brightnessctl} -r' \
timeout 300 '${lock}' \ timeout 300 '${lock}' \
timeout 330 '${lib.getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms off' \ timeout 330 '${hyprctl} dispatch dpms off' \
resume '${lib.getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms on' \ resume '${hyprctl} dispatch dpms on' \
${ ${
if config.alyraffauf.desktop.hyprland.autoSuspend 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 ''\'' else ''\''
} }
''; '';
@ -145,10 +146,10 @@
monitor = desc:LG Electronics LG ULTRAWIDE 311NTAB5M720,preferred,auto,1.25,vrr,2 # mauville monitor = desc:LG Electronics LG ULTRAWIDE 311NTAB5M720,preferred,auto,1.25,vrr,2 # mauville
# Turn off the internal display when lid is closed. # Turn off the internal display when lid is closed.
bindl=,switch:on:Lid Switch,exec,hyprctl keyword monitor "eDP-1, disable" 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 "$framework"
bindl=,switch:off:Lid Switch,exec,hyprctl keyword monitor "$t440p" bindl=,switch:off:Lid Switch,exec,${hyprctl} keyword monitor "$t440p"
bindl=,switch:off:Lid Switch,exec,hyprctl keyword monitor "$yoga9i" bindl=,switch:off:Lid Switch,exec,${hyprctl} keyword monitor "$yoga9i"
# unscale XWayland apps # unscale XWayland apps
xwayland { xwayland {

View file

@ -80,6 +80,7 @@
wayland.windowManager.sway.config = let wayland.windowManager.sway.config = let
modifier = "Mod4"; modifier = "Mod4";
swaymsg = lib.getExe' config.wayland.windowManager.sway.package "swaymsg";
# Default apps # Default apps
browser = config.alyraffauf.desktop.defaultApps.webBrowser.exe; browser = config.alyraffauf.desktop.defaultApps.webBrowser.exe;
@ -114,8 +115,8 @@
timeout 240 '${lib.getExe pkgs.brightnessctl} -s set 10' \ timeout 240 '${lib.getExe pkgs.brightnessctl} -s set 10' \
resume '${lib.getExe pkgs.brightnessctl} -r' \ resume '${lib.getExe pkgs.brightnessctl} -r' \
timeout 300 '${lock}' \ timeout 300 '${lock}' \
timeout 330 '${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} "output * dpms off"' \ timeout 330 '${swaymsg} "output * dpms off"' \
resume '${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} "output * dpms on"' \ resume '${swaymsg} "output * dpms on"' \
${ ${
if config.alyraffauf.desktop.sway.autoSuspend if config.alyraffauf.desktop.sway.autoSuspend
then ''timeout 900 '${lib.getExe' pkgs.systemd "systemctl"} suspend' \'' then ''timeout 900 '${lib.getExe' pkgs.systemd "systemctl"} suspend' \''