the stuff

heads-keymap 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/sh
  2. #
  3. # Copyright (c) 2016-2018 Ivan J. <parazyd@dyne.org>
  4. # See LICENSE file for copyright and license details.
  5. #
  6. # Select a keyboard layout.
  7. kmps="/usr/share/X11/xkb/symbols"
  8. cd "$kmps"
  9. klist="$(find * -type f)"
  10. _feed=""
  11. for i in $klist; do
  12. _feed="${_feed}${i}
  13. "
  14. _name="$(grep 'name\[Group1\]' $i | head -n1 | cut -d'"' -f2)"
  15. _feed="${_feed}${_name}
  16. "
  17. done
  18. cd - >/dev/null
  19. sel_layout() {
  20. yad \
  21. --title="heads keyboard layout" \
  22. --text="<b>Select the keyboard layout</b>
  23. Please choose your prefered keyboard layout by selecting it below.
  24. (Start typing to search)" \
  25. --no-escape \
  26. --borders=40 \
  27. --image="/usr/share/icons/Adwaita/64x64/apps/preferences-desktop-keyboard-symbolic.symbolic.png" \
  28. --image-on-top \
  29. --listen \
  30. --width=360 \
  31. --height=360 \
  32. --fixed \
  33. --button="<b>Accept</b>":0 \
  34. --center \
  35. --list \
  36. --separator="\n" \
  37. --column="Layout Code" \
  38. --column="Layout Name" \
  39. --search-column=1 \
  40. --print-column=1
  41. }
  42. sel=""
  43. while [ -z "$sel" ]; do
  44. sel="$(printf "%s\n" "$_feed" | sel_layout)"
  45. done
  46. #printf "%s\n" "$sel"
  47. setxkbmap -layout "$sel"