YaLTeR / niri

A scrollable-tiling Wayland compositor.
https://matrix.to/#/#niri:matrix.org
GNU General Public License v3.0
4.12k stars 123 forks source link

Swayidle doesn't work when started with spawn-on-startup #707

Closed stepanzak closed 1 month ago

stepanzak commented 1 month ago

Hi, I have a weird issue with swayidle. I have this line at my niri.kdl: spawn-at-startup "swayidle" "-w" "before-sleep" "'swaylock -f'" I can see the process in Btop: Swayidle in Btop The problem is that it does nothing. When I close the laptop lid or put the system to sleep with systemctl suspend, it doesn't invoke swaylock. When I run pkill swayidle however, and then run the same swayidle comand from a terminal: swayidle -w before-sleep 'swaylock -f' It works! It invokes swaylock before sleep using any method mentioned above.

PS: I remember some time ago having the same problem with some program enabling numlock. It would work from a terminal, but not from niri config. I can't recall it's name sadly...

System Information

YaLTeR commented 1 month ago

Hey, you don't need the extra single quotes around the command since niri already passes it as a single argument. Try:

spawn-at-startup "swayidle" "-w" "before-sleep" "swaylock -f"
stepanzak commented 1 month ago

That was it, thanks a lot!