7

Just installed Ubuntu 17.10 and it seems that the keyboard layout switching has changed its behavior.

In the previous version of Ubuntu (such as 16.04 Unity), if I have 3 different keyboard layouts (for example EN-TH-JA), hitting Super+Space would always cycle to the next layout in the same order (e.g. EN to TH to JA then back to EN).

However since Ubuntu 17.10, this is no longer the case. It cycles through the layout in the MRU (Most Recently Used) ordering. So suppose that the layout starts with EN, then I cycled to TH. Next time I hit Super+Space, it would give me EN instead of JA.

I tried to dig up and found that the culprit is the newly implemented DCONF settings inside org.gnome.desktop.input-sources and there seems to be no way to change this behavior.

So my question is: Is there a way to change this behavior to "static ordering" of keyboard layout switching?


(As a side-note, the new behavior is very bad when we have three or more layouts. Most of the time we as a user couldn't remember the MRU layouts, so layout switching is very inconvenient and much slower than already knowing what the next layout would be if static ordering is used.)

If there is no settings to change this behavior, where should I report this as a bug or a feature request?

8
  • 1
    Alternative custom shortcuts like shift + alt will probably work as you want. Also is this a big problem? Doesn't super + space give a visual cue by showing an overlay containing available layouts while switching? (You'll have to press and hold slightly longer though! A quick press and release won't work.)
    – pomsky
    Nov 12, 2017 at 17:16
  • 3
    @pomsky I would be pretty unhappy with having to rely on a visual cue. It’s far better in my opinion to just be able to use a keybinding without having to bother with checking for any visual feedback. Nov 12, 2017 at 17:25
  • 1
    Unity still does it the old way. A feature request should be filed here. Nov 12, 2017 at 17:29
  • 1
    @pomsky [Shift]+[Alt] indeed worked as intended! However, this seems to be arbitrary and a bit inconsistent (considering that I still cannot disable [Super]+[Space]). As @.Guildenstern has mentioned, relying on visual cue significantly slows down the typing speed. I guess many people with 3+ layouts would actually prefer to at least have options to consistently use static cycling. I'm going to file a feature request as @.GunnarHjalmarsson suggested. Nov 13, 2017 at 5:13
  • 2
    The feature request has been filed here. bugzilla.gnome.org/show_bug.cgi?id=790273 Thanks everyone. Nov 13, 2017 at 6:00

2 Answers 2

3

As a workaround you may set an alternative keyboard shortcut like alt+shift to switch between keyboard layouts (see this question for reference: Ubuntu 17.10 can't change the input switching shortcut to alt+shift).

This shortcut should obey the "static ordering" you're looking for.


A feature request has been filed by OP here.

1
  • 1
    This is definitely a good workaround for the time being. Thanks! Nov 13, 2017 at 14:57
0

GNOME 3's D-Bus API offers the org.gnome.Shell.Eval method for executing arbitrary JavaScript, and thus we can monkey-patch the code into not changing the order.

Here's a script that works on GNOME 40 (Ubuntu 21.10):

#!/usr/bin/bash

read -r -d '' patch_script << '{ENDOFMSG}'
Object.getPrototypeOf(imports.ui.status.keyboard.getInputSourceManager())._currentInputSourceChanged = function () {
  let oldSource;
  [oldSource, this._currentSource] = [this._currentSource, newSource];

  this.emit('current-source-changed', oldSource);

  // for (let i = 1; i < this._mruSources.length; ++i) {
  //   if (this._mruSources[i] == newSource) {
  //     let currentSource = this._mruSources.splice(i, 1);
  //     this._mruSources = currentSource.concat(this._mruSources);
  //     break;
  //   }
  // }
  this._changePerWindowSource();
}
{ENDOFMSG}

gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval "$patch_script"

You must log in to answer this question.

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