You are not logged in.
So I've been trying to use acpid to launch wlogout when the power button is pressed on Hyprland, and while acpid did catch and managed to execute the script, wlogout are still not being launched.
Here's the script that'll get invoked when the power button is pressed:
#!/bin/sh
export DISPLAY=:1
kitty wlogout -p layer-shell
The script does run when run from the terminal, but when called by acpid, I got this error instead from journalctl:
Sep 19 15:55:12 qtg acpid[19387]: Authorization required, but no authorization protocol specified
Sep 19 15:55:12 qtg acpid[19387]: [262 15:55:12.200476] [glfw error 65544]: X11: Failed to open display :1
Sep 19 15:55:12 qtg acpid[19387]: GLFW initialization failed
Am I missing something from my script? Or am I missing a package?
Last edited by qtg (2023-09-26 09:47:32)
Offline
Why are you using kitty?
Why are you exporting the X11 DISPLAY instead of WAYLAND_DISPLAY ?
Why are you then referencing :1? Is there an X11 server running on :1 at all?
Offline
Have you tried to simply assign a keybinding?
EDIT: Hi and welcome to the forums!
Last edited by dogknowsnx (2023-09-19 09:33:19)
Offline
Have you tried to simply assign a keybinding?
EDIT: Hi and welcome to the forums!
Oh, I completely forgot that I can do that!
Offline
Why are you using kitty?
Why are you exporting the X11 DISPLAY instead of WAYLAND_DISPLAY ?
Why are you then referencing :1? Is there an X11 server running on :1 at all?
1. Because running it without kitty gives an error: "cannot open display: " so I thought running it from kitty would work
2. I tried changing it to WAYLAND_DISPLAY after reading your reply but still got an error about wayland failing to connect to the display. Tried it with ":1" and "wayland-1" which is what $WAYLAND-DISPLAY is set to
3. After reading about it, I can see that $XDISPLAY returns a ":1" so maybe there's one running?
Offline
Are there two wayland sessions? (btw. _underscore_ ./. -dash- matters w/ the variable name)
Sanity check: can you run wlogout in your hyprland session?
You might also have to "sudo -u qtg" this.
Offline
dogknowsnx wrote:Have you tried to simply assign a keybinding?
EDIT: Hi and welcome to the forums!
Oh, I completely forgot that I can do that!
If this has been an X/Y issue and you consider it solved, please edit the title by adding [SOLVED]
(although I'd wager that @seth would like to keep going...)
Offline
Are there two wayland sessions? (btw. _underscore_ ./. -dash- matters w/ the variable name)
Sanity check: can you run wlogout in your hyprland session?
You might also have to "sudo -u qtg" this.
Sorry for the late reply, but yes I can run wlogout and the script just fine from my terminal running on a hyprland session, It just cant be run from the script. Here's the current script:
#!/bin/sh
export WAYLAND_DISPLAY=wayland-1
sudo -u qtg wlogout
WAYLAND_DISPLAY is set to wayland-1 because thats what $WAYLAND_DISPLAY returns, unless thats not where I should be getting that value. Running the script from acpid returns this error:
Sep 21 07:38:21 qtg sudo[29754]: root : PWD=/ ; USER=qtg ; COMMAND=/usr/bin/wlogout
Sep 21 07:38:21 qtg sudo[29754]: pam_unix(sudo:session): session opened for user qtg(uid=1000) by (uid=0)
Sep 21 07:38:21 qtg wlogout[29755]: cannot open display:
Sep 21 07:38:21 qtg sudo[29754]: pam_unix(sudo:session): session closed for user qtg
Offline
sudo -u qtg env WAYLAND_DISPLAY=wayland-1 wlogout
Offline
sudo -u qtg env WAYLAND_DISPLAY=wayland-1 wlogout
still getting the same error
Offline
The only way this makes any sense is that the wayland logout tool is an Xwayland client in which case you'll also have to set DISPLAY and XAUTHORITY - maybe USER
https://gist.github.com/AladW/de1c5676d93d05a5a0e1 demonstrates how to import those variables from a process (xinit) but you can also just hardcode them.
Offline
Hey, sorry for the late response but Im marking this as solved as using the Hyprland keybind already works out of the box. Sorry for the inconvenience
Offline