sway/hyprland: use inline scripts for idle daemon

This commit is contained in:
Aly Raffauf 2024-05-26 20:22:36 -04:00
parent 978ebba43e
commit 9af4d3f20f
2 changed files with 33 additions and 40 deletions

View file

@ -102,23 +102,26 @@
notifyd = lib.getExe pkgs.mako; notifyd = lib.getExe pkgs.mako;
wallpaperd = "${lib.getExe pkgs.swaybg} -i ${config.alyraffauf.desktop.theme.wallpaper}"; wallpaperd = "${lib.getExe pkgs.swaybg} -i ${config.alyraffauf.desktop.theme.wallpaper}";
logout = lib.getExe pkgs.wlogout; logout = lib.getExe pkgs.wlogout;
# lock = pkgs.hyprlock + "/bin/hyprlock --immediate";
# idled = pkgs.hypridle + "/bin/hypridle";
lock = lib.getExe pkgs.swaylock; lock = lib.getExe pkgs.swaylock;
idled =
if config.alyraffauf.desktop.hyprland.autoSuspend
then ''
${lib.getExe pkgs.swayidle} -w 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 900 '${lib.getExe' pkgs.systemd "systemctl"} suspend' before-sleep '${media} pause' before-sleep '${lock}'
'' idled = pkgs.writeShellScript "hyprland-idled" ''
else '' ${lib.getExe pkgs.swayidle} -w \
${lib.getExe pkgs.swayidle} -w 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' before-sleep '${media} pause' before-sleep '${lock}' \
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' \
${
if config.alyraffauf.desktop.hyprland.autoSuspend
then ''timeout 900 '${lib.getExe' pkgs.systemd "systemctl"} suspend' \''
else ''\''
}
before-sleep '${media} pause' \
before-sleep '${lock}'
'';
hyprnome = lib.getExe inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".hyprnome; hyprnome = lib.getExe inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".hyprnome;
hyprshade = lib.getExe inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".hyprshade;
screenshot = lib.getExe inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".hyprshot; screenshot = lib.getExe inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".hyprshot;
screenshot_folder = "~/pics/screenshots"; screenshot_folder = "~/pics/screenshots";
@ -128,7 +131,7 @@
qt_platform_theme = "gtk2"; qt_platform_theme = "gtk2";
gdk_scale = "1.5"; gdk_scale = "1.5";
in '' in ''
monitor = desc:BOE 0x095F,preferred,auto,1.566667 # lavaridge/fallarbor fw13 glossy display monitor = desc:BOE 0x095F,preferred,auto,1.6 # lavaridge/fallarbor fw13 glossy display
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
monitor = desc:LG Display 0x0569,preferred,auto,1.2 # rustboro monitor = desc:LG Display 0x0569,preferred,auto,1.2 # rustboro
monitor = desc:Samsung Display Corp. 0x4152,preferred,auto,2,transform,0 # petalburg monitor = desc:Samsung Display Corp. 0x4152,preferred,auto,2,transform,0 # petalburg
@ -139,9 +142,7 @@
# 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 "desc:BOE 0x095F,preferred,auto,1.566667" bindl=,switch:off:Lid Switch,exec,hyprctl reload
bindl=,switch:off:Lid Switch,exec,hyprctl keyword monitor "desc:LG Display 0x0569,preferred,auto,1.2"
bindl=,switch:off:Lid Switch,exec,hyprctl keyword monitor "desc:Samsung Display Corp. 0x4152,preferred,auto,2,transform,0"
# unscale XWayland apps # unscale XWayland apps
xwayland { xwayland {

View file

@ -117,29 +117,21 @@
wallpaperd = "${lib.getExe pkgs.swaybg} -i ${config.alyraffauf.desktop.theme.wallpaper}"; wallpaperd = "${lib.getExe pkgs.swaybg} -i ${config.alyraffauf.desktop.theme.wallpaper}";
logout = lib.getExe pkgs.wlogout; logout = lib.getExe pkgs.wlogout;
lock = lib.getExe pkgs.swaylock; lock = lib.getExe pkgs.swaylock;
idled = idled = pkgs.writeShellScript "sway-idled" ''
if config.alyraffauf.desktop.sway.autoSuspend ${lib.getExe pkgs.swayidle} -w \
then '' timeout 240 '${lib.getExe pkgs.brightnessctl} -s set 10' \
${lib.getExe pkgs.swayidle} -w \ resume '${lib.getExe pkgs.brightnessctl} -r' \
timeout 240 '${lib.getExe pkgs.brightnessctl} -s set 10' \ timeout 300 '${lock}' \
resume '${lib.getExe pkgs.brightnessctl} -r' \ timeout 330 '${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} "output * dpms off"' \
timeout 300 '${lock}' \ resume '${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} "output * dpms on"' \
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"' \ if config.alyraffauf.desktop.sway.autoSuspend
timeout 900 '${lib.getExe' pkgs.systemd "systemctl"} suspend' \ then ''timeout 900 '${lib.getExe' pkgs.systemd "systemctl"} suspend' \''
before-sleep '${media} pause' \ else ''\''
before-sleep '${lock}' }
'' before-sleep '${media} pause' \
else '' before-sleep '${lock}'
${lib.getExe pkgs.swayidle} -w \ '';
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"' \
before-sleep '${media} pause' \
before-sleep '${lock}'
'';
screenshot = lib.getExe' pkgs.shotman "shotman"; screenshot = lib.getExe' pkgs.shotman "shotman";
# screenshot_folder = "~/pics/screenshots"; # screenshot_folder = "~/pics/screenshots";