If you only need a dual (also multiple layout are possible) keyboard layout switch which will work on almost any X11 desktop and do not want to install a special plug-in (because you love to have a lightweight installation) then you can try the following solution:
- create a bash script (eg: switch_kbs) like the one bellow (don't forget the chmod +x switch_kbs)
- create a keyboard shortcut (eg: Alt+Shift) that will point to your switch_kbs script
- anytime you want to switch between the keyboard layouts just press the keyboard combination as defined above
setxkbmap should come with X11 so it should be already available on any Linux desktop (I guess).
If you need more than two keyboard layouts then you should change little bit the "case" statement above. In my example the "case" is doing the following:
- when is "se" then move to the next one : "us"
- when is "us" then move to the next one : "se"
- you can continue like this with many other layouts; what is important is that the circle to close somewhere, I mean the "case" to switch between all the layouts in circle.
Edit: what happen if you want to see the keyboard layout (how the keys are arranged on virtual keyboard)? I have a solution to this too:
- we create a shell script that will display a picture on the screen containing the keyboard's layout; for this we'll need x11-misc/gtkdialog
- you can name that script like kblayout-, where xx is the language code (it's just a name, really)
export script='input type="text" />/home/eugen/Pictures/Keyboard_Layout_Swedish.png140170'
Later, you can create a keyboard shortcut that will launch this script whenever you want to see the keyboard layout (eg: Alt+Shift+S):
Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.