Forum › Forums › New users › New Users and General Questions › Keyboard layout always lost in live › Reply To: Keyboard layout always lost in live
January 27, 2022 at 7:56 am
#76216
Member
Hi, this is not a solution but rather a workaround:
1) Add the below line to ‘~/.desktop-session/startup’:
setxkbmap <primary keyboard>
2) I have a script invoked by an appropriately defined keyboard shortcut:
#!/bin/bash
## Switch xkbmap, alternate between primary and secondary:
primary='us'
seconds='cz_qwerty'
current="$(setxkbmap -query | grep '^layout:' | awk -F: ' { print $2 } ' | xargs)"
if [ "${current}" == "${primary}" ]; then
setxkbmap "${seconds}"
elif [ "${current}" == "${seconds}" ]; then
setxkbmap "${primary}"
else
echo "Current layout [${current}], switching to [${primary}]"
setxkbmap "${primary}"
fi