diff options
author | Simon Rettberg | 2020-08-17 17:28:03 +0200 |
---|---|---|
committer | Simon Rettberg | 2020-08-17 17:28:03 +0200 |
commit | 25ec385c17c796af34b10128f27a5334ad2d2a7e (patch) | |
tree | 09db9ad4bb13d214cba30db9ea86e087f4488135 | |
parent | [kiosk-chromium] remove weird space (diff) | |
download | mltk-25ec385c17c796af34b10128f27a5334ad2d2a7e.tar.gz mltk-25ec385c17c796af34b10128f27a5334ad2d2a7e.tar.xz mltk-25ec385c17c796af34b10128f27a5334ad2d2a7e.zip |
[run-virt/vmware-common] Use blackbox if > 1 screen
TODO: Add blackbox module
-rw-r--r-- | core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc | 22 | ||||
-rw-r--r-- | core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include | 6 |
2 files changed, 22 insertions, 6 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc index c080be8c..5a219ddb 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc @@ -8,7 +8,7 @@ start_wm() { # Sanity checks unset RUNVIRT_DM - for DM in openbox kwin xfwm4 metacity blackbox twm fvwm2 ; do + for DM in "$@" openbox kwin blackbox; do if type "${DM}" >/dev/null 2>&1 ; then declare -rg RUNVIRT_DM="${DM}" break @@ -34,12 +34,17 @@ start_wm() { OPTS+=( "-replace" "-f" "${TMPDIR}/fvwm" ) ;; esac + stop_wm { + trap '[ -n "$wpid" ] && kill "$wpid"; exit' EXIT TERM INT dc=0 while true; do s="$( date +%s )" - "${RUNVIRT_DM}" "${OPTS[@]}" &> /dev/null - ret="$?" + "${RUNVIRT_DM}" "${OPTS[@]}" &> /dev/null & + wpid=$! + wait + ret=$? + wpid= e="$( date +%s )" duration="$(( e - s ))" case "$ret" in @@ -53,15 +58,20 @@ start_wm() { fi done } & - declare -rg RUNVIRT_DM_PID="$!" - add_cleanup stop_wm + declare -g RUNVIRT_DM_PID="$!" + if isempty HAVE_WM_CLEANUP_HOOK; then + add_cleanup stop_wm + declare -rg HAVE_WM_CLEANUP_HOOK=yes + fi return 0 } stop_wm() { + isempty RUNVIRT_DM_PID && return 0 kill "$RUNVIRT_DM_PID" - usleep 500000 + usleep 100000 kill -9 "$RUNVIRT_DM_PID" + declare -g RUNVIRT_DM_PID= } ## MAIN ## diff --git a/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include b/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include index 33d9de29..548dc97d 100644 --- a/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include +++ b/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include @@ -45,6 +45,12 @@ run_plugin() { # For debugging cp "$VM_RUN_FILE" "/tmp/vmware-last-config" + # If we have multi-screen, try to switch to blackbox, seems the only + # lean WM to handle this properly. + if [ "$DISPLAY_COUNT" -gt 1 ] && command -v blackbox > /dev/null; then + start_wm "blackbox" + fi + # HACK: make the mouse disappear ( local WINDOWS="$(xdotool search --sync --name '.*VMware.*Player.*')" |