blob: a7c86eda9104be13e582430498da73eb425bdc54 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!/bin/ash
wt="PVS2 Manager"
readonly wt
moveVm() {
# make sure vmplayer is really on workspace 0
local window windows
windows=$(xdotool search --onlyvisible --class vmplayer)
for window in $windows; do
wmctrl -i -r "$window" -t 0
done
}
moveMgr() {
# make sure mgr is on workspace 1
wmctrl -r "$wt" -t 1
}
getCurrent() {
wmctrl -d | awk '{if ($2 == "*") print $1}'
}
case "$EVENT" in
init)
echo "CHECKED=false"
moveVm
moveMgr
wmctrl -s 0
;;
connected)
echo "VISIBLE=$ISLOCAL"
if [ "$ISLOCAL" = "true" ]; then
moveVm
moveMgr
current=$(getCurrent)
if [ "$current" = "1" ]; then
echo "CHECKED=true"
else
echo "CHECKED=false"
fi
fi
;;
disconnected)
echo "VISIBLE=false"
moveMgr
moveVm
wmctrl -s 0
;;
clicked)
moveMgr
moveVm
# Ignore $CHECKED here as reported by PVS, since the user might have switched desktops manually
current=$(getCurrent)
if [ "$current" = "1" ]; then
wmctrl -s 0
echo "CHECKED=false"
else
wmctrl -a "$wt"
wmctrl -s 1
echo "CHECKED=true"
fi
;;
esac
|