Suspend with custom action

I know about hw.acpi.lid_switch_state=s3, however I'm disappointed that laptop comes back unlocked. Here is script x11/xautolock invokes. I'd like to run it before S3 state as well. Is it possible?
Code:
dbus-send --session --dest=org.keepassxc.KeePassXC.MainWindow --type=method_call /keepassxc org.keepassxc.MainWindow.lockAllDatabases
i3lock  && sleep 1 && xset dpms force off
 
Have a look at /etc/rc.suspend , it is supposed to add arbitrary commands to be run during suspend.
But take care, it is run under a timeout of few seconds and will just terminate longer running commands.
 
Back
Top