Keyboard layout change on hotkeys press instead of release and do not work well with shortcuts (reopen)

Bug #1683383 reported by Lastique on 2017-04-17
336
This bug affects 57 people
Affects Status Importance Assigned to Milestone
X.Org X server
Confirmed
High
xorg (Debian)
New
Unknown
xorg-server (Ubuntu)
Wishlist
Alex

Bug Description

From duplicate bug 1720364 report.

Steps to reproduce:
1. Install ubuntu-mate-desktop on Ubuntu 16.04 LTS with HWE (Xorg 1.19.5), or 17.10 or 18.04 LTS.
2. Set-up two keyboard layouts - English and Russian
3. Set <Ctrl+Shift> as keyboard layout switcher in mate-control-center
4. Try to use shortcuts starting from <Ctrl+Shift>:
4.1. Open Firefox, open new tab, go to some site in it, close tab, try to click <Ctrl+Shift+T> to restore closed tab.
4.2. Open mate-terminal, try to open new tab with <Ctrl+Shift+T>, or copy (<Ctrl+Shift+C>), or paste (<Ctrl+Shift+V>).
4.3. Open pluma, write some text, try to navigate in it with <Ctrl+Shift+arrow>.

Expected results:
<Ctrl+Shift> switches keyboard layout, shortcuts starting from <Ctrl+Shift+...> work normally.

Actual results:
<Ctrl+Shift> switches keyboard layout, shortcuts starting from <Ctrl+Shift+...> do not work.

Notes:
1. Ubuntu 16.04 LTS (Xorg 1.18.4) with Marco and Compton work normally with <Ctrl+Shift> keyboard layout switcher.
2. This problem was discovered before on 13.10, 14.04 and other modern versions with GNOME desktop (Metacity and Compiz) - see bug 1245473.

---------------------------
Original description below:

This is a reopen of bug #36812, which has reappeared in Kubuntu 17.04 Zesty Zapus.

This is a bug about shortcuts mapped to combinations which include each other.

For example, if we have Ctrl+Shift (for keyboard layout) and Ctrl+Shift+N (to open a new terminal), then we are practically unable to use the second shortcut; this is what happens:
Ctrl press (nothing happens)
Shift press (keyboard layout change)
N (a simple N appears, since a shortcut has already fired)

The expected behavior is to fire shortcuts on the release (not on press) of the special keys (ctrl,shift,alt, etc) which is also how Windows behave. This is a serious problem for bilingual layouts, typically using Alt+Shift or Ctrl+Shift for keyboard layout change.

Apparently, the bug has reappeared after the patch that used to fix the problem (208_switch_on_release.diff) has been removed from X.Org 1.19 packages. There is an updated patch in the upstream ticket https://bugs.freedesktop.org/show_bug.cgi?id=865 (link to the attachment: https://bugs.freedesktop.org/attachment.cgi?id=129861).

ProblemType: Bug
DistroRelease: Ubuntu 17.04
Package: xserver-xorg-core 2:1.19.3-1ubuntu1
Uname: Linux 4.9.0-22.1-liquorix-amd64 x86_64
NonfreeKernelModules: nvidia_uvm nvidia_drm nvidia_modeset nvidia
ApportVersion: 2.20.4-0ubuntu4
Architecture: amd64
CurrentDesktop: KDE
Date: Mon Apr 17 17:46:35 2017
InstallationDate: Installed on 2015-05-01 (716 days ago)
InstallationMedia: Kubuntu 15.04 "Vivid Vervet" - Release amd64 (20150422)
SourcePackage: xorg-server
UpgradeStatus: Upgraded to zesty on 2017-04-16 (1 days ago)

Lastique (andysem) wrote :
Launchpad Janitor (janitor) wrote :

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

Changed in xorg-server (Ubuntu):
status: New → Confirmed
Timo Aaltonen (tjaalton) wrote :

And if you had a look at the upstream bug you'd see that the patch doesn't work. It needs to get upstream first anyway.

Alex Ee (bibi4k0) wrote :

I had the same problem.

tlk (sarcasticskull) wrote :

Timo Aaltonen (tjaalton) wrote 10 hours ago: #3

And if you had a look at the upstream bug you'd see that the patch doesn't work. It needs to get upstream first anyway.
-------------------------------
1) It's just one (incomplete) report that it doesn't. I'll try the patch myself soon.
2) The previous patch wasn't in upstream either, yet Ubuntu maintainers did absolutely right to accept it IMO.
3) AFAIK Xorg people rejected this change outright (that is? after some prolonged explanaitons what the actual problem was - shows that they just don't have the issue thus don't care too much).
3) Yet people shouldn't be held hostage because the proposed behavior breaks the XKB spec - without (? AFAIK) a single confirmed case of it breaking any real world X client.

Lastique (andysem) wrote :

> And if you had a look at the upstream bug you'd see that the patch doesn't work.

I can see that someone reported it to not work for one-key combinations (e.g. Ctrl). I believe, the previous patch that was removed had the same limitation, and it was "good enough".

We need to see if it works for two-key combinations (e.g. Ctrl+Alt or Alt+Shift).

> It needs to get upstream first anyway.

It's unlikely to be accepted into XKb for the same reasons as the previous patch. This ticket is a request to add the patch to Ubuntu packages because this is a real problem that affects people.

MKorvin (guitarmaster-play) wrote :

Same problem, waiting for fix.

flux242 (flux242) wrote :

please apply the old patch. Let the 17.04 work as the 16.10. Screw the upstream because it could take ages for them to decide

tlk (sarcasticskull) wrote :

Thats the problem - the old patch doesn't work for the newer Xorg server.

AFAIU the upstream won't accept this anyway.
Thus it's the matter of testing the patch and getting it into Ubuntu. AFAIK Ubuntu was the only major distro that applied the old patch. Was yet another reason to use it.

MKorvin (guitarmaster-play) wrote :

I have arch linux installed on another PC and Xorg server from https://aur.archlinux.org/packages/xorg-server-bug865/ works fine for me. Sources of applied patch are attached, is it possible to get it from there?

ainur (ainureg) wrote :

I have it since yesterday, when i decided to update x-server packages

404 sudo apt-get install xserver-xorg-core xserver-xorg-input-evdev xserver-xorg-input-libinput xserver-xorg-input-synaptics xserver-xorg-input-wacom xserver-xorg-video-amdgpu xserver-xorg-video-ati xserver-xorg-video-fbdev xserver-xorg-video-intel xserver-xorg-video-mach64 xserver-xorg-video-neomagic xserver-xorg-video-nouveau xserver-xorg-video-openchrome xserver-xorg-video-qxl xserver-xorg-video-r128 xserver-xorg-video-radeon xserver-xorg-video-savage xserver-xorg-video-siliconmotion xserver-xorg-video-sisusb xserver-xorg-video-tdfx xserver-xorg-video-trident xserver-xorg-video-vesa xserver-xorg-video-vmware
  405 sudo apt-get install xserver-xorg-input-evdev

Andrey Vetlugin (antrew) wrote :

This annoying bug takes my linux user experience 15 years back to 2002. Is there a way to make Ubuntu great again? Are there any known workarounds for this bug?

Vavooon (vavooon) wrote :

Meanwhile I can suggest a partial workaround for the problem:
You can map layout switching to LEFT Ctrl+Shift and right keys will be available for using with shortcuts.

tlk (sarcasticskull) wrote :

Not exactly a bug, it's just how it works by default and that is what the xkb specs supposedly say. So this behavior dates way back certainly more that 15 yrs ))
And the fix was incorporated by Ubuntu only a couple of yrs ago certainly not in 2002 )))

The 'workaround' suggested above is what I use btw. And what have used on other distros.

kolya (mar-kolya) wrote :

That patch that fixes the problem has been applied in Ubuntu for way more than 'couple of years'

Unfortunately using right keys for modifiers doesn't work well with people who use 10 finger typing - they are used to press certain keys with certain fingers - to speed up their typing, and using wrong hand slows things down and leads to errors. Some modifier-heavy apps - like Emacs become very inconvenient if used with wrong modifier keys.

tlk (sarcasticskull) wrote :

well yeah more than a couple. I actually remember when I got fed up with this and went looking on the net what can be done and later found out that Ubuntu would accept the patch - I was on another distro then. just don't remember when exactly.

I do the 10 fingers typing but even if you don't it's annoying.

ainur (ainureg) wrote :

btw

here is solution
i can translate if anyone wants
https://habrahabr.ru/post/87408/

tlk (sarcasticskull) wrote :

сАлюшн пересобрать руками с патчем? хабра такая хабра.

Timo Aaltonen (tjaalton) on 2017-08-11
Changed in xorg-server (Ubuntu):
importance: Undecided → Wishlist
Changed in xorg-server:
importance: Unknown → High
status: Unknown → In Progress
Artem Kovalov (artemkovalov) wrote :

Пересобрать таки помогло) Аж выдохнул. Жаль, что мейнтейнеры ppa не обновляют оперативно билды для свежих релизов.

Anton Petrusevich (apetr) wrote :

Please return the patch back!

Igor Kostromin (elw00d) wrote :

manual patching recipe (thx Artem Kovalov) for Ubuntu 16.04.3

https://gist.github.com/elw00d/0826917118d58e81843e2d11bc6cf885

I uploaded deb to https://www.sendspace.com/file/av86cf

Pavel (spvkgn) wrote :

I uploaded xorg-server 1.19.3 packages for 17.04 with included patch from https://bugs.freedesktop.org/show_bug.cgi?id=865 to PPA ppa:spvkgn/xorg-patches

Jacob Becker (jabecker) wrote :

I uploaded xorg-server 1.19.3 packages for 16.04.3 i386 with included patch from https://bugs.freedesktop.org/show_bug.cgi?id=865 to https://drive.google.com/open?id=0B_avx7RnFL6Ub1hESFZLT21iaG8

Jacob Becker (jabecker) wrote :

Here's my script based on the gist mentioned on comment #21
https://github.com/plastikat/patch-xkb-layout-switch

It tries to be generic. It uses a separate configuration file for each platform, which means it is extensible. It is still apt-based, though.

Vitaliy (velnik) wrote :

I had the same problem.
Ubuntu Mate 16.04.3 LTS

A (zorn-v) wrote :

My script based on Jacob's one.
https://gist.github.com/zorn-v/df0dccd14af81e017fbe8a4e1523ddf5

It removes all packages installed for build (with prompt).
Patch downdload commented out.

Bolow this line is the cry of the soul
====================================
It is IDIOTISM. It's need to recompile WHOLE X.ORG for simple behavior whose should be in some config at least.

Many dislikes and curse to upstream mainteiners. AFAIK this bug since 200X. THIS IS SHAME.

You can put your important opinion in the...
Yes, I don't respect you as you don't respect users (and distro mainteiners) of your lib.

A (zorn-v) wrote :

Also works on 17.10 BTW.

A (zorn-v) wrote :

Now I understand why "libs" like wayland appears. X.org SUCKS.

Changed in xorg-server:
status: In Progress → Confirmed
V-ctor (radioengineer) wrote :
Download full text (4.2 KiB)

How to make it works on 17.10?
There is no package xserver-xorg-core-hwe-xxx.
I did this:
1. sudo apt install devscripts
2. apt-get build-dep xorg-server
3. apt source xserver-xorg-core
4. wget https://bugs.freedesktop.org/attachment.cgi?id=129861
5 cd xkb
6. patch < attachment.cgi?id=129861
7. debuild -us -uc

and got:

# Make sure Xvfb at least starts up
PATH=debian/tmp/main/usr/bin/:/bin:/usr/bin \
  debian/tmp/main/usr/bin/xvfb-run -s "-screen 0 1280x1024x24 -nolisten tcp -noreset" true
install debian/local/xvfb-run.1 debian/tmp/main/usr/share/man/man1
make[1]: выход из каталога «/home/victor/Developing/XServer/xorg-server-1.19.5»
   debian/rules override_dh_install
make[1]: вход в каталог «/home/victor/Developing/XServer/xorg-server-1.19.5»
# dh_install --fail-missing
dh_install --list-missing
dh_install: Please use dh_missing --list-missing/--fail-missing instead
dh_install: This feature will be removed in compat 11.
/home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: 1: /home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: main/usr/lib/xorg/modules: not found
/home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: 2: /home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: main/usr/bin/Xorg: not found
/home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: 3: /home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: main/usr/bin/X: not found
/home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: 4: /home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: main/usr/share/man/man1/Xorg.1: not found
/home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: 5: /home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: main/usr/share/man/man4: not found
/home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: 6: /home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: main/usr/share/man/man5/xorg.conf.5: not found
/home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: 7: /home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: main/usr/share/man/man5/xorg.conf.d.5: not found
/home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: 8: /home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: main/usr/bin/cvt: not found
/home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: 9: /home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: main/usr/bin/gtf: not found
/home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: 10: /home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: main/usr/share/man/man1/cvt.1: not found
/home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-core.install: 11: /home/victor/Developing/XServer/xorg-server-1.19.5/debian/xserver-xorg-cor...

Read more...

Norbert (nrbrtx) wrote :

This bug is a duplicate of well known bug 1245473 .

tags: added: artful xenial
removed: amd64 third-party-packages
tags: added: bionic

In case you don't need to switch between keyboard layouts, you can get some shortcuts working again if you use the "Tweaks" tool for Gnome.

  sudo apt install gnome-tweak-tool

Then

1. Open "Tweaks"
2. Select the tab "Keyboard & Mouse"
3. Click "Additional Layout Options"
4. Disable entries in the "Switching to another layout" dialog

In my case this gave me back the "ALT + SHIFT" combinations which are essential in the Eclipse IDE for refactoring.

Alex (alexvaa) on 2017-12-07
Changed in xorg-server (Ubuntu):
assignee: nobody → Alex (alexvaa)
Raycho Raykov (raycho-raykov) wrote :

I patched my Lubuntu 16.04 with the mentioned upward patch few hours ago and everything starts working perfectly. I also tested Linux Mint 18.3 with Cinnamon and everything works as expected without any patches. The problem exists in Ubuntu MATE 16.04 too. All these are 64 bit versions. The patch is created correctly: when I released first button from the sequence, the sequence is executed. This way when I switching locales and keep Shift pressed (I'm using Alt+Shift) I can start writing with capital letter. I hope this information is helpful.

Norbert (nrbrtx) wrote :

From duplicate bug 1720364 report.

Steps to reproduce:
1. Install ubuntu-mate-desktop on Ubuntu 16.04 LTS with HWE (Xorg 1.19.5), or 17.10 or 18.04 LTS.
2. Set-up two keyboard layouts - English and Russian
3. Set <Ctrl+Shift> as keyboard layout switcher
4. Try to use shortcuts starting from <Ctrl+Shift>:
4.1. Open Firefox, open new tab, go to some site in it, close tab, try to click <Ctrl+Shift+T> to restore closed tab.
4.2. Open mate-terminal, try to open new tab with <Ctrl+Shift+T>, or copy (<Ctrl+Shift+C>), or paste (<Ctrl+Shift+V>).
4.3. Open pluma, write some text, try to navigate in it with <Ctrl+Shift+arrow>.

Expected results:
<Ctrl+Shift> switches keyboard layout, shortcuts starting from <Ctrl+Shift+...> work normally.

Actual results:
<Ctrl+Shift> switches keyboard layout, shortcuts starting from <Ctrl+Shift+...> do not work.

Notes:
1. Ubuntu 16.04 LTS (Xorg 1.18.4) with Marco and Compton work normally with <Ctrl+Shift> keyboard layout switcher.
2. This problem was discovered before on 13.10, 14.04 and other modern versions with GNOME desktop (Metacity and Compiz) - see bug 1245473.

tags: removed: zesty
description: updated
description: updated
Changed in xorg (Debian):
status: Unknown → New
A (zorn-v) wrote :

https://gist.github.com/zorn-v/df0dccd14af81e017fbe8a4e1523ddf5

There is a script I run if x.org updated.
Fuck X.Org contributors and FUCK they minds.

Norbert (nrbrtx) wrote :

I attached patch from ArchLinux AUR (https://aur.archlinux.org/packages/xorg-server-bug865/, https://aur.archlinux.org/cgit/aur.git/tree/freedesktop-bug-865.patch?h=xorg-server-bug865 ). This patch is stable and reliable. ArchLinux users are happy with it.

It fixes current bug on Ubuntu Bionic Beaver 18.04 LTS.
I have tested it with <Ctrl+Shift> keyboard layout switcher on GNOME (DESKTOP_SESSION="ubuntu") and MATE desktop (DESKTOP_SESSION="mate").

Please kindly review it and consider applying it before official final release of 18.04 LTS.
I'm ready to test proposed packages which (I hope) you would create.
As the result Ubuntu users will be as happy as ArchLinux's users.

The attachment "Patch for Bionic Beaver 18.04 LTS, it fixes the problem" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Anton V Zharnikov (antonprogz) wrote :

This helped me:

https://gist.github.com/elw00d/0826917118d58e81843e2d11bc6cf885

Be aware of xserver version numbers.

Khurshid Alam (khurshid-alam) wrote :

@Norbert

Can you make ppa with the patch so that everyone test it easily?

Norbert (nrbrtx) wrote :

@khurshid-alam

I can't determine how many users want to have this bug fixed. So we can start with the complete working instruction:

1. Set Ctrl+Shift keyboard layout switcher on Ubuntu 18.04 LTS
2. Ensure that Ctrl+Shift+ interference exists
3. Enable "deb-src" sources (via `software-properties-gtk`), then apply the patch

cd ~/Downloads
apt-get source xserver-xorg-core
cd xorg-server-1.19.6/
wget https://aur.archlinux.org/cgit/aur.git/plain/freedesktop-bug-865.patch?h=xorg-server-bug865 -O freedesktop-bug-865.patch
patch xkb/xkbActions.c < freedesktop-bug-865.patch

sudo apt-get install devscripts
sudo apt-get build-dep xserver-xorg-core
debuild -uc -us
sudo dpkg -i ../x*.deb

4. Reboot and test again.

Norbert (nrbrtx) wrote :

Dear all!

I have created PPA ( https://launchpad.net/~nrbrtx/+archive/ubuntu/xorg-hotkeys ) with patched packages for Ubuntu 16.04 LTS (xenial, with HWE) and Ubuntu 18.04 LTS (bionic).

You can test them by the following commands:

sudo add-apt-repository ppa:nrbrtx/xorg-hotkeys
sudo apt-get update
sudo apt-get dist-upgrade

Hope this helps.

Oded Arbel (oded-geek) wrote :

I've installed and tested Norbert's PPA and it works great. I have ALT+SHIFT set as the layout switch shortcut and with the PPA I can now use Eclipse's ALT+SHIFT+<key> keyboard shortcuts.

Kudos Norbert!

Sorry it took so long - because the PPA is only for LTS releases, I had to wait until it was safe for me to update to the 18.04 beta (i.e. no urgent work scheduled). I hope with the upcoming release there will be more testers and maybe we can get Ubuntu maintainers to pick up the patch.

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

Other bug subscribers

Remote bug watches

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