This is an old revision of the document!
Initially I did not remove the 'template' tag on purpose. I thought it'd make more sense for this page to be accessible only from the main keyboard article (Setting a keyboard layout). –sycamorex
Removed from the TOC. It's part of the generic keyboard layout article — sycamorex 2012/08/26 15:49
setxkbmap already has many ways for changing layouts (man xkeyboard-config and look at the change layout section)
setxkbmap -layout de,gb setxkbmap -option 'grp:ctrl_alt_toggle'
is particularly useful when you only have two layouts you want to toggle with ctrl-alt
However with this setup setxkbmap will not give the “current” layout. The only way I could find to do that was to use xkblayout-state
The new i3script.sh is: (for i3bar output)
#!/bin/bash i3status --config ~/.i3status.conf | while : do read line LG=$(xkblayout-state print %s) dat=" [{\"name\":\"layout\",\"full_text\":\"$LG\"}" echo "${line/[{/$dat,{}" || exit 1 done
NOTE: the original script that uses #!/bin/sh fails on some systems where the default shell is not bash