7

I use Alt + Shift to change the language. It is so normal and I have worked with that for a long time. But some days some thing have happen for me. That is Alt + Shift not work all times. For example I can use it on libreOffice to change the language and also on browses. But on some application it does not work. I do not know why.

For example on Taskque software, when I want to add my own task and change the language, Alt+Shift doesn't work.

graham
  • 10,436
Mohammad Reza Rezwani
  • 10,286
  • 36
  • 92
  • 128

2 Answers2

10

This bug made using emacs and IntelliJ Idea a nuisance under Ubuntu 18.04 LTS. I found a simple workaround.

  1. You can verify how Alt and Shift are not being detected simultaneously by running

    $ xkbwatch
    

    Notice how the blinky lights change for ALT and for SHIFT individually but not for both at the same time.

  2. The output of setxkbmap -query:

    rules: evdev
    model: pc105
    layout: us,us,us
    variant: ,intl,
    options: grp:alt_shift_toggle,grp_led:scroll
             ^^^^^^^^^^^^^^^^^^^^
             THIS IS THE PROBLEM
    
  3. We will now unset ALTSHIFT toggle, so that it is not prematurely captured.

    $ setxkbmap -option -option grp_led:scroll
                ^^^^^^^
                DELIBERATELY EMPTY
    

    The first empty -option erases all options, the second one just carries over an option we want to keep. Additional -option clauses can preserve other preexisting options.

    You can still change to next/previous input source with whatever is configured in Ubuntu Settings/Keyboard/Typing. In my case it is Super+Space (Super=Windows key in PCs).

  4. Repeat step number 2 again and notice how ALT and SHIFT now play together simultaneously.

I am now a happy Emacs and IntelliJ user.
This is a single command workaround.

zx485
  • 2,426
  • 1
    Worked for me. Nice and easy without need to restart. – h.nodehi Jul 25 '19 at 20:58
  • 1
    Is there any way to make this persistent? I'm only ElementaryOS 6 and I have to redo that on every restart – adaba Aug 20 '21 at 18:46
  • Back when I was using 18.04, I tried modifying Xsession. It worked, but if you have a laptop, every suspend/resume cycle it would reset to the incorrect behavior. (There likely is a hook for scripting resumes but I did not pursue that route.)

    In the end I upgraded Ubuntu and did not see this problem since 20.04.

    – C. Daniel Mojoli B. Aug 26 '21 at 22:08
  • This is a problem in Ubuntu 22.04. I used this workaround but have to do this each time I restart/plug in my keyboard. It's very annoying. – karjedavpalaa Nov 21 '22 at 13:56
4

Perhaps this will help...

Open a terminal and run:

gksu gedit /etc/default/keyboard

(or use some other text editor)

Do following changes in the file:

XKBLAYOUT="de,us"
XKBVARIANT=""
XKBOPTIONS="grp:alt_shift_toggle"

(Replace de,us with your languages)

Restart and try again.

More Info http://www.x.org/releases/X11R7.6/doc/xorg-docs/input/XKB-Config.html#id2521334

TuKsn
  • 4,370
  • 2
  • 26
  • 43