]> gitweb.fluxo.info Git - utils-x11.git/commitdiff
Restore window focus at xlock
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 21 Jun 2020 15:21:37 +0000 (12:21 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 21 Jun 2020 15:21:37 +0000 (12:21 -0300)
xlock

diff --git a/xlock b/xlock
index 3de67ac2bf3a45c06ffaddd489cc8755fdebe26f..87a86dd0cffb0ce5b78cdbbb71b852688f167d9f 100755 (executable)
--- 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