xorg-save-xkb-config.sh 893 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. ROOT=$1
  3. test -d "$ROOT" || exit 1
  4. eval "$(xprop -root -notype 8s "=1; RULES=\$0; MODEL=\$1; LAYOUT=\$2; VARIANT=\$3; OPTIONS=\$4" _XKB_RULES_NAMES)"
  5. test -z "$_XKB_RULES_NAMES" && exit 1
  6. test -z "$VARIANT" && COMMENT_VARIANT="#"
  7. test -z "$OPTIONS" && COMMENT_OPTIONS="#"
  8. cat << EOF > $ROOT/etc/X11/xorg.conf.d/00-configured-keymap.conf
  9. # This file is generated by $0.
  10. #
  11. # If you want to override settings in this file, edit
  12. # 10-keyboard.conf in the same directory.
  13. Section "InputClass"
  14. Identifier "Configured Keymap"
  15. MatchIsKeyboard "on"
  16. MatchTag "use_configured_keymap"
  17. Option "xkb_rules" "$RULES"
  18. Option "xkb_model" "$MODEL"
  19. Option "xkb_layout" "$LAYOUT"
  20. ${COMMENT_VARIANT}Option "xkb_variant" "$VARIANT"
  21. ${COMMENT_OPTIONS}Option "xkb_options" "$OPTIONS"
  22. EndSection
  23. EOF