You are not logged in.
Thanks in advance for any help. I'm having a difficult time figuring out how to make my computer lock after being idle. I have Arch Linux and i3 window manager.
So far I have created /etc/systemd/system/i3lock@.service with this content:
1 [Unit]
2 Description=User suspend actions
3 Before=sleep.target
4
5 [Service]
6 User=%I
7 Type=forking
8 Environment=DISPLAY=:0
9 ExecStart=/usr/bin/i3lock -ef -c ffffff
10 ExecStartPost=/usr/bin/sleep 1
11
12 [Install]
13 WantedBy=sleep.target
I enabled it and it works when I close the lod of my laptop. However, I also want to lock the computer after idle. What's happening right now is that the computer goes to sleep after being idle but I can just press any button and I'm back in my session as if it were never idle (don't have to enter a password)
So, can anyone tell me if what I did to lock my computer when the lid closes is a typical or standard way of locking my computer when using Arch & i3? Also, can anyone tell me how I can tell my computer to lock when it's idle for x minutes instead of just sleeping?
Last edited by mattjg908 (2021-03-06 22:13:48)
Offline
https://wiki.archlinux.org/index.php/Se … k#xss-lock
xss-lock or xautolock
Offline
Thanks for the reply Seth! So I:
- $ sudo pacman -S xautolock
- vi ~/.config/i3/config/lock.sh
- add a line, `exec --no-startup-id xautolock -time 5 -locker 'lock.sh'`, save & reload i3
Works like a charm, thanks again!
Offline
Cool.
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline
thanks I will do that but wondered if you could give me a little more help. The command I pasted above locks the screen every 5 minutes, not after minutes of inactivity. Any thoughts?
I was in a text edior and not using a mouse so I guess it's not detecting key presses. Well anyway I'm going Google around as the general idea seems to have been satisfied- thanks again for the help.
Last edited by mattjg908 (2021-03-06 22:04:16)
Offline
Define "inactivity". Or rather your activity to prevent it (eg. moving the mouse or typing on the keyboard?)
Looking at the command, is ~/.config/i3/config in your $PATH? Ie. are you sure it's xautolock that triggers this at all?
Key presses should™ count, bu I'm not sure whether _NET_WM_USER_TIME updates are relevant.
Last edited by seth (2021-03-06 22:15:53)
Offline
thanks for the follow-up Seth. I updated the title of this post to include [resolved ] but is there some way to mark you as the resolver?
In response to your questions:
- I define activity as not touching the mouse nor keyboard nor (un)plugging peripheries
- Opened VIM and was editing a file and the screen locked. However, I restarted i3 and this doesn't seem to happen any more ![]()
- ~/.config/i3/config isn't in my path but the command I put in there is (/usr/local/bin/lock.sh) and my i3 configs do work so I'm not sure how it works but that config file is loaded and does have an effect on my i3
- great point! No, I'm not sure xautolock is/was triggering it
Thanks again for the follow-up questions! I did reload my i3 and ti seems to be working as intended so I think this is fully resolved. I really appreciate the help!
Last edited by mattjg908 (2021-03-06 22:21:37)
Offline
but is there some way to mark you as the resolver?
No, and it's not required or relevant either. The indicator is really just for others, not my ego ![]()
I restarted i3 and this doesn't seem to happen any more
We'll then assume a heisenbug. Feel free to revisit the topic in case the behavior re-appears as non-deterministic.
Offline
cool, well I have to say I am loving Arch and I do appreciate the forum's help ![]()
Have a great weekend
Offline