Selecting different keyboard layouts in Xfce

One of my laptops running Xfce has a British English keyboard. However, I write in Portuguese and Spanish as well and so I need to be able to switch keyboard layouts. Therefore I added the three keyboard layouts by clicking on ‘Applications Menu’ on the Xfce Panel, selecting ‘Settings’ > ‘Keyboard’ and clicking on the ‘Layout’ tab. I also created the file /etc/X11/xorg.conf.d/00-keyboard.conf containing the following:

Section "InputClass"
    Identifier "keyboard"
    MatchIsKeyboard "yes"
    Option "XkbLayout" "gb,br,es"
    Option "XkbVariant" ""
    Option "XkbOptions" "grp:alt_shift_toggle"

As you can probably guess from the XkbOptions option I specified, pressing Alt-Shift enables me to toggle between the keyboard layouts declared in the XkbLayout option (‘gb’ = British keyboard layout; ‘br’ = Brazilian Portuguese keyboard layout; ‘es’ = Spanish keyboard layout). This works fine but I could not tell at a glance which keyboard layout was selected, without typing some text and seeing the result. It would be nice to see an icon on the Panel indicating which keyboard layout is currently selected, in the same way as is possible in KDE and GNOME. It turns out that Xfce has a plugin that does precisely this: Keyboard Layouts, which is available by installing the package xfce4-xkb-plugin. I installed it, right-clicked on the Panel and selected ‘Panel’ > ‘Add New Items…’ > ‘Keyboard Layouts’ to display the plugin’s icon on the Panel. Right-clicking on it and selecting ‘Properties’ allows you to configure the plugin, and I selected ‘Show layout as: image’ so that a flag indicating the current keyboard layout is displayed on the Panel, as shown in the snapshot below.

POWERED BY LINUX badge on Mesh Edge DX laptop

Keyboard layout icon on Xfce Panel

I can either use the keyboard shortcut Alt-Shift to toggle between the three keyboard layouts (in which case the flag changes on the Panel), or I can click on the Keyboard Layouts icon on the Panel and select the desired layout from there instead, as shown in the snapshot below.

POWERED BY LINUX badge on Mesh Edge DX laptop

Selecting keyboard layout from Xfce Panel

About Fitzcarraldo
A Linux user with an interest in all things technical.

3 Responses to Selecting different keyboard layouts in Xfce

  1. Andi says:

    Thank you, this was very helpful (I had the plugin in front of my eyes in Rigo, but didn’t recognize it as the one I was looking for…).

  2. Merci! Ton article m’a rendu service! Clair et précis! (Thx that’s help me alot!). 🙂

  3. samir says:

    Thanks for sharing. Keep it up 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: