17

Since I installed 17.10, when switching language with the assigned keyboard shortcut I get this switcher "window" that obstructs me from typing for a couple of seconds. And yes, a couple of seconds is a huge amount of time when switching languages a lot.

huge focus-grabbing language-switching indicator

This happens both in X11 and Wayland but doesn't happen (the obstructive window will not appear) when I switch language by clicking on the lang indicator on top bar. Is there any way to tell this window "please go away"?

pomsky
  • 68,507
nikosal
  • 181
  • 1
  • 6

4 Answers4

5

I've built the Quick Lang Switch Gnome-shell extension exactly to avoid the switcher popup - now switching languages happens instantly. Plus, it does not require a custom-shortcut (the regular one changes behavior), so login-screen is not affected.

Disclaimer: I am the developer of the Quick Lang Switch...

andrew.46
  • 38,003
  • 27
  • 156
  • 232
ankostis
  • 235
  • 2
  • 11
4

The overlay appears if you press and hold a bit longer. A quick press and release should change the layout without showing the overlay.

As a workaround you may set another keyboard shortcut to switch layouts, see this for reference: Ubuntu 17.10 can't change the input switching shortcut to alt+shift.

pomsky
  • 68,507
  • Yes, I could do what I wanted to, by assigning a new shortcut as you proposed. With my previous selection (that was pressing F2/F3) this window (the overlay, as you call it) would appear even if I pressed keys for a brief moment. Thank you. – nikosal Nov 04 '17 at 16:04
  • I had always re-assigned lang switching to the F2/F3 keys instead of alt+shift, obviously because I prefer "one key" stroking instead of a combination. When I upgraded to 17.10 the F2/F3 switching was giving me this overlay. When I assigned a new key (ScrLk) the overlay will not appear, so I am more or less ok (although ScrLk is well away on the right and not comfortable for speed typing). – nikosal Nov 05 '17 at 16:31
  • 3
    I'm pressing the key as fast as humanly possible, and the window still shows up (which is OK), and it steals keyboard focus (which is not OK). – Flimm Jun 23 '18 at 17:32
  • @Flimm What 'bout the alternative shortcut (e.g. alt+shift) suggestion? – pomsky Jun 23 '18 at 17:40
  • 2
    Setting another shortcut is forcing users to change common keys , break habits and also break compatibility with other systems.

    I rather go back to windows.

    I would not consider anything that comes close to 'design decision - take it or go away' to be a valid solution...

    – QT-1 Aug 30 '18 at 14:46
  • @user1656671 I know it's very upsetting right? I've got the same issue once switched to the wayland. Switch back to X11 with unity works as expected – ruX Jan 21 '20 at 15:04
2

It is possible by querying gnome-shell via its JS interface with gdbus call (src).

The following script will alternate between two configured input sources. Easy to modify if you have more.

#!/usr/bin/env bash

cur_idx=$(
        gdbus call \
                --session \
                --dest org.gnome.Shell \
                --object-path /org/gnome/Shell \
                --method org.gnome.Shell.Eval \
                "imports
                        .ui.status
                        .keyboard
                        .getInputSourceManager()
                        .currentSource
                        .index" |
        cut -d"'" -f2
)

next_idx=$(( 1 - $cur_idx ))

gdbus call \
        --session \
        --dest org.gnome.Shell \
        --object-path /org/gnome/Shell \
        --method org.gnome.Shell.Eval \
        "imports
                .ui
                .status
                .keyboard
                .getInputSourceManager()
                .inputSources[$next_idx]
                .activate()" \
        &> /dev/null

Make it executable with chmod a+x </path/to/script> and you may then bind it to a custom shortcut key:

Open Settings -> Devices -> Keyboard and click the '+' choice-button at the bottom to assign the script to some shortcut

(For Gnome < 3.x: Settings -> Devices -> Keyboard -> Custom Shortcuts).

ankostis
  • 235
  • 2
  • 11
  • 1
    Thank you, the script works flawlessly in SID+ latest Gnome-3. – ankostis Apr 17 '20 at 07:01
  • 1
    Unfortunately, due to security concerns, dbus can no longer call method org.gnome.Shell.Eval with arbitrary code, since Gnome-shell v41 (e.g. pushed downstream to Debian unstable "SID" roughly on Sept 2021). You need an extension like this which additionally is much more responsive. – ankostis Oct 21 '21 at 16:25
  • @ankostis, hey, take a look at this answer. I've made an extension that works without the Eval, while sharing a similar D-Bus based approach. – madhead Jan 28 '24 at 00:50
1

I know this is a very delayed answer and it might not be useful. But I wanted to share this with you guys. I'm using Kubuntu 22.04 and I chose Wayland. I get the same thing here but I disabled it by right clicking the language icon in the taskbar. Configure > Configure Layout. Uncheck the option that says: OSD on layout change. And you are good to go. No need to alter the shortcut, or do any scripting.enter image description here

I hope this helps.