Permanently set keyboard layout options with setxkbmap in gnome/unity
Solution 1
To prevent gnome resetting keyboard setting in X i use this command:
gsettings set org.gnome.settings-daemon.plugins.keyboard active false
This works for me.
Solution 2
I've been going nuts over this just like you, but with Ubuntu 14.04 (LTS), Xubuntu, xfce 4.12 and xkbd (from xfce goodies). Ctrl+Space to change the keyboard layout worked, but Alt+Shift didn't (modifier-only keys).
Finally managed to make things work-
1. Run ibus-setup (Keyboard Input Methods application).
2. Goto Advanced tab.
3. Check 'Use system keyboard layout'.
4. Click 'Close'
5. Run xfce4-keyboard-settings (Keyboard application).
6. Goto Layout tab.
7. Uncheck 'Use system defaults'
8. Select 'Keyboard model' (typically 'Generic 105-key (Intl) PC' will do)
9. Set 'Change layout option' to your required switching keys combination (typically Alt+Shift will do).
10. Add languages to 'Keyboard layout'.
11. Click 'Close'.
12. Restart the computer
You're done! Use Alt+Shift to change keyboard layout.
Solution 3
I just read this article on screenlocking, which may be related. According to the article, screenlocking has the intended consequence of blocking input devices and manipulating locales. Seems like you have a few options:
- Stop locking the screen, probably this includes the greeting screen as well which serves a similar function
- Use different power management tools
- Stop using ibus for im-switching (Perhaps FCITX?)
- Create a hook for screen unlock events as described here.
There is an interesting discussion of this and related events which can be found on the ubuntu-dev mailing list: https://lists.ubuntu.com/archives/ubuntu-devel/2013-November/037768.html
Solution 4
Workaround by user wof in Ubuntu bug tracker, for Ubuntu 14.10 using gxkb:
https://bugs.launchpad.net/gnome-settings-daemon/+bug/1244090/comments/39
this workaround worked for ubuntu 14.10:
- in Settings->Text entry remove all input sources, leave only english
- install gxkb (layout switcher): sudo apt-get install gxkb
- add gxkb to startup applications via gnome-tweak-tool
- setup gxkb hotkeys in ~/.config/gxkb (default is alt_shift, but in 14.10 it doesn't work. ctrl_shift works ok)
p.s. new version of gxkb has appindicator for ubuntu. can be installed via ppa:zen-root/gxkb-stable
Related videos on Youtube
Abhinav Prakash
Updated on September 18, 2022Comments
-
Abhinav Prakash over 1 year
I am using a Grid where the first column is checkbox. Every row is a folder which can have many other elements to be selected. There could be another folder inside a folder.
Now, when I have to select a element I have to select it one by one. I am not able to understand that how could I make it possible that if I check a folder checkbox, It checks the all selectable elements inside this folder.
Please let me know if more info required.
RemoteSortTreeLoader<BasicModel> loader = new BaseRemoteSortTreeLoader<BasicModel>(proxy, reader) { public boolean hasChildren(BasicModel parent) { //code; } }; TreeStore store = new TreeStore(loader); List<ColumnConfig> columnList = new ArrayList<ColumnConfig>(); CheckBoxSelectionModel checkBoxSelectionModel = new CheckBoxSelectionModel(); columnList.add(checkBoxSelectionModel.getColumn()); ColumnModel columns = new ColumnModel(columnList); EditorTreeGrid grid = new EditorTreeGrid<BasicModel>(store,columns); grid.getSelectionModel().setSelectionMode(SelectionMode.SIMPLE); grid.getSelectionModel().addListener(Events.BeforeSelect, new Listener<SelectionEvent<BasicModel>>() { @Override public void handleEvent(SelectionEvent<BasicModel> event) { if (event.getModel() instanceof SDPTimelineCatalogModel) { event.setCancelled(false); } } // handleEvent } ); grid.getSelectionModel().addSelectionChangedListener( new SelectionChangedListener<BasicModel>() { @Override public void selectionChanged(SelectionChangedEvent<BasicModel> event) { logger.info(" Inside addSelectionChangedListener "); if (event.getSelection().size() == 0) { disableNext(); } else { enableNext(); } } // selectionChanged } );
thanks
-
Admin about 10 yearsHave you tried setting the layout correctly in gnome and then adding the two
setxkbmap
commands to your~/.profile
? That way, they will be run each time you log in and since the same settings are there in Gnome, it should not change anything if it resets. -
Admin about 10 years@terdon it resets even after screen lock. And it resets to "us-only, no switch" state, not to settings defined in
org.gnome.desktop.input-sources
. -
Admin about 10 yearsStrange. Are you sure you are using Gnome and not Unity? Have you tried changing the settings through the normal GUI instead of
dconf-editor
? -
Admin about 10 years@terdon yes, it is unity, but it uses lost of gnome's stuff, like gnome-settings-daemon, which possily resets keymap.
-
Admin about 10 yearsSo, have you tried setting the correct settings from the Unity GUI?
-
Admin about 10 years@terdon unity GUI does not set xkbmap correctly, it uses its own switcher that intercepts keypresses and switch keyboard. It is slow and causes focus to being loss when key is pressed.
-
Admin over 9 yearsSorry, the correct bug should be bugs.launchpad.net/ubuntu/+source/indicator-keyboard/+bug/…
-
Admin over 9 yearsSomething not related with your problem: Which theme is this?
-
Admin over 9 yearsSetting the
xkb-options
field to['altwin:swap_alt_win']
indconf-editor
works in ubuntu 14.10 (unity) to have this xkboption remain after switching the keyboard layout (e.g. english -> french etc). In contrast,setxkbmap -option
does't work for that, this cmd has to be re-issued each time. Not quite sure if this helps your problem - this is just to say that it appears thatorg.gnome.desktop.input-sources
is what matters when the keyboard layout is switched (at least on unity) -
Admin almost 9 years
xmodmap
is possible solution although is certainly reset on restart. This should set it to Dvorakwget -qO- http://pastebin.com/raw.php?i=t2Ndf1Zw | xmodmap -
-
Admin over 8 yearsFound
localectl
but it doesn't persist, either. Did you find a solution that persists after reboot and lock screen? I am looking for a command line, scriptable one myself.
-
-
kolen about 9 years(Not tried it yet)
-
Nickolai Leschov over 8 yearsWhy do you recommend using
xfce4-keyboard-settings
in the question asking for help with gnome/unity, specifically? -
Nickolai Leschov over 8 yearsI tried this on Ubuntu 14.04 and it does nothing. Do you have any explaination re: how this is supposed to work?
-
ndemou over 8 yearsWorks for me in 14.04
-
e18r over 8 yearsE: Unable to locate package gxkb
-
Leonardo Castro over 7 yearsWorks for me in 16.04, after trying everything else.
-
Cnly over 6 yearsThe only method I found working in 17.04.
-
dragon788 over 6 yearsKeep in mind Ubuntu had actually created a unity-settings-daemon for a period of time as well, but now that they are going back to Gnome again this might keep working.