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
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.
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):
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.
Open the file
$HOME/.config/xfce4/xfconf/xfce-perchannel-xml/keyboard-layout.xmlEdit it to look similar to this.
Open the file
$HOME/.config/xfce4/panel/xkb-plugin-##.rc(replace ## with appropriate number). Edit it to look similar to this.
Open the file
Edit it accordingly:
XKBMODEL="pc105" XKBLAYOUT="us,fr,ro" XKBVARIANT=",,std" XKBOPTIONS="grp:alt_shift_toggle"
Maybe not all these are necessary to make it work, but just in case...
Xubuntu 12.04. I could get the shortcut remembered using the following actions:
"Settings > Settings Manager > Keyboard > Layout" and uncheck the 'Use system defaults' in order to add new layouts;
Go to the xfce4-xkb-plugin properties and set the short cut (I use Ctrl+Shift);
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.
Another solution is to use Debian's built-in tools :
- Settings -> input method switcher -> set to default
- Remove xfce4-xkb-plugin from the panel
- Run the command:
sudo dpkg-reconfigure keyboard-configurationand choose the needed keyboard layout and hot key for switching
- Add xfce4-xkb-plugin to the panel if you wish
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.
- 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/keyboardand the Xfce language indicator.
sudo nano /etc/default/keyboard
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):
XKBLAYOUT="gb,epo,de,ru" XKBVARIANT=",,,phonetic" XKBOPTIONS="grp:alt_caps_toggle"
XKBLAYOUTsection, 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.
XKBOPTIONSdefines the shortcut for switching between the languages. In this case, it is Alt + Caps Lock.
Save the changes. In Nano, you do this by pressing Ctl + x, followed by y and then hit Enter.
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.
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 ",,"