Openbox: Lock & Suspend when laptop lid close

I am using Manjaro Openbox 20.0. I am trying to set up my laptop to be able to lock and suspend when the laptop lid is closed.

Currently, in XFCE Power Manager, I have it set to suspend when laptop lid is closed. And that works fine. But I want it to also lock the screen as well.

I do notice that if I change it from Suspend to Lock screen in the drop down, it does nothing when I close my lid. But I think that is possibly because I do not have xfce4-screensaver installed maybe?

Currently, I have to lock my screen first before closing my laptop lid. Is there a way for it to execute i3lock -i /usr/share/backgrounds/lsbackground.png before suspending when I close my laptop lid?

I don't use those features - but a systemd service unit could handle the task

Rename one of the wifi suspend units and change the command to your screen locker.
:point_down:

1 Like

There are already at least 3 services for screen lockers listed on my systemd thread.

Check the one here for the I3 screen locker:

3 Likes

Glad that helped.

You've been around the forum a long time @realmain. I thought you'd know about that systemd thread by now. It's been ongoing for quite a while.

Cheers. :beers:

1 Like

Somehow I've totally missed your systemd thread, but now I have it bookmarked. LOTS of useful stuff in there :slight_smile:

1 Like

Forum kindly sponsored by