Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wiki help needed regarding locking, #275

Open
FrostKnight opened this issue Jun 23, 2020 · 15 comments
Open

Wiki help needed regarding locking, #275

FrostKnight opened this issue Jun 23, 2020 · 15 comments

Comments

@FrostKnight
Copy link

You could call this a feature request,
I cannot find out how to lock the system via duration or if you close the lid.
I am using openrc and I have access to slock, xautolock and am using i3-wm.
Can you tell me how to do this and/or add it to the wiki for Gentoo and Hyperbola users.
truthfully slock can solve the first issue, but I want a solution to solve both at once if possible.
I like the minimal approach.

@stapelberg
Copy link
Member

The i3 default config recommends:

# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use loginctl lock-session to lock your screen.
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork

This should set up everything automatically for locking on lid.

We should add this example to the i3lock manpage, too.

@FrostKnight
Copy link
Author

Does this work for non-systemd linux distros?

@stapelberg
Copy link
Member

I don’t know. Please let us know when you find out.

@orestisfl
Copy link
Member

https://wiki.archlinux.org/index.php/Session_lock#xss-lock

xss-lock is triggered by one of two things:

systemd events
DPMS

So maybe?

@FrostKnight
Copy link
Author

I checked, and it seems it might not, I wonder if I should ask the gentoo people. :/

I wondered if you guys could add support for another option such as the suckless lock: slock
or for xautolock.

Feel free to let me know.

@stapelberg
Copy link
Member

How are they doing it? Whether or not we’re willing to add anything depends on the code complexity it brings, and how many people it would help.

@FrostKnight
Copy link
Author

I found this on this website: https://tools.suckless.org/slock/
xautolock -time 10 -locker slock
but this only works on inactivity, I wondered if they have any way to lock when it is suspended.
I have seen scripts on the gentoo forums, such as this:
https://forums.gentoo.org/viewtopic-p-8197204.html#8197204
but it is a bit confusing for me to know which one works.
I might just ask someone outside of this git for help and get back to you on how to do so.

@FrostKnight
Copy link
Author

I assume, that its impossible to change the keybindings in i3-wm conf file so that I can lock by Fn+F4?
That's what I use to suspend most of the time, hence why I ask. And yes its a lenovo laptop. An old one too.
That would be another way this issue could be solved I suppose...
Dunno how to make that work though, I have tried and it hasn't allowed me to change the keybindings to that and lock with it. Always errors come up... :/

@orestisfl
Copy link
Member

Fn is not a key visible to software, it modifies the keys on the hardware level. To bind Fn+F4 you have to specifically bind the key that is sent by the keyboard. Use xev -event keyboard to check. E.g. on my laptop Fn+F4 is XF86MonBrightnessUp

@FrostKnight
Copy link
Author

FrostKnight commented Jun 29, 2020

Okay, well can you to make keybindings that let me auto lock the system?
I don't have a clue how to do this. I looked at the wiki, but it wasn't all that clear to me...
Aka something that will let me exec slock or i3lock at keybinding presses.

@orestisfl
Copy link
Member

Open xev -event keyboard, press the key you want to bind, report output here

@FrostKnight
Copy link
Author

FrostKnight commented Jun 29, 2020

The modkey which in my case is Alt and u.
Those are the keys I want to cause slock or i3lock to trigger.

@snprajwal
Copy link

The modkey which in my case is Alt and u.

bindsym Mod1+u exec --no-startup-id i3lock

@ghost
Copy link

ghost commented Nov 1, 2022

xss-lock & xautolock are not an ideal solutions. Caz it doesn't allow screen saver blanking, doesn't allow inhibition, as well as blanking without locking. I recommend disabling all xscreen savers & manually setup xidlehook & xset dpms.

xset s off -dpms
exec --no-startup-id xidlehook \
--detect-sleep \
--not-when-audio \
--not-when-fullscreen \
--timer 180 'xset dpms force standby' '' \
--timer 180 'i3lock' '' \
--timer 360 'systemctl suspend' '' & 

Or if you wanna combine blanking as well as locking, you can do that. Just pipe i3lock & dpms standby in one timer. xidlehook supports infinite timers btw.

Lock possible on manual suspend too.
bindsym <key> exec --no-startup-id i3lock | systemctl suspend

Also when you exit i3, make sure to kill xidlehook, since you don't wanna have multiple instances on re-login.
bindsym <key> exec --no-startup-id pkill xidlehook | i3-msg exit

@KebabLord
Copy link

KebabLord commented Dec 27, 2022

Does this work for non-systemd linux distros?

yes, using xss-lock on my laptop that runs openrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants