I am using the i3 tiling windows manager in combination with light-locker to lock the screen.
Light-locker displays a lock message on the locked TTY and shows the password screen on a second TTY.
When closing the notebook lid or executing
systemctl suspend from a terminal emulator, the lock messages appears for a short time, then the system goes into S3 state. On resume, the lock message is visible for a short time again, then light-locker switches to the password entry-TTY, which is the desired behaviour.
The problem occurs when I bind the systemctl command to a specific key via the i3 config file like this:
bindsym s exec --no-startup-id systemctl suspend, mode "default"
When pressing $mod + s, the screen turns black immediately, not showing the lock message.
On resume, the screen turns on, displaying the unlocked desktop for a half second, then the lock messages flashes for the fraction of a second and then the password entry-TTY is shown.
This behaviour is not acceptable, as it exposes the desktop after suspending the computer, even the desktop is only visible for a short time.
My guess is, that when using bash to execute
systemctl suspend, the command takes longer time or sth. like that, making it possible for light-locker to switch to the lock message before the system suspends.
How can I avoid or circumvent the different behaviour of the key binding?