blob: 2d9f3320264f74db0d6c4a7d3e8dc94ee2d2950c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/bin/ash
wfile="/run/user/$(id -u)/vmwins"
if [ "$1" = "pre" ]; then
# Find all VirtualBox windows currently visible
WINDOWS="$( xdotool search --onlyvisible --class VirtualBoxVM )"
[ -z "$WINDOWS" ] && exit 0
for window in $WINDOWS; do
# minimize doesn't work for virtualbox...
xdotool windowunmap --sync $window
echo "$window" >> "$wfile" # Remember for later
done
# move mouse pointer around to avoid some problems with ghost clicks
xdotool mousemove --sync 0 0
usleep 10000
xdotool mousemove --polar 0 0
usleep 10000
fi
if [ "$1" = "post" ]; then
# let's restore the windows
WINDOWS="$( sort -u "$wfile" )"
for window in $WINDOWS; do
xdotool windowmap $window
done
rm -f -- "$wfile"
fi
exit 0
|