summaryrefslogtreecommitdiffstats
path: root/remote/modules/pvs2/data/opt/openslx/pvs2/lockDesktop.sh
diff options
context:
space:
mode:
authorChristian Rößler2016-11-04 15:59:25 +0100
committerChristian Rößler2016-11-04 15:59:25 +0100
commit13a665d7317615b472a66ce08fe6c0d126cdea39 (patch)
treed5fd4b5f9879f97b5032fc99951d6d3aafc7e7df /remote/modules/pvs2/data/opt/openslx/pvs2/lockDesktop.sh
parent[run-virt] resolution scripts now detect first connected output device (not o... (diff)
parent[rfs-stage32] Run update-issue after setup_partitions for proper /tmp display (diff)
downloadtm-scripts-13a665d7317615b472a66ce08fe6c0d126cdea39.tar.gz
tm-scripts-13a665d7317615b472a66ce08fe6c0d126cdea39.tar.xz
tm-scripts-13a665d7317615b472a66ce08fe6c0d126cdea39.zip
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
Diffstat (limited to 'remote/modules/pvs2/data/opt/openslx/pvs2/lockDesktop.sh')
-rwxr-xr-xremote/modules/pvs2/data/opt/openslx/pvs2/lockDesktop.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/remote/modules/pvs2/data/opt/openslx/pvs2/lockDesktop.sh b/remote/modules/pvs2/data/opt/openslx/pvs2/lockDesktop.sh
new file mode 100755
index 00000000..c9cfc421
--- /dev/null
+++ b/remote/modules/pvs2/data/opt/openslx/pvs2/lockDesktop.sh
@@ -0,0 +1,25 @@
+#!/bin/ash
+
+# Problem: While any application (e.g. VMware) is holding the mouse and
+# keyboard grab, xscreensaver couldn't grab them, so it will ignore the
+# locking request. Without the keyboard grab, all input would still go
+# to the vmware window below the black screen, which is, you know, bad,
+# since you cannot enter your password to unlock the workstation again.
+
+# So we minimize vmware, lock the screen, and then restore vmware.
+# TODO: Add other virtualizers (vbox, kvm) later if needed.
+WINDOWS=$(xdotool search --class vmplayer)
+for window in $WINDOWS; do
+ xdotool windowminimize $window
+done
+# move mouse pointer to the center of the screen to avoid some problems with ghost clicks
+xdotool mousemove --polar 0 0 --sync
+
+# now actually lock
+xscreensaver-command --lock
+
+# above lock call is blocking, so now xscreensaver should be active - let's restore vmware
+for window in $WINDOWS; do
+ xdotool windowmap $window
+done
+