summaryrefslogtreecommitdiffstats
path: root/core/modules/qemu
diff options
context:
space:
mode:
authorSimon Rettberg2023-02-02 15:47:32 +0100
committerSimon Rettberg2023-02-02 15:47:32 +0100
commit5fa5009e8ac2df48ec63486230c937ad18903bce (patch)
tree56aea4b0dd3be852752dab2cd60e1a5e535260f6 /core/modules/qemu
parent[kiosk-chromium] Adapt to different path name on Debian (diff)
downloadmltk-5fa5009e8ac2df48ec63486230c937ad18903bce.tar.gz
mltk-5fa5009e8ac2df48ec63486230c937ad18903bce.tar.xz
mltk-5fa5009e8ac2df48ec63486230c937ad18903bce.zip
[qemu] Add ungrab script for xscreensaver
Diffstat (limited to 'core/modules/qemu')
-rwxr-xr-xcore/modules/qemu/data/opt/openslx/xscreensaver/ungrab.d/virt-viewer31
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