KDE: how do i find and switch current global keyboard layout from CLI?
kde-plasma, layout
Solution
Found a solution:
setxkbmap -print | grep xkb_symbols | awk '{print $4}' | awk -F"+" '{print $2}'
to find out current layout. The following allows to set it:
setxkbmap -layout us
setxkbmap -layout ru
and this toggles it:
if [ `setxkbmap -print | grep xkb_symbols | awk '{print $4}' | awk -F"+" '{print $2}'` = us ] ;then echo "EN"; echo "changing to RU..."; setxkbmap ru ; else echo "RU"; echo "Changing to US..."; setxkbmap us ; fi
If You use gxneur -- it can't cope with all this, but standard Kubuntu layout indicator works fine.
Problem
I'm on KDE and I need to find out and to be able to switch current global keyboard layout in a script. I've made a research on `setxkbmap` - but in this case it's of no help.