Following this answer I've installed xfce - xfce4-xkb-plugin to indicate and switch keyboard layouts in XUbuntu. But it resets all the settings (languages I use and a switch layouts hotkey) every time I reboot. How to make it to remember?


This is a known bug. I use xfce in arch linux and what I do is edit the ~/.config/xfce4/panel/xkb-plugin-##.rc and add a new line or something and it works for some sessions. Another temporary fix may be what #31 suggests

1. Set the desired options in the plugin
2. Copy the ~/.config/xfce4/panel/xkb-plugin-##.rc to some other file e.g. ~/.config/xfce4/panel/goodxkb.rc
3. Add this command to a startup job:

     sh -c "cp ~/.config/xfce4/panel/goodxkb.rc ~/.config/xfce4/panel/xkb-plugin-##.rc && pkill xkb"
    (change the ## to your number)

The pkill part is crucial to reload the plugin and its config.

| improve this answer | |
  • 1
    How do you mean to add to "a startup job"? – Ivan Dec 1 '11 at 0:49
  • add to your xfce autostart jobs in your session management – sagarchalise Dec 1 '11 at 0:58
  • The solution has stopped working! It still helps to issue the command manually (in a terminal after XFCE boot), but the startup job fails to help (while present - I've checked). – Ivan Dec 6 '11 at 17:03

As the best previous answer appears to be commented afterwards by the user as not working anymore, I will give here an updated perfected version of a quite successful workaround. Sorry not to be able to provide a more scientific less empirical approach, I am not an advanced user, just had the luck to get what I want in this case and want to share this, maybe as a temporary patchwork. So, bare with me. I use Xubuntu, maybe some instructions are limited to that.

My solution is this (my case is English-US as default, second French, third Romanian standard - replace accordingly):

  1. Go to Setting Manager > Keyboard > Layout, and set the languages in the preferred order (delete them and add them in order to achieve this). Go to the properties of the xkb plugin and make the same settings in the same order with the same default language.

  2. Open the file $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/keyboard-layout.xml Edit it to look similar to this.

  3. Open the file $HOME/.config/xfce4/panel/xkb-plugin-##.rc (replace ## with appropriate number). Edit it to look similar to this.

  4. Open the file /etc/default/keyboard (as root)

Edit it accordingly:


Maybe not all these are necessary to make it work, but just in case...

| improve this answer | |
  • Thanks! It still works for Xubuntu 14.04, great! ) – Slava Fomin II Jun 4 '14 at 16:04
  • Since xfce migrate to gtk3, there is no more xkb-plugin-##.rc files. All settings are managed by xfconf. – msangel Aug 6 '19 at 6:10

Xubuntu 12.04. I could get the shortcut remembered using the following actions:

  1. "Settings > Settings Manager > Keyboard > Layout" and uncheck the 'Use system defaults' in order to add new layouts;

  2. Go to the xfce4-xkb-plugin properties and set the short cut (I use Ctrl+Shift);

  3. Go back to "Settings > Settings Manager > Keyboard > Layout" and check the 'Use system defaults' (no worries, the keyboards added will be preserved).

This has survived 2 logouts/logins and one reboot, so far.

| improve this answer | |

Another solution is to use Debian's built-in tools :

  1. Settings -> input method switcher -> set to default
  2. Remove xfce4-xkb-plugin from the panel
  3. Run the command: sudo dpkg-reconfigure keyboard-configuration and choose the needed keyboard layout and hot key for switching
  4. Reboot
  5. Add xfce4-xkb-plugin to the panel if you wish
| improve this answer | |
  • good one, but unable to add multiple languages, do I need to report this defect? – msangel Aug 4 '19 at 16:24

Just edit your /etc/default/keyboard the way you want. The Xfce language indicator will then work correctly and the settings will not be forgotten.

  1. Go to Xfce Settings Manager => Keyboard => Layout. Here you have to make sure there is a tick next to "Use System Defaults". If you don't tick this, then you have to make sure that the languages selected here are exactly the same, and in exactly the same order as in /etc/default/keyboard and the Xfce language indicator.
  2. sudo nano /etc/default/keyboard
  3. For example, if you want to be able to switch between English, Esperanto, German and Russian, make the following alterations (leave everything else as it is):


    In the XKBLAYOUT section, make sure that you do not enter any spaces between the languages, otherwise the text will not be displayed correctly in language indicator in the Xfce panel.

    In the above example, the phonetic version of the Russian keyboard is being used, which is defined by the XKBVARIANT. The three commas are in front of the word "phonetic" as they tell the system that no variant is required for the three other preceding languages.

    XKBOPTIONS defines the shortcut for switching between the languages. In this case, it is Alt + Caps Lock.

  4. Save the changes. In Nano, you do this by pressing Ctl + x, followed by y and then hit Enter.

  5. Reboot your computer for the changes to take effect.

For information about what other variables can be placed in the file /etc/default/keyboard, enter the following in the terminal: cat /usr/share/X11/xkb/rules/xorg.lst. Here you can see the language codes, the types of variants, and also the shortcuts that can be used.

The Debian wiki also contains information about configuring the keyboard, and the XKB Configuration Guide is very useful too (it contains some excellent examples).

| improve this answer | |
  • Cannot confirm this will suffice, for I edited other files to. But thanks for the tip. – user47206 Mar 16 '12 at 15:25

add this to autostart(can customize, sample settings from my dotfiles):

xfconf-query -c keyboard-layout -pn /Default/XkbDisable -t 'bool' -s false
xfconf-query -c keyboard-layout -pn /Default/XkbOptions/Group -t 'string' -s "grp:alt_shift_toggle"
xfconf-query -c keyboard-layout -pn /Default/XkbModel -t 'string' -s "chromebook_m_ralt"
xfconf-query -c keyboard-layout -pn /Default/XkbLayout -t 'string' -s "us,ua,ru"
xfconf-query -c keyboard-layout -pn /Default/XkbVariant -t 'string' -s ",,"
| improve this answer | |

Menu -> Settings -> Settings Manager

Session and Startup

Check: Automatically save session on logout

| improve this answer | |
  • 2
    I don't want to save sessions. – Ivan Dec 1 '11 at 0:43
  • to save sessions is not a solution for this – user47206 Mar 16 '12 at 15:36

I resolved this problem by adding on my .bashrc file this line:

setxkbmap -option grp:ctrl_shift_toggle

Everything work well now.

| improve this answer | |
  • 2
    This looks like specifying a language toggling keyboard shortcut but not the languages set. – Ivan Oct 24 '12 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.