X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/9865e424ffb61f8a345080fe92213d4bab807c6e..384f691a301988e46040a164a4a5d3758f62a01b:/dot/xinitrc diff --git a/dot/xinitrc b/dot/xinitrc index 210a76d..72afe36 100755 --- a/dot/xinitrc +++ b/dot/xinitrc @@ -25,6 +25,33 @@ run () { esac } +manage () { + local when=$(date +%s) now + local fail=0 rc report + + while :; do + "$@"; rc=$? + case $rc in + 0) info "manage $1: successful exit"; break ;; + 143) info "manage $1: terminated"; break ;; + esac + now=$(date +%s) + report="rc = $rc" + if (( $now - $when > 5 )); then + fail=0 + else + report="$report, early failure" + fail=$(( $fail + 1 )) + if (( $fail >= 5 )); then + info "manage $1: exit ($report), giving up after $fail failures" + break + fi + fi + info "manage $1: exit ($report), restarting" + when=$now + done +} + ## Program choice pick_program () { local what=$1; shift @@ -117,7 +144,7 @@ case "$wm,$vnc" in esac start-e16 () { - run bginit $wm $wmopts + run bginit manage $wm $wmopts win=nil for i in $(seq 10); do sleep 1 @@ -143,7 +170,7 @@ start-window-manager () { start-$wm $wmopts ;; *) - run bginit $wm $wmopts + run bginit manage $wm $wmopts ;; esac } @@ -179,7 +206,7 @@ start-clients () { ### Main screen layout. ## Choose appropriate clients. -emacs=$(pick_program emacs emacs23 emacs22 emacs21 emacs) +emacs=$(pick_program emacs emacs23 emacs24 emacs22 emacs21 emacs) term=$(pick_program terminal pterm Eterm xterm) ## Emacs window measurements. @@ -194,6 +221,11 @@ case "$emacs" in e_colchars=82 e_cextra=-6 e_lineht=13 e_vextra=46 ;; + emacs24) + e_colwd=492 e_hextra=5 + e_colchars=82 e_cextra=-6 + e_lineht=13 e_vextra=42 + ;; esac ## Terminal window measurements. @@ -228,7 +260,7 @@ declare -i \ start-emacs () { GDK_NATIVE_WINDOWS=1 run bgclients noip \ - $emacs -geometry ${emacsx}x${emacsy}+0+0 + $emacs -bg black -geometry ${emacsx}x${emacsy}+0+0 } ## Now place some xterms. @@ -324,7 +356,7 @@ EOF exec "$0" wait nostart ;; :ask-run) - req "Shell command" .cmd.hist xcatch -FMiscFixed6x13 -- sh -c& + req "Shell command" .cmd.hist xcatch -F"Fixed 13" -- sh -c& ;; :ask-command) req "xinit command" .xinit.hist xatom set XINIT_COMMAND$atomtag&