summaryrefslogtreecommitdiffstats
path: root/core/modules/vmware12
diff options
context:
space:
mode:
authorSimon Rettberg2018-10-17 11:10:49 +0200
committerSimon Rettberg2018-10-17 11:10:49 +0200
commit7a3e38c6a3f6e333b7346099c08dd201c81f5a19 (patch)
tree44dc197c9f6327f693328450362a10e7fe04c4d0 /core/modules/vmware12
parent[vmware12] Fix broken keymap when leaving vm (terminal etc.) (diff)
downloadmltk-7a3e38c6a3f6e333b7346099c08dd201c81f5a19.tar.gz
mltk-7a3e38c6a3f6e333b7346099c08dd201c81f5a19.tar.xz
mltk-7a3e38c6a3f6e333b7346099c08dd201c81f5a19.zip
[xscreensaver/vmware12] Support ungrab hooks, work around idletime reset
vmware ungrab code has to fake mouse cursor movement, resetting PC idle time :-( - Now we can't record the PC idle time the moment the screen saver turned on anymore, since it will be reset at that point.
Diffstat (limited to 'core/modules/vmware12')
-rwxr-xr-xcore/modules/vmware12/data/opt/openslx/xscreensaver/ungrab.d/vmware28
1 files changed, 28 insertions, 0 deletions
diff --git a/core/modules/vmware12/data/opt/openslx/xscreensaver/ungrab.d/vmware b/core/modules/vmware12/data/opt/openslx/xscreensaver/ungrab.d/vmware
new file mode 100755
index 00000000..a71774d3
--- /dev/null
+++ b/core/modules/vmware12/data/opt/openslx/xscreensaver/ungrab.d/vmware
@@ -0,0 +1,28 @@
+#!/bin/ash
+
+wfile="/run/user/$(id -u)/vmwins"
+
+if [ "$1" = "pre" ]; then
+ # Find all vmware windows currently visible
+ WINDOWS=$(xdotool search --onlyvisible --class vmplayer)
+ for window in $WINDOWS; do
+ xdotool windowminimize $window
+ echo "$window" >> "$wfile" # Remember for later
+ done
+ # move mouse pointer around to avoid some problems with ghost clicks
+ # also this resets the idle time durr hurr
+ xdotool mousemove 0 0
+ usleep 10000
+ xdotool mousemove --polar 0 0
+ usleep 10000
+fi
+
+if [ "$1" = "post" ]; then
+ # let's restore vmware
+ WINDOWS=$(sort -u "$wfile")
+ for window in $WINDOWS; do
+ xdotool windowmap $window
+ done
+fi
+
+exit 0