From: Silvio Rhatto Date: Sun, 21 Jun 2020 15:21:37 +0000 (-0300) Subject: Restore window focus at xlock X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=b5671afebb3a90405b0fa4829e0fe654a4697928;p=utils-x11.git Restore window focus at xlock --- diff --git a/xlock b/xlock index 3de67ac..87a86dd 100755 --- a/xlock +++ b/xlock @@ -1,8 +1,12 @@ #!/bin/bash # -# Lock the screen using xscreensaver +# Lock the screen of a X11 session # +# Get current focused window +# Some screen lockers such as i3lock loose the window focus +WINDOW="`xdotool getwindowfocus`" + # Using xscreensaver #xscreensaver-command --lock @@ -13,3 +17,6 @@ i3lock -c 1c1c1c # https://askubuntu.com/questions/62858/turn-off-monitor-using-command-line#62861 sleep 1 xset dpms force off + +# Restore focus +xdotool windowfocus $WINDOW