dot/xinitrc: Invoke `unclutter' in a not-broken way.
[profile] / dot / xinitrc
index 76df3f2..e5bc1b3 100755 (executable)
@@ -110,6 +110,10 @@ fi
 ## Assume X sessions are secure.
 export __mdw_sechost="$(hostname)"
 
+## Tell things that XFCE is in charge.  This is the most desktoppy thing that
+## I run, so it's not entirely wrong.
+: ${XDG_CURRENT_DESKTOP=XFCE}; export XDG_CURRENT_DESKTOP
+
 ## Obtain the screen dimensions.
 case ",$XWIDTH,$XHEIGHT," in
   *,,*) eval $(xscsize -bx; xscsize -bmx) ;;
@@ -135,6 +139,9 @@ initialize () {
   run init xset r rate 500 50
   run init xset m 2 1
 
+  ## Unclutter.
+  if type -t >/dev/null unclutter; then run bgclients unclutter -root -idle 7; fi
+
   ## Key mappings.
   xmodmap $HOME/.xmodmap
   if [ -r $HOME/.xmodmap-local ]; then
@@ -217,9 +224,23 @@ start-clients () {
 
 ## Choose appropriate clients.
 emacs=$(pick_program emacs \
-  emacs24-lucid emacs23-lucid emacs24 emacs23 emacs22 emacs21 emacs)
+  emacs24-lucid emacs23-lucid emacs24 emacs23 emacs22 emacs21 \
+  emacs-lucid emacs)
 term=$(pick_program terminal pterm Eterm xterm)
 
+## If we fell back to an unversioned Emacs binary, then figure out what
+## version it actually is.
+case $emacs in
+  emacs | emacs-lucid)
+    set -- $($emacs --version | head -n1)
+    e_ver=emacs${3%%.*}${emacs#emacs}
+    ;;
+  *)
+    e_ver=$emacs
+    ;;
+esac
+info emacs-version = $e_ver
+
 ## Emacs window measurements.
 ##
 ## e_colsz = width of a column in characters (from `emacs-width' metaconfig)
@@ -239,12 +260,13 @@ term=$(pick_program terminal pterm Eterm xterm)
 ##     So an N-line Emacs frame takes N*e_lineht + e_vextra pixels
 e_colsz=$(mdw-conf emacs-width 77) e_charwd=6
 e_colextra=30 e_colextrachars=5 e_lineht=13
-case "$emacs" in
+case "$e_ver" in
   emacs21 | emacs) e_hextra=34 e_cextra=-2 e_vextra=52 ;;
   emacs22 | emacs23) e_hextra=8 e_cextra=-6 e_vextra=46 ;;
   emacs24) e_hextra=5 e_cextra=-6 e_vextra=42 ;;
   emacs23-lucid) e_hextra=7 e_cextra=-6 e_vextra=48 ;;
   emacs24-lucid) e_hextra=7 e_cextra=-5 e_vextra=48 ;;
+  emacs26-lucid) e_hextra=5 e_cextra=-6 e_vextra=51 ;;
 esac
 e_colwd=$(( e_colsz*e_charwd + e_colextra ))
 e_colchars=$(( e_colsz + e_colextrachars ))
@@ -255,7 +277,14 @@ e_colchars=$(( e_colsz + e_colextrachars ))
 ## t_lineht, t_vextra = height parameters: if the window is N lines high,
 ##     then it will be N*t_lineht + t_vextra pixels high
 case "$term" in
-  pterm) t_wd=504 t_lineht=13 t_vextra=23 geom=-geometry;;
+  pterm)
+    ## The pterm width differs according to whether it's linked against Gtk 2
+    ## or 3.  Let's find out...
+    case $(ldd $(command -v pterm) | grep libgtk) in
+      *libgtk-2* | *libgtk-x11-2*) t_wd=504 ;;
+      *) t_wd=503 ;;
+    esac
+   t_lineht=13 t_vextra=23 geom=-geometry;;
   Eterm) t_wd=504 t_lineht=13 t_vextra=23 geom=-g;;
   xterm) t_wd=507 t_lineht=13 t_vextra=27 geom=-geometry;;
 esac
@@ -292,7 +321,8 @@ declare -i \
 
 start-emacs () {
   GDK_NATIVE_WINDOWS=1 run bgclients noip \
-    $emacs -bg black -geometry ${emacsx}x${emacsy}+${XSCR0_X}+${XSCR0_Y}
+    $emacs -bg black -geometry ${emacsx}x${emacsy}+${XSCR0_X}+${XSCR0_Y} \
+    --mdw-splashy-startup
 }
 
 ## Now place some xterms.
@@ -414,7 +444,7 @@ EOF
        eval "${line#!}"
        ;;
       *)
-       set -- $line
+       eval "set -- $line"
        run bgclients "$@"
        ;;
     esac