diff options
-rwxr-xr-x | core/modules/qemu/data/opt/openslx/xscreensaver/ungrab.d/virt-viewer | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/core/modules/qemu/data/opt/openslx/xscreensaver/ungrab.d/virt-viewer b/core/modules/qemu/data/opt/openslx/xscreensaver/ungrab.d/virt-viewer new file mode 100755 index 00000000..f4b1b8b4 --- /dev/null +++ b/core/modules/qemu/data/opt/openslx/xscreensaver/ungrab.d/virt-viewer @@ -0,0 +1,31 @@ +#!/bin/ash + +wfile="/run/user/$(id -u)/virt-viewer-wins" + +if [ "$1" = "pre" ]; then + # Find all vmware windows currently visible + WINDOWS=$( xdotool search --onlyvisible --class virt-viewer ) + [ -z "$WINDOWS" ] && exit 0 + 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 + xdotool key "ctrl+alt+shift+super" + 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 |