You are not logged in.
I am now using xss-lock and i3lock to lock my screen.
In ~/.i3/config, I have
exec --no-startup-id xss-lock -- i3lock -n -i ~/.i3/lock-screen.pngto run xss-lock with i3lock when starting i3.
In /etc/acpid/handler.sh, I configured acpid to run
loginctl lock-sessionswhen lid is closed.
This way, the laptop screen will be locked when either:
* Keyboard and mouse being idle for some time (configurable by xset)
* Lid is closed
So far so good. However, sometimes I want to lock screen manually when lid is open. So I add this to ~/.i3/config:
bindsym Control+Mod1+l exec --no-startup-id i3lock -d -i ~/.i3/lock-screen.pngThe result of this is, when pressing "Control + Mod1 + L", screen will be locked twice. That is to say, I have to type my password twice to unlock.
Obviously, I can bind "Control + Mod1 + L" to "sudo loginctl lock-sessions" to avoid typing passwords twice, but using "sudo" to lock my own session seems "unneat".
Does anyone know a proper way to do this? Thanks.
Last edited by wzyboy (2014-01-20 15:32:45)
Offline
You can use `xset s activate` (xss-lock is named after the X screen saver extension after all). Then xss-lock will start i3lock (and it won't start it again when you close the lid). To also turn the screen off immediately, you'll want to execute `xset dpms force off` as well. And actually, forcing dpms activates the screen saver as well (see this issue), so binding only the dpms command should do the trick (and I don't expect that to change).
Actually, I'd also expect systemd-logind to allow you to lock your own session, but that's not the case:
$ loginctl lock-session $XDG_SESSION_ID
Failed to issue method call: Access deniedLast edited by Raynman (2014-01-20 15:34:42)
Offline
You can use `xset s activate` (xss-lock is named after the X screen saver extension after all).
Actually, I'd also expect systemd-logind to allow you to lock your own session, but that's not the case:
$ loginctl lock-session $XDG_SESSION_ID Failed to issue method call: Access denied
Thanks! This command is exactly what I am looking for!
I am also confused at the fact that loginctl cannot lock its involker's own session without supeuser privilege. :-(
Offline