Xubuntu: Easily Switch Keyboard Layout

Ubuntu

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.

#!/bin/bash
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:

alt_shift_toggle
ctrl_shift_toggle
ctrls_toggle

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.

Related Posts

21 thoughts on “Xubuntu: Easily Switch Keyboard Layout

  1. i used the xfce4-xkb-plugin with a french keyboard and always [left-shift][right-shift] just before logging in a xfce session.

    reason for french keyboard: it was free.

  2. Great keyboard layout trick, it worked for me. Just one question: I used alt_shift_toggle instead of alts_toggle, and only left shift-alt works – right keys combination does nothing. Any idea? Thanks

  3. Option “XkbLayout” “us,si,cs”

    Doesn’t work for me…
    After I add another us, or remove one of the three it works out…
    In the former case flag dissapears in one of the layouts.
    Why this happens?

  4. Здравствуйте

    Подскажите,какой вид рекламы эффективнее и почему? раскрутить нужно сайт и объявление с телефонами Менеджеров по продажу.Плизз,помогите советом!!!

    Заранее спасибо всем кто ответит

  5. Nice tip Noumaan. Based on what you posted, I tried editing /etc/X11/xorg.conf directly, and I found that adding a line Option “XkbOptions” “grp:switch,grp:alt_shift_toggle” right after Option “XkbLayout” “us,el” works fine, without the need to create a new file. See if it works for you too.

  6. Caspar you are right it does let you switch between keyboard layouts. But you will have to click on it to change the layout. The method described in this post tells how to change keyboard layout using keyboard shortcuts, a more usable and accessible approach.

  7. Right-click on a panel, select add item and add the keyboard layout switcher.
    (of course
    xfce4-xkb-plugin – xkb layout switch plugin for the Xfce4 panel
    must be installed and you need to add the desired layout in /etc/X11/xorg.conf, e.g.
    Option “XkbLayout” “us, de, fr,ru”
    in the keyboard section lets me (and you too?) switch between these layouts)

  8. This stuff just shows us that xubuntu ain’t getting any attention from developers. hell, what can I say about a distro that won’t install in *vmware* (bug reported, sits there for the latest three alpha / beta relases)? simple: they just didn’t test it… they throwed it out just for the name… no one should be expecting any nice features for xubuntu, a distro that its developers forgot about.
    you would be better off with a distro that likes xfce. vector linux maybe. not xubuntu.. for now, it’s just trash that doesn’t smell yet.

Leave a Reply

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