Using certain xkb-options, e.g. Alt+Shift, for switching input sources not reflected by the input source indicator in a wayland session

Bug #1956916 reported by Leonid Golouz
156
This bug affects 29 people
Affects Status Importance Assigned to Milestone
GNOME Shell
New
Unknown
gnome-control-center (Ubuntu)
Confirmed
High
Unassigned

Bug Description

Currently, there is no way to define Left Alt + Left Shift key combination to change keyboard layouts in Ubuntu 22.04. In previous versions there was a convenient "Keyboard Layout Options" window in which there was able to set required key combination. Since 22.04 release I can't find a way to do that because useless "Keyboard Shortcuts" window opens instead in which unable to set Left Alt + Left Shift as "Switch to the next source" shortcut.
---
ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu75
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
DistroRelease: Ubuntu 22.04
InstallCmdLine: BOOT_IMAGE=/casper/vmlinuz file=/cdrom/preseed/ubuntu.seed maybe-ubiquity quiet splash ---
InstallationDate: Installed on 2022-01-07 (2 days ago)
InstallationMedia: Ubuntu 22.04 LTS "Jammy Jellyfish" - Alpha amd64 (20211230)
NonfreeKernelModules: nvidia_modeset nvidia
Package: ubiquity (not installed)
ProcVersionSignature: Ubuntu 5.13.0-19.19-generic 5.13.14
Tags: jammy wayland-session ubiquity-22.04.3
Uname: Linux 5.13.0-19-generic x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin lxd plugdev sambashare sudo
_MarkForUpload: True

Revision history for this message
Chris Guiver (guiverc) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Please execute the following command only once, as it will automatically gather debugging information, in a terminal:

apport-collect 1956916

When reporting bugs in the future please use apport by using 'ubuntu-bug' and the name of the package affected. You can learn more about this functionality at https://wiki.ubuntu.com/ReportingBugs.

You've tagged this as being an installer issue (ie. `ubiquity`) but your description reads (at least to me) like it's an issue on an installed system, and not installation only as filed. Is your filing correct? (ie. it's a bug in the installer).

Revision history for this message
Leonid Golouz (mdaemon) wrote : Casper.txt

apport information

tags: added: apport-collected jammy ubiquity-22.04.3 wayland-session
description: updated
Revision history for this message
Leonid Golouz (mdaemon) wrote : ProcCpuinfoMinimal.txt

apport information

Revision history for this message
Leonid Golouz (mdaemon) wrote : ProcEnviron.txt

apport information

Revision history for this message
Leonid Golouz (mdaemon) wrote : UbiquityPartman.txt

apport information

Revision history for this message
Leonid Golouz (mdaemon) wrote : UbiquitySyslog.txt

apport information

Revision history for this message
Leonid Golouz (mdaemon) wrote : Re: [22.04] Unable to set Left Alt + Left Shift key combination to switch keyboard layouts

Hello, Chris. Excuse me, I'm unfamiliar with the process of bug reporting took place in Ubuntu, this is my first bug report. You are completely right, the issue on an installed system. Unfortunately, I don't know what I should select as an issue tag for that. Is it possible to re-tag the issue or assign it to the proper people? Thank you in advance.

Revision history for this message
Chris Guiver (guiverc) wrote :

(likely wrong package sorry)

affects: ubiquity (Ubuntu) → gnome-shell (Ubuntu)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Please try logging into 'Ubuntu on Xorg' in case the problem is specific to Wayland. Can you set it then?

Revision history for this message
Leonid Golouz (mdaemon) wrote :

I'm not sure what I should do. Is there any step-by-step instruction exists? On my logon screen I see nothing like 'Ubuntu on Xorg'.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

If you have the Nvidia driver installed then it might be called 'Ubuntu' rather than 'Ubuntu on Xorg'. To see such options on the login screen, click your username and before typing your password then click on the icon in the bottom-right corner of the screen.

Revision history for this message
Leonid Golouz (mdaemon) wrote :

Tried both "Ubuntu" and "Ubuntu on Wayland" and saw no difference between these two options. There is no way to change key combination to Left Alt + Left Shift with any option selected.

affects: gnome-shell (Ubuntu) → gnome-control-center (Ubuntu)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Please report the bug to the developers at https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues and then tell us the new issue ID.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

On 2022-01-13 03:25, Daniel van Vugt wrote:
> Please report the bug to the developers at
> https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues ...

Or don't. I'm pretty sure this is not a gnome-control-center regression.

gnome-control-center has never, at least not for many cycles, provided a way to define the <Alt>+<Shift> combination to switch input sources. The UI for doing so is provided by Tweaks (the gnome-tweaks package needs to be installed).

Tweaks works for that purpose also in jammy. There is only one problem: It doesn't work if it's a wayland session. (It works as expected in a Xorg session.)

With "it doesn't work" I mean that <Alt>+<Shift> does change the layout, but the input source indicator in the top bar does not change.

In impish it works as expected whether the session is wayland or Xorg.

Can't tell which package is the real culprit, though. You could think it was about gnome-shell, but we still have the very same version in impish and jammy.

@Leonid: If you agree, I'm inclined to change the summary of this bug to something like:

"Using xkb-options for switching input sources not reflected by the input source indicator in a wayland session"

Please let us know if you see the same thing as I do.

Changed in gnome-control-center (Ubuntu):
status: New → Incomplete
Revision history for this message
Leonid Golouz (mdaemon) wrote :

I'm not sure, but the "Super" + Space combination is only way I can change the layout by keyboard shortcut currently.
@Gunnar, I'm agree, - I can't determine the source of the issue by myself, I'm just a Ubuntu user, not a guru in Ubuntu, so I fully rely on your decision.

summary: - [22.04] Unable to set Left Alt + Left Shift key combination to switch
- keyboard layouts
+ Using xkb-options for switching input sources not reflected by the input
+ source indicator in a wayland session
Changed in gnome-control-center (Ubuntu):
importance: Undecided → High
status: Incomplete → New
tags: added: rls-jj-incoming
removed: ubiquity-22.04.3
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote (last edit ): Re: Using xkb-options for switching input sources not reflected by the input source indicator in a wayland session

I tested some more, and the issue seems to be more complex than I indicated in comment #14.

Some XKB shortcuts for switching input source work in both Wayland and Xorg. Examples are:

<Caps Lock>
<Left shift>
<Left alt>

i.e. if you define a single modifier key for the purpose it works.

<Alt>+<Shift> is a problem on wayland at least, and when I tested in a VM it failed to work on Xorg too.

Also <Ctrl>+<Shift> is problematic (on Wayland).

summary: - Using xkb-options for switching input sources not reflected by the input
- source indicator in a wayland session
+ Using certain xkb-options, e.g. Alt+Shift, for switching input sources
+ not reflected by the input source indicator in a wayland session
Revision history for this message
Sebastien Bacher (seb128) wrote :

I'm changing the tag, while it seems worth investigating more it doesn't seem important enough to be tracked using the rls bug process at this point

tags: added: rls-jj-notfixing
removed: rls-jj-incoming
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

The issue is not present in impish. <Alt>+<Shift>, for instance, works as expected there in a wayland session.

tags: added: regression-release
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

FWIW I could reproduce the issue, as described in comment #16, on Debian testing.

Revision history for this message
Sebastien Bacher (seb128) wrote :

@Gunnar, so it's the indicator status which isn't updated correctly which would mean not a bug in settings? The gnome-shell version is identical to impish so that's not the component that changed, maybe gnome-settings-daemon? Would downgrading to the impish version of the package fix the issue?

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

On 2022-01-26 09:10, Sebastien Bacher wrote:
> @Gunnar, so it's the indicator status which isn't updated correctly
> which would mean not a bug in settings?

Yes, mostly that. Also, if you have IBus input sources added, it goes haywire.

Indeed not a bug in settings.

Tried to downgrade g-s-d as you suggested. Didn't help.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gnome-control-center (Ubuntu):
status: New → Confirmed
Revision history for this message
Anton Samokat (anton-samokat) wrote :

I was able to configure switching languages input by Alt + Shift combination in Ubuntu 22.04 by instruction here - https://askubuntu.com/a/1407561/1548713

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

@Anton: If I understand it correctly, in that Ask Ubuntu answer you basically confirm the presence of this bug as worded in the bug summary. (I assume you are using wayland.)

And yes, Win/Super + Space is another thing. It's the default shortcut on GNOME to switch input source, and uses another mechanism compared to the shortcuts you can set in Tweaks.

Revision history for this message
Sergii Shydlovskyi (sshydlovskyi) wrote (last edit ):

My system is also affected by this bug, it seems, after I upgraded from 21.10 to 22.04 LTS (and yes, it looks I'm using Wayland too).

Also there's one strange feature that I did notice beside keyboard indicator itself.
I have three layout (english, ukrainian and russian). On the 21.10 system, single ctrl+shift combination switched from one layout to the next, but now I need to type ctrl+switch twice to switch from english to ukrainian. It looks like I have two english layouts now, then ukrainian and then russian. However, I didn't add any languages during or after the upgrade.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

@Sergii: To find out which layouts you actually have, you can run this command:

gsettings get org.gnome.desktop.input-sources sources

Revision history for this message
Sergii Shydlovskyi (sshydlovskyi) wrote (last edit ):

@Gunnar, thanks for the information. The output looks correct:

sergii@shdlthnk:~$ gsettings get org.gnome.desktop.input-sources sources
[('xkb', 'us'), ('xkb', 'ua'), ('xkb', 'ru')]

But actually the switching process looks like this:

sergii@shdlthnk:~$ asdf asdf фіва фыва

I pressed ctrl+shift after each four letters, i.e. after first press I'm still on English layout, then Ukrainian after the second and on Russian after the last.

And if I try to remove all layouts except English via standard Settings dialog, I'm still able to switch between these three.

I don't if this behavior is related to the issue being discussed, though, just my observation.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

@Sergii: Can you please log in to an Ubuntu on Xorg session and let us know if you see the issue there as well.

Revision history for this message
Sergii Shydlovskyi (sshydlovskyi) wrote :

@Gunnar, I can confirm that the issue is not reproduced under Xorg session, everything works fine this way, thanks!

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

@Sergii: Then, even if I'm not certain, it's reasonable to assume that your observation — a need to press Ctrl+Shift twice to switch from English — is related to this wayland bug.

Thanks for reporting about that aspect of the issue!

Revision history for this message
Sergii Shydlovskyi (sshydlovskyi) wrote :

@Gunnar, thanks for helping with resolving the issue at least for my case, I hope, this information will help with further investigation.

Revision history for this message
popov895 (popov895) wrote :

Any progress on this? Surprisingly, the keyboard layout indicator handles switching with Super+Space, but not with Alt+Shift. Do they use different ways to switch keyboard layouts?

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

On 2022-05-17 14:12, popov895 wrote:
> Do they use different ways to switch keyboard layouts?

Yes.

In Settings -> Keyboard -> Keyboard Shortcuts -> Typing you can set it using the GNOME mechanism. There Super+Space is default, and AFAIK those options work as expected.

In Tweaks, it's the XKB mechanism for switching sources you set.

Revision history for this message
Alireza Nourian (nournia) wrote :

Hi,
As you said, I have this issue that Alt+Shift doesn't change the language indicator but changes the keyboard layout.
I used gnome tweaks to set Alt+Shift for language change and I have two keyboard layouts. Also, I must press Alt+Shift 2 times to change from the first layout to the second layout. So, it is the sequence of layouts that I see when I repeat pressing Alt+shift: En, En, Fa, En, En, Fa, ... But when I use Super+Space, I see: En, Fa, En, Fa.

Revision history for this message
Alphonsos Pangas (alfon-r) wrote :

I have the same issues reported, e.g., in #34 or #25.
However, I have an additional issue: The scroll lock indicator LED on the keyboard, in previous versions used to indicate the current input language (in my case off=English, on= Greek). Now, however, it is inconsistent. When I switch with super+space, everything (including the scrolllock LED) works correctly. When I switch with Alt+Shift, however, it cycles in a 2-1-2-1-2-1 pattern (similar to the input language switch, i.e. I need to press Alt+shift once to turn the LED on, then TWICE more to turn it off again). The problem is that the 2-1-2 pattern is NOT in sync between the language selection and the LED indication, which renders the LED indicator completely useless. In other words, successive presses of Alt+Shift produce the following results:
English/LED off
Greek / LED on
English/LED on
English/LED off
Greek / LED on
English/LED on
English / LED OFF
Greek / LED on

BTW, it might be a good idea to notify the upstream developers who develop the GNOME super+space code, even if it isn't, strictly speaking, THEIR bug. If they allowed Alt+shift as a switch keystroke, they would render our life much easier.

Revision history for this message
Alphonsos Pangas (alfon-r) wrote :

Re my comment #34: I just switched to ubuntu on XORG and just like other users, everything works fine here, the indicator LED, the on-screen (top-right) indicator and the singleALT-switch needed to switch both ways.

Revision history for this message
Aleksandr Alekseenko (alexjd) wrote (last edit ):

Confirmed. #36
The switching to XORG has solved all keyboard layout issues.
Also, it solved the "Double click on the window Title to expand a window" issue for Chrome if you were not using "Use system title bar and borders" in the Chrome setting.

Revision history for this message
Jiri Jurica (jjurica) wrote :

Hello,

as I can see you discuss two different issues that I faced as well:

- The first is that setting up alt + shift shortcut using gnome-tweaks does not work properly anymore (it was working on Ubuntu 20.4) because it does not modify the language indicator.
- The second is that if you try to set up this shortcut using Ubuntu settings (Keyboard -> Shortcuts -> Switch to the next source / Switch to the previous source), it will take only specific keys and ignores alt and shift. It seems like a bug/useless restriction in the GUI app.

I found the following workaround for the second issue (execute commands as user that is logged to graphical environment):
gsettings set org.gnome.desktop.wm.keybindings switch-input-source "['<Shift>Alt_L']"
gsettings set org.gnome.desktop.wm.keybindings switch-input-source-backward "['<Alt>Shift_L']"
This breaks the key restrictions in settings and ensures expected behavior including changing the language indicator.

Revision history for this message
Alex Boiko (sanch0se) wrote :

Same issue with Alt+Shift on Ubuntu 22.04

Revision history for this message
Goryuchka (goryuchka) wrote :

Same...

Revision history for this message
Mykola Yaroshenko (alokim) wrote :

I confirm #27

I've removed keyboard shortcut in Tweaks and now I'm using Super-Space to switch input. Not perfect though...
asdf фіва asdf фіва

Pressing Super-Spase after each 4 letters, ss you can see it's not the *next* language (third one should be Russian, back to English instead). Yes, it's similar to lang switch on Android, but not what I would expect on my desktop OS. So I have to pay attention to visual indicators typing lang mix in messengers. Not great.

Revision history for this message
Anton Samokat (anton-samokat) wrote :

May be someone can help with the following related question:
How to have Alt+Shift shortcut for language switching and be able to use other shortcuts that contain Alt+Shift combination keys?
https://askubuntu.com/q/1434452/1548713
?
Or probably this is the similar bug.

Revision history for this message
vadim (vadim1337) wrote :

ubuntu 22.10 the problem exists

Goryuchka (goryuchka)
Changed in gnome-control-center (Ubuntu):
assignee: nobody → Goryuchka (goryuchka)
assignee: Goryuchka (goryuchka) → nobody
Revision history for this message
P.Constantine (pconstantine) wrote :

@Gunnar, @Sergii
Can confirm that I have exactly the same repro:
1. Indicator doesn't change
2. Need to "switch" twice to get anything other than en(US) every other layout works with one "switch"

Ubuntu 22.10 with Wayland

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote (last edit ):

On 2022-10-08 19:00, Anton Samokat wrote:
> May be someone can help with the following related question:
> How to have Alt+Shift shortcut for language switching and be able to
> use other shortcuts that contain Alt+Shift combination keys?
> https://askubuntu.com/q/1434452/1548713
> ?
> Or probably this is the similar bug.

That's another problem, described in (the old) bug #1245473. And the somewhat newer bug #1683383.

Revision history for this message
Dmitrii Bocharov (bdshadow) wrote :

It was reported more than a year ago. Will it be fixed? Why is it "Unassigned"? Is somebody working on it?

tags: added: lunar
Revision history for this message
Mark Burkut (gulliverbms) wrote (last edit ):
Revision history for this message
Rulon Oboev (rulon-oboev) wrote :

Same issue on Ubuntu 22.04.2

Changed in gnome-shell:
status: Unknown → Fix Released
Changed in gnome-shell:
status: Fix Released → Unknown
Changed in gnome-shell:
status: Unknown → New
Revision history for this message
artli (artli) wrote :

Both bugs (Alt+Shift not being reflected in the language indicator and the US layout being duplicated when using Alt+Shift) affect me on 23.04

Revision history for this message
artli (artli) wrote :

Okay, the solution suggested in this gitlab issue comment fixes it for me: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4511#note_1309852

The solution is to skip gnome-tweaks altogether and instead set a custom shortcut using gsettings:
$ gsettings set org.gnome.desktop.wm.keybindings switch-input-source "['<Shift>Alt_L']"
$ gsettings set org.gnome.desktop.wm.keybindings switch-input-source-backward "['<Alt>Shift_L']"

Caveat: if you have more than two layouts, this works a bit weird: Alt+Shift does cycle between the layouts normally but Shift+Alt just cycles between the last two, so be careful with how you press it. I tried variations of these commands where I switch the shortcuts around or use the same one or leave one out but couldn't find anything that doesn't behave weirdly; perhaps I haven't tried hard enough though.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.