Garuda Hyprland doesn't lock the screen and doesn't go sleep in idle

Read that script. For that script to work you need swayidle swayidle(1) — Arch manual pages which is not installed by default. Install it. That command will put your system to sleep if no activity is going on for a set period of time.

To manually go to sleep you can use the nwg-drawer at top and click on suspend but you will notice that it doesn’t lock your screen you have to set appropriate systemd service files for that so that the system locks screen before going to sleep.

Read this archwiki article to understand how to setup sleep hooks, Power management - ArchWiki

here is mine suspend hook for locking screen before sleeping. I haven’t made any resume hook since I didn’t need it. Read archwiki to understand where to place it and how to enable it.

[Unit]
Description=User suspend actions
Before=sleep.target

[Service]
User=%I
Type=forking
Environment=DISPLAY=:1 XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-1
ExecStart=/usr/bin/swaylock -f
ExecStartPost=/usr/bin/sleep 1

[Install]
WantedBy=sleep.target
3 Likes