lahwaacz / sxlock

MIT License
41 stars 21 forks source link

Doesn't work on lid closure, otherwise ok #21

Closed jssilva25 closed 6 years ago

jssilva25 commented 6 years ago

Must say this is my favorite screen locker, after testing many others, very elegant. But I have this problem:

For comparison, slock works as expected on all previous situations but I don't like it. To make the comparison correct, I just edited xflock4, which is called by xfce4-session and xfce4-power-manager, and added an 'x' to turn the call to slock into sxlock. I'm using Xfce 4.12 on Gentoo and, of course xfce4-session /general/LockCommand is empty, lid opening is set not to be handled by logind, it's handled by xfce4-power-manager. All other setting on the xsettings ui are correctly made; after all, slock works correctly. I'm going to switch to slock now, but I really would like to be able to use sxlock, thank you for letting me use it.

lahwaacz commented 6 years ago

Sorry, I have no idea about xfce. What's the problem with logind? You might use a sxlock.service like the one in the readme: https://github.com/lahwaacz/sxlock#hooking-into-systemd-events

jssilva25 commented 6 years ago

Thank you for replying. I tried to insert a call to sxlock in /etc/acpi/actions/lm_lid.sh but this is executed as root and so sxlock wakes-up locked by root, which you don't want. I don't use systemd, I use Gentoo-openrc, I can't use that service. But there might be a way using xss-lock, I'll have to try it. FYI on one of my tests, using xfce4-power-manager launched with debug, sxlock threw the error on the line 382 of sxlock.c: "error: no connected output detected", but I can't reproduce it now. I guess this was when I was using a wrapper script on sxlock, just to ensure it was returning a zero. Reading the debug ouput of xfce4-power-manager, I can tell it is using logind's backend, I jus don't know how it calls it.

lahwaacz commented 6 years ago

Since lm_lid.sh runs as root, surely you can run sxlock in an unprivileged subprocess corresponding to the user running X - you just need to pass correct DISPLAY and probably also XAUTHORITY environment variables. Also note that sxlock needs to run in foreground the whole time the screen is locked, but the ACPI script probably needs to exit before the system can be suspended.

I'm going to close this because I don't think it's an issue in sxlock, but if you find some, feel free to reopen. Also please let me know when you find a working solution.