I3 - Does not lock on suspend

I am using the i3 community edition.
The screen lock works perfectly when the threshold time has passed while the laptop is awake. It works fine after the threshold even while the laptop is suspended.
But, if I suspend the laptop and wake it before the lock threshold time has passed, the screen is not locked. How do I enable this?

1 Like

I'm using systemd unit to lock screen before it goes to suspend/hibernation. Here how it works:
Create file named /etc/systemd/system/i3lock@.service with following content:

Description = Lock screen when going to sleep/suspend/hibernate

ExecStart=/usr/bin/i3exit lock


And enable service:

sudo systemctl enable i3lock@$USER

I forgot, you need "--nofork" option for i3lock. In this example, edit /usr/bin/blurlock and add "-n" option to i3lock like this:
i3lock -n -i /tmp/screenshotblur.png


Worked. Thanks!

The suggested solution almost works for me:

  • I close the lid of my laptop (2011 macbook pro)
  • wait for it to go into hibernation
  • open the lid again

The screen lock is brought up BUT with a 1 to 2 second delay. During this delay I can register keystrokes and operate the cursor as if the pc was unlocked. Do you have any idea why that is?

Here's a service I wrote a little while back, not sure if it will get the job done for you on I3. It's worth giving it a shot.

Create the service file:


With the following contents:

Description=Lock screen upon suspend

ExecStart=/usr/bin/loginctl lock-sessions


Enable the service:

sudo systemctl enable screen-lock.service

I had the same behavior once but I don't remember what caused it.
I'm using betterlockscreen as my config right now and it's working fine.

It didn't work, unfortunately... thanks for the reply though

I kind of half figured that. I only tested it on KDE.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by