I wanted a simple way to prevent manually the automatic session lock, but for a limited period, without having to rely on the current window or screen. Just don't lock for a period please, whatever I do. This lets me the time to prepare a tea, then watch my cats doing cat things… and going back to my laptop without having to unlock it.
usage: sway-man-inhibit [command] commands: create Set up the inhibitor. remove Remove the inhibitor. toggle Toggle inhibitor state. status Show the current inhibitor status [default]
bindsym $mod+l exec sway-man-inhibit remove && loginctl lock-session bindsym $mod+Shift+l exec sway-man-inhibit toggle
The following configuration won't lock the session if there is the manual inhibitor, but will remove this inhibitor after 1800s.
timeout 180 'sway-inhibit || loginctl lock-session' timeout 172 'sway-inhibit || swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' timeout 1800 'sway-inhibit remove && notify-send "swayidle" "enabled!"' before-sleep 'loginctl lock-session' lock 'swaylock'
Check if the file
$XDG_RUNTIME_DIR/inhibit.lock exists, if yes print a red