Xubuntu: Easily Switch Keyboard Layout

Xubuntu (Ubuntu Linux’s XFCE based flavor) does not come with any graphical utility to switch keyboard layouts. There is a little XKB plugin that you can add to your XFCE panel but it only shows the layout in use. It does not provide an interface to add keyboard layouts neither it allows you to set keyboard shortcuts for switching between layouts. It doesn’t mean that you can not use different keyboard layouts in Xubuntu; the functionality is there waiting for someone to build a tool around it. Untill then, we will have to manually set our keyboard layouts and here is how to do this.

Create a file in /usr/bin/

gksudo "mousepad /usr/bin/fixkeyboard"

Add following lines in this file. I am using US and PK layouts in this example, please change it to the keyboard layouts you want to use. Also note that this example sets xkb option to change groups when both alt keys are pressed together.

setxkbmap -option grp:switch,grp:alts_toggle us,pk

Save the file and exit.

Go to Applications > Settings > Autostarted Applications and click the Add button. In the Name feild type fixkeyboard and in the Command feild type /usr/bin/fixkeyboard press OK and then Close.

You are done. Now whenever you log on to your XFCE session you will be able to switch keyboard layouts by pressing both Alt keys together. If you don’t like the both Alt keys combination then you can try other group switch combinations. Replace alts_toggle in fixkeyboard file with one of the following options:


Country flags for XFCE xkb plugin are located in /usr/share/xfce4/xkb/flags/. If your country’s flag is missing you can add it there, the file should be in png format and 60 x 40 pixels.

21 thoughts on “Xubuntu: Easily Switch Keyboard Layout”

  1. In Ubuntu Intrepid Ibex (8.10), go to System > Preferences > Keyboard.

    In the Keyboard Preferences window, select the Layouts tab, press Other Options button and go to the last entry of the popup window, “Layout Switching” and choose from the thousands (grin) of possible combinations. However, the default “Both Alt” intermittently fails on me, so I added “Ctrl-Shift”.

    Hope this helps…

Leave a Reply

Your email address will not be published. Required fields are marked *