summaryrefslogtreecommitdiffstats
path: root/core/modules/pvs2
diff options
context:
space:
mode:
authorSimon Rettberg2018-09-06 11:36:20 +0200
committerSimon Rettberg2018-09-06 11:36:20 +0200
commit8f7df289cdbd33a8ecd6a39c95fd09645ff21a24 (patch)
tree05edb7e968c3a9616eb02e9eb82d35b686a3a38f /core/modules/pvs2
parent[gfx-driver] whitelist Intel HD Graphics 6000 for Intel NUC5i5RYB (diff)
downloadmltk-8f7df289cdbd33a8ecd6a39c95fd09645ff21a24.tar.gz
mltk-8f7df289cdbd33a8ecd6a39c95fd09645ff21a24.tar.xz
mltk-8f7df289cdbd33a8ecd6a39c95fd09645ff21a24.zip
[pvs2] Refactor for new addon system
Diffstat (limited to 'core/modules/pvs2')
-rw-r--r--core/modules/pvs2/data/opt/openslx/pvs2/addons/50-lock-desktop7
-rw-r--r--core/modules/pvs2/data/opt/openslx/pvs2/addons/60-switch-manager7
-rw-r--r--core/modules/pvs2/data/opt/openslx/pvs2/lock.svg27
-rwxr-xr-xcore/modules/pvs2/data/opt/openslx/pvs2/lockDesktop.sh2
-rwxr-xr-xcore/modules/pvs2/data/opt/openslx/pvs2/toggleManager.sh67
-rw-r--r--core/modules/pvs2/module.build2
6 files changed, 110 insertions, 2 deletions
diff --git a/core/modules/pvs2/data/opt/openslx/pvs2/addons/50-lock-desktop b/core/modules/pvs2/data/opt/openslx/pvs2/addons/50-lock-desktop
new file mode 100644
index 00000000..bde0f2e7
--- /dev/null
+++ b/core/modules/pvs2/data/opt/openslx/pvs2/addons/50-lock-desktop
@@ -0,0 +1,7 @@
+[General]
+type=button
+exec=/opt/openslx/pvs2/lockDesktop.sh
+icon=/opt/openslx/pvs2/lock.svg
+caption=Sperren
+tooltip=Die Sitzung sperren. Entsperren nur mit Passwort des angemeldeten Benutzers möglich.
+async=true
diff --git a/core/modules/pvs2/data/opt/openslx/pvs2/addons/60-switch-manager b/core/modules/pvs2/data/opt/openslx/pvs2/addons/60-switch-manager
new file mode 100644
index 00000000..3d755005
--- /dev/null
+++ b/core/modules/pvs2/data/opt/openslx/pvs2/addons/60-switch-manager
@@ -0,0 +1,7 @@
+[General]
+type=button
+exec=/opt/openslx/pvs2/toggleManager.sh
+caption=Wechseln
+tooltip=Ansicht zwischen PVS-Manager und Virtueller Maschine wechseln.
+init=true
+connection-events=true
diff --git a/core/modules/pvs2/data/opt/openslx/pvs2/lock.svg b/core/modules/pvs2/data/opt/openslx/pvs2/lock.svg
new file mode 100644
index 00000000..09c45511
--- /dev/null
+++ b/core/modules/pvs2/data/opt/openslx/pvs2/lock.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
+ width="1280.000000pt" height="640.000000pt" viewBox="0 0 1280.000000 640.000000"
+ preserveAspectRatio="xMidYMid meet">
+<g transform="translate(0.000000,640.000000) scale(0.100000,-0.100000)"
+fill="#000000" stroke="none">
+<path d="M2712 5818 c-590 -28 -1160 -244 -1632 -618 -207 -164 -444 -420
+-587 -635 -264 -394 -400 -760 -475 -1270 -17 -117 -17 -538 0 -665 88 -656
+347 -1195 807 -1678 596 -625 1314 -941 2140 -942 891 0 1665 400 2272 1175
+72 92 224 313 264 385 12 22 27 40 31 40 5 0 89 -20 186 -44 410 -103 881
+-208 1137 -255 181 -33 266 -42 348 -39 l79 3 154 319 c85 176 156 321 159
+324 2 2 59 -8 127 -23 68 -14 128 -27 135 -28 6 -1 147 155 313 346 278 321
+304 348 328 343 15 -3 142 -24 282 -47 243 -40 258 -43 315 -78 l60 -37 110 5
+111 6 129 96 c72 52 135 98 141 101 5 4 115 -4 243 -17 l233 -24 74 -68 c40
+-37 136 -127 211 -199 l138 -131 255 58 c219 50 689 147 1378 282 95 19 174
+36 176 38 2 2 103 138 225 302 l221 298 -201 419 c-182 379 -204 420 -225 420
+-19 0 -29 10 -45 43 l-21 44 -187 6 c-102 4 -576 7 -1052 7 -476 0 -1568 3
+-2427 7 l-1562 6 1 151 c0 156 -10 235 -35 285 -22 42 -104 111 -135 112 -152
+9 -499 -99 -1116 -346 -221 -88 -292 -113 -298 -103 -4 7 -41 71 -83 141 -292
+496 -816 978 -1322 1214 -443 208 -887 295 -1380 271z m-548 -2093 c156 -32
+244 -87 347 -214 71 -87 130 -200 161 -308 19 -66 23 -102 23 -233 0 -181 -17
+-259 -88 -394 -257 -496 -885 -596 -1276 -205 -97 98 -158 263 -168 454 -12
+239 60 453 214 632 113 133 307 245 473 273 78 13 238 11 314 -5z"/>
+</g>
+</svg>
diff --git a/core/modules/pvs2/data/opt/openslx/pvs2/lockDesktop.sh b/core/modules/pvs2/data/opt/openslx/pvs2/lockDesktop.sh
index c9cfc421..ccfbbe80 100755
--- a/core/modules/pvs2/data/opt/openslx/pvs2/lockDesktop.sh
+++ b/core/modules/pvs2/data/opt/openslx/pvs2/lockDesktop.sh
@@ -8,7 +8,7 @@
# So we minimize vmware, lock the screen, and then restore vmware.
# TODO: Add other virtualizers (vbox, kvm) later if needed.
-WINDOWS=$(xdotool search --class vmplayer)
+WINDOWS=$(xdotool search --onlyvisible --class vmplayer)
for window in $WINDOWS; do
xdotool windowminimize $window
done
diff --git a/core/modules/pvs2/data/opt/openslx/pvs2/toggleManager.sh b/core/modules/pvs2/data/opt/openslx/pvs2/toggleManager.sh
new file mode 100755
index 00000000..f2749d8b
--- /dev/null
+++ b/core/modules/pvs2/data/opt/openslx/pvs2/toggleManager.sh
@@ -0,0 +1,67 @@
+#!/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}'
+}
+
+# Do this whenever we're triggered
+moveVm
+moveMgr
+ wmctrl -s 0
+
+case "$EVENT" in
+init)
+ echo "CHECKED=false"
+ ;;
+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
+
diff --git a/core/modules/pvs2/module.build b/core/modules/pvs2/module.build
index 454bd522..a1039e7d 100644
--- a/core/modules/pvs2/module.build
+++ b/core/modules/pvs2/module.build
@@ -24,7 +24,7 @@ build() {
mkdir -p "${MODULE_BUILD_DIR}/opt/openslx/pvs2/"
if [ -d "${SRCDIR}/sample_configuration" ]; then
# Do not copy lockDesktop.sh - we ship a modified one
- cp "${SRCDIR}/sample_configuration"/{kb-lock,kb-unlock,switchToManager,switchBack}.sh "${MODULE_BUILD_DIR}/opt/openslx/pvs2/" \
+ cp "${SRCDIR}/sample_configuration"/{kb-lock,kb-unlock}.sh "${MODULE_BUILD_DIR}/opt/openslx/pvs2/" \
|| perror "Could not copy external scripts to '${MODULE_BUILD_DIR}/opt/openslx/pvs2/'!"
chmod +x "${MODULE_BUILD_DIR}/opt/openslx/pvs2"/*.sh \
|| perror "Could not set executable bit for external scripts."