4

I use alt-shift to switch between keyboard layouts in Ubuntu 14.04. I have 3 languages enabled, but I use one of them much less often.

How could I make alt-shift skip the rarely used language(s)?

2
  • I need the same! KDE (plasma 5 I think, I couldn't find a reference) has a feature that allows one to control which languages you change with the keyboard shortcut and which just by the mouse. It would be awesome to see such a feature in Unity one day!
    – MakisH
    Nov 3, 2016 at 10:07
  • I solved my need for multiple languages using the "compose key" at the end. So, I still have two layouts (en-US and el-GR), which are very different, but I can also write latin-based languages with the en-US and use the compose key to insert accent marks, or special symbols. E.g. in German, "compose+u+:" gives ü, "compose+s+s" gives ß, etc.
    – MakisH
    Oct 26, 2017 at 21:01

2 Answers 2

1

This is what "switch to previous layout" should do but it does not on Ubuntu. It just doesn't work.

enter image description here

It does work great in OSX. It loops through the layouts you 've used lately(usually two).

0

How could I make alt-shift skip the rarely used language(s)?

I would assume you can not. The system does not count keyboard lay-outs used to determine how often it is used.

Then again it becomes possible if you change the question to ....

How could I skip the rarely used language(s)?

Then the answer would be: by using another key combination and change that key combination to switch between the 2 lay-outs you do want to switch between.

Lay-outs are numbered from 0. So the 1st and 2nd lay-out are activated with respectively...

$ gsettings set org.gnome.desktop.input-sources current 0
$ gsettings set org.gnome.desktop.input-sources current 1

(or "2" if you, in your case, need the 3rd keyboard).

This will take up 2 keys though: you can add one to a key like control + P and the other to control + O. If you want this to be one key you would need to change the 0 in

$ gsettings set org.gnome.desktop.input-sources current 0

to a variable that toggles the 0 to a 1 and a 1 to a 0.


That would be this command:

gsettings set org.gnome.desktop.input-sources current $(($(gsettings get org.gnome.desktop.input-sources sources | grep -Po "'[[:alpha:]]+'\)" | wc -l)-1))

This would allow you to use 1 key and make it a toggle.


Refer to How can I change what keys on my keyboard do? (How can I create custom keyboard commands/shortcuts?) on how to set this. Tweak tools and compiz action plugin would be 2 methods on setting those.

2
  • thanks. 1. I'm not asking for the system to do statistics, I am asking about a way to manually tell which languages should be included in the switch behaviour. 2. Are you suggesting ctrl+O and ctrl+P because there is an inherent problem with capturing alt+shift?
    – Valentas
    Nov 15, 2014 at 19:08
  • 1. as a stated: I do not believe you can from the current methods, you need to create your own method (example included in the answer). 2. No, those 2 bindings are just examples if a toggle does not work (that last command I found on the web). alt+shift is set in keyboard controls as the default switching of all installed keyboards. keeping the defaults and creating your own binding (to me ;) ) seems smarter than altering defaults.
    – Rinzwind
    Nov 15, 2014 at 19:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .