Suspend with custom action

abishai

Aspiring Daemon

Reaction score: 185
Messages: 767

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
 

PMc

Daemon

Reaction score: 676
Messages: 1,357

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.
 
Top