Custom screen lock `i3lock` command not working as expected
thomasheartman opened this issue · comments
Hey,
I was playing around with screen locking for my system and desktop environment and tried setting i3lock
as the desktop-environment-screenlock-command
, but it doesn't work properly. Rather than locking the screen, it simply flashes and then nothing happens. I tried with a xscreensaver-command
previously and that worked just fine. Is there an output buffer or anything that I can check to see what's going on? Running the command manually from the shell works just fine.
Do you know what might be going on or how I can trouble shoot this? I'm happy to provide more info if you let me know what you need.
Thanks!
Hi @thomasheartman,
there is no buffer attached to this command. You can easily change that by adding this to your init file:
(defun desktop-environment-lock-screen ()
(interactive)
(start-process-shell-command "lock" "*desktop-environment-lock-screen*" desktop-environment-screenlock-command))
After you evaluate expression or restart Emacs, the content of the *desktop-environment-lock-screen*
buffer will be populated with messages when you lock your screen.
Thanks!
All the output I get is:
Process lock finished
So that's not much to go off. However, If I use shell-command
instead, it works:
(defun desktop-environment-lock-screen ()
(interactive)
(shell-command desktop-environment-screenlock-command))
I'm not sure what's going on or why start-process-shell-command
isn't working as expected. The function docs don't really make it much clearer either. Do you have any idea what's going on?
I've just had a look as well and don't understand the differences between the 2 functions either. If shell-command works better for you, I would accept a PR changing that.
Sure thing! I can do that. I had a little look through the code now; seems start-process-shell-command
is used by three functions (screenshot, screenshot-part, and lock-screen). Would you want me to update the other uses of start-process-shell-command
too (for consistency across the package) or leave them as is (to avoid potentially breaking something else)?
As explained in #24 (comment), the solution is to pass --nofork
to i3lock
.