hyprwm / hypridle

Hyprland's idle daemon
BSD 3-Clause "New" or "Revised" License
320 stars 16 forks source link

/bin/sh: line 1: systemctl suspend: command not found #51

Closed dxwil closed 2 months ago

dxwil commented 2 months ago

All in the title, I don't know why hypridle calls the sh shell, but I can't get in to run systemctl. Swaylock, which is at /usr/local/bin, runs for example.

vaxerski commented 2 months ago

you can run /bin/bash -c "cmd" if the shell matters. What's the problem?

dxwil commented 2 months ago

I don't know, but I can't get systemctl to run from hypridle.

[LOG] wayland done, registering dbus [LOG] Using dbus path /org/freedesktop/login1/session/_31 [LOG] Got dbus .Session [LOG] Got Lock from dbus [LOG] Locking with '/bin/bash -c "systemctl suspend"' [LOG] Executing '/bin/bash -c "systemctl suspend"' [LOG] Process Created with pid 16290 /bin/bash: line 1: /bin/bash -c "systemctl suspend": No such file or directory

My config: `general { lock_cmd = '/bin/bash -c "systemctl suspend"' ignore_dbus_inhibit = false # whether to ignore dbus-sent idle-inhibit requests (used by e.g. firefox or steam) }

listener { timeout = 60 # in seconds on-timeout = hyprctl dispatch dpms off # command to run when timeout has passed on-resume = hyprctl dispatch dpms on # command to run when activity is detected after timeout has fired. }

listener { timeout = 120 on-timeout = '/home/dxwil/.config/hypr/scripts/systemctl_suspend.sh' }`

vaxerski commented 2 months ago

how are you running hypridle? Sounds like PATH being kinda bork. If you use a login manager, and launch hypridle with exec-once, your .bashrc is not sourced.

dxwil commented 2 months ago

So far I've only been running straight from the terminal, so I'm assuming there shouldn't be any problems with how I'm running it.

dxwil commented 2 months ago

If I include the full path of systemctl, I get this /bin/bash: line 1: /usr/bin/systemctl suspend: No such file or directory

Silveere commented 2 months ago

i think the issue is that you are quoting the command in your hypridle config. hyprlang doesn't use quotes as far as i know, so it seems to just be passing them to your shell instead. the error messages you're getting are exactly what you get if you try to do the same thing in bash.

image

change it to lock_cmd = systemctl suspend (without any quoting) and it should work.

dxwil commented 2 months ago

That's it!! Thank you, I don't know how I didn't think of that :)

vaxerski commented 2 months ago

oh yeah I am blind thanks