From e63b2d5262a0c02d290fbedda2d8bd798830b115 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 5 Jun 2023 16:19:00 +0200 Subject: [run-virt] Start fspanel after WM, refine traps in subshell --- .../run-virt-includes/start_windowmanager.inc | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'core/modules/run-virt') 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 2fa77cf8..d283d010 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 @@ -32,12 +32,6 @@ start_wm() { return 1 fi - # run very simple taskbar in case user minimizes VM somehow and doesn't know Alt+Tab - if [ -z "$RUNVIRT_TASKBAR_PID" ] || ! kill -0 "$RUNVIRT_TASKBAR_PID"; then - fspanel & - declare -g RUNVIRT_TASKBAR_PID="$!" - fi - # If it's the same, do nothing if ! is_wm_running "${dm}"; then # start DM determined above @@ -62,7 +56,10 @@ start_wm() { writelog "Starting ${dm} ${OPTS[*]}." declare -g RUNVIRT_DM="${dm}" { - trap '[ -n "$wpid" ] && kill "$wpid"; exit' EXIT TERM INT + trap '' HUP + trap '[ -n "$wpid" ] && kill "$wpid"' EXIT + trap '[ -n "$wpid" ] && kill "$wpid"; exit 5' INT + trap '[ -n "$wpid" ] && kill "$wpid"; exit 6' TERM dc=0 while true; do s="$( date +%s )" @@ -74,12 +71,15 @@ start_wm() { e="$( date +%s )" duration="$(( e - s ))" case "$ret" in - 0|129|130|143) exit 0 ;; + 0|129|130|143) + writelog "WM exited normally" + exit 0 ;; esac if [ "$duration" -ge 3 ]; then dc=0 elif [ "$(( dc++ ))" -gt 5 ]; then notify_user "$RUNVIRT_DM crasht immer wieder." + writelog "$RUNVIRT_DM keeps crashing" exit 1 fi done @@ -87,6 +87,12 @@ start_wm() { declare -g RUNVIRT_DM_PID="$!" fi + # run very simple taskbar in case user minimizes VM somehow and doesn't know Alt+Tab + if [ -z "$RUNVIRT_TASKBAR_PID" ] || ! kill -0 "$RUNVIRT_TASKBAR_PID"; then + ( sleep 1; exec fspanel ) & + declare -g RUNVIRT_TASKBAR_PID="$!" + fi + if isempty HAVE_WM_CLEANUP_HOOK; then add_cleanup stop_wm declare -rg HAVE_WM_CLEANUP_HOOK=yes -- cgit v1.2.3-55-g7522