X-Git-Url: https://git.madduck.net/etc/xsession.git/blobdiff_plain/085bf505447f79db478e369229bceacdbd317a85..a50877b07e4973e723e8264339af8d42046feeab:/.xsession.d/01-xkb?ds=inline diff --git a/.xsession.d/01-xkb b/.xsession.d/01-xkb index 0e50c36..6d19628 100644 --- a/.xsession.d/01-xkb +++ b/.xsession.d/01-xkb @@ -1,41 +1,14 @@ # load the keyboard definitions -LAYOUT=us -OPTS=(madduck:mode_switch madduck:group2_intl madduck:caps_mod4) +XKBDIR="$HOME/.xkb" +#XKBMAPFILE="$XKBDIR/keymap/${(%):-%M}" +XKBMAPFILE="$XKBDIR/keymap/$(hostname --fqdn)" +[[ -r "$XKBMAPFILE" ]] || XKBMAPFILE="${XKBMAPFILE%/*}/defaul" -is_thinkpad() { - case "${(%):-%m}" in - lapse) return 0;; - *) return 1;; - esac -} +info "loading keymap from $XKBMAPFILE" -load_keymap() { - local xkbdir; xkbdir=$HOME/.xkb - local model; model="$1"; shift - local layout; layout="$1"; shift +xkbcomp -I"$XKBDIR" "$XKBMAPFILE" "${DISPLAY%%.*}" - local args; args="-I -I$xkbdir -model $model -layout $layout -option" - args="$args -option ${(j: -option :)@}" - - info "running setxkbmap with args: $args" - local tmpfile; tmpfile="$(tempfile -p kbmap)" - trap "rm -f $tmpfile" EXIT - eval setxkbmap $args -print >| "$tmpfile" - info keymap setting follows: - cat "$tmpfile" >&2 - xkbcomp -I$HOME/.xkb "$tmpfile" ${DISPLAY%%.*} -} - -if is_thinkpad; then - info "loading keymap for thinkpad…" - load_keymap thinkpad us ${(z)OPTS} -else - info "loading pc104 keymap…" - load_keymap pc104 us ${(z)OPTS} -fi - -unset OPTS -unset LAYOUT +unset XKBDIR XKBMAPFILE # vim:ft=zsh