]> git.madduck.net Git - etc/xsession.git/blobdiff - .xsession.d/01-xkb

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge branch 'master' of ssh://git.madduck.net/~/git/pub/etc/xsession into xkb
[etc/xsession.git] / .xsession.d / 01-xkb
index 1569982fd7e2892f47f5f5146518c38dac288d85..6d19628ee7764172377cb30fbcbac731b3bad4d6 100644 (file)
@@ -1,41 +1,14 @@
 # load the keyboard definitions
 
-LAYOUT=us
-OPTS=(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