xorg-save-xkb-config.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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
  24. # We have KDE by default so we should set up the
  25. # layout for that during installation from YALI.
  26. #
  27. # Other desktops can be configured by the user
  28. # themselves (considering they would have enough
  29. # knowledge to browse through repos by then and
  30. # find the package for the DE they need) or by
  31. # those who want to make their own forks based
  32. # on Pisi.
  33. #
  34. # TODO: Track changes on GNOME and Wayland to
  35. # see if they come up with a global configuration
  36. # system like Xorg and tweak this up accordingly.
  37. #
  38. # FIXME: This is way too basic and prone to errors
  39. # pretty much all the time!
  40. cat << EOF > $ROOT/etc/skel/.config/kxkbrc
  41. [Layout]
  42. LayoutList=$LAYOUT
  43. EOF