7

I recently upgraded to Ubuntu 13.10. In Ubuntu 12.04, I was able to define a key which, while holding it, temporarily switched to a different keyboard layout. I haven't been able to find a way to get that functionality in 13.10: the only option seems to be to toggle between different layouts using the "Switch to next source" shortcut.

Is there a way to get the "hold a key to temporarily switch to a different keyboard layout" functionality in 13.10?

Jake
  • 171

3 Answers3

2
  • With Gnome 3.6, layout setting method changed. So Ubuntu 13.10 and later, has different behavior then before. This should work well in Gnome (Tested Ubuntu 13.10/14.04).

  • Unity seems not to use xkb-options (Tested it in Ubuntu 13.10/14.04). Even using for example:

    setxkbmap us,ara -option grp:rctrl_switch
    

    It just works for seconds, then it is reseted.

    Edit /usr/share/X11/xkb/symbols/pc, Remove rctrl from ctrl binding:

    //modifier_map Control{ Control_L, Control_R };
    modifier_map Control{ Control_L };
    

    again:

    setxkbmap us,ara -option grp:rctrl_switch
    

    It just works, till it I use change my layout using Super+Space or directly from indicator. So as workaround for Unity, Disable layout toggle shortcuts (layout indicator could removed too) then add a -option grp:..._toggle to setxkbmap .

So for Gnome:

  1. Use dconf-editor → org → gnome → desktop → input-sources

  2. Add setxkbmap options to xkb-options, example:

    ['grp:rctrl_switch']
    

To see all possible options:

more /usr/share/X11/xkb/rules/xorg.lst | grep grp:

enter image description here

user.dz
  • 48,105
  • Are you sure this works? I tried it an it didn't (although I didn't do it exactly as you did) – Seth Feb 09 '14 at 19:30
  • Yeah, It works for me (Ubuntu 14.04). But I will check with fresh one, I have made too many experiments in this installation. So may be some previous tests setxkbmap or xbindkeys have some affects even after I reset my settings. – user.dz Feb 09 '14 at 19:45
  • I tried this on my system and couldn't get it to work, but maybe that's because I'm on 13.10. If it works on 14.04 that would be just as well, though. I'll upgrade soon and let you know. – Jake Feb 09 '14 at 19:47
  • Sorry, I didn't test unity thinking that both use same Gsettings. But it seems that only gnome care about xkb-options. – user.dz Feb 10 '14 at 00:07
1

Please follow these steps:

  1. Select System Settings... from system menu; snap1

  2. Select Keyboard; snap2

  3. Under the tab labelled Typing click Layout Settings; snap3

  4. In the Keyboard settings window, under Shortcuts tab, select Typing. The default for Switch to next source is Super+SPACE; clicking on it will ask you to assign a New Accelerator..., press the desired key combination to change to next Layout (I used Super+L.) and it will be assigned to change to next layout.

    (Then I assigned something similar for Switch to previous source using the same preferred layout, and then began to test them. Switching from the preferred layout to the alternate worked but the reverse did not. Please refer the next step for the fix.) saucy1

  5. In the same window you can select/assign Compose key. The preferred one is Right Alt composeKey

  6. After assigning Super+L for "Switch to next source" using my preferred layout, I changed my keyboard layout to the alternative layout and then assigned the combination to "Switch to previous source" (for which I used Shift+Super+L). Then I tested them, and they work fine.

    The new accelerators for the key combos that I used looks like this: saucy2


Useful Links:

  • How can I enable Compose key?

  • How can I type accentuated characters like ë? alt. How to use compose keys?

    Summary:

    Using compose key, here assigned to Rt. Alt:

    • For ö you press Compose followed by Shify+' then o keys; putting the same other way it's Compose " o or Rt. Alt " o .
    • For ß you press Compose followed by s then s keys.

    (..here you'd have to remember the two character combination)

    You can get the combination for compose key (and Unicode number) with this command in terminal:

    cat /usr/share/X11/locale/en_US.UTF-8/Compose | grep ö
    

    (where ö should be replaced by the character of your choice.)

    which would output something like:

    <Multi_key> <quotedbl> <o>          : "ö"   odiaeresis
    

    (where <Multi_Key> is the Compose (Shift or Shift+Rt.Alt) key, <quotedbl> is the double quote - " i.e. Shift+' and <o> is the lowercase o i.e. o. For upper case Ö use O i.e. Shift+o and instead for the last character of compose combo.)

    Using hexadecimal Unicode character code point:

    • Press (and release) Shift+Ctrl+U, then, while underlined u is displayed, enter the hexadecimal Unicode character code point followed by Return or Space.

    e.g. Ctrl+Shift+u followed by 2 6 3 b and then Return or Space for ☻ .

    (..so this one would require you to remember the Unicode number)

☻ cheers...

rusty
  • 16,327
  • I don't have those options. Is this screenshot taken on 13.10? – Jake Feb 08 '14 at 19:57
  • If I understand correctly, the 13.10 option only allows to switch between layouts, but not to temporarily activate a different layout while some key is pressed. I frequently only need a single letter from the second letter, so switching to that layout, typing the letter, then switching back is quite a hassle. – Jake Feb 09 '14 at 08:04
  • @Downvoter would you mind to justify the -1 ?!? pa-leease!! – rusty Feb 09 '14 at 19:39
  • No, the compose key is for accessing special keys on certain layouts (like é). I didn't downvote the answer, but I can imagine that someone downvoted because it doesn't answer the question (the first part is about pre-13.10, even though the question explicitly mentions 13.10, and the second part is about switching layouts, not temporarily activating one while holding a key). Thanks for your efforts, though! – Jake Feb 09 '14 at 19:45
  • regarding the pre-13.04 I kept that despite updating the answer for 13.10 as it could help others.. sorry that I didn't get you right.. but may I ask the use case for the temporary layout-switch? – rusty Feb 09 '14 at 19:54
  • I'm used to writing on a US layout, but my native language is German. I can write much faster on a US layout, but every now and then I need German letters, so I really liked the option of just holding down the Win key to switch the layout for a single letter (rather than disrupting the flow by switching to German, typing the letter, then switching back). – Jake Feb 09 '14 at 19:59
  • like ä, ü, ö, ß ? (refered wiki:) ..you could do that with compose keys, but yes requires lots of keypresses.. – rusty Feb 09 '14 at 20:14
  • 1
    Yes, exactly. I was just very happy with the solution that was available, and very sad to find that it doesn't seem to work with 13.10. – Jake Feb 09 '14 at 21:00
  • perhaps you've not enabled the compose key (it's disable by default).. please enable it and try again.. I've updated my answer to include that.. – rusty Feb 10 '14 at 06:06
  • The compose key won't help with this. I don't want to type <Multi_key> <quotedbl> <o>, I want to type <Win> + <;> (three keystrokes vs. one). – Jake Feb 10 '14 at 06:25
0

Since asking the question, I've switched to Linux Mint 17 with the Cinnamon desktop. The Cinnamon desktop provides the same options for temporarily switching layouts that were available on Ubuntu 12.04, including the option to hold a particular key to temporarily switch keyboard layouts.

Jake
  • 171