New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Alt modifier when Alt+Shift is set as a language switcher keystroke combination #3046

Open
f1234k opened this Issue Nov 15, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@f1234k

f1234k commented Nov 15, 2017

Output of i3 --moreversion 2>&- || i3 --version:

Binary i3 version:  4.14.1 (2017-09-24) © 2009 Michael Stapelberg and contributors
Running i3 version: 4.14.1 (2017-09-24) (pid 5688)abort…)
Loaded i3 config: /home/thomas/.config/i3/config (Last modified: Τετ 15 Νοέ 2017 08:06:53 μμ EET, 3143 seconds ago)

The i3 binary you just called: /usr/bin/i3
The i3 binary you are running: i3

URL to a logfile as per https://i3wm.org/docs/debugging.html:

https://logs.i3wm.org/logs/5689640350646272.bz2

What I did:

Pressed Alt + Shift + J

What I saw:

Focus changed to the next window to the left

What I expected instead:

I expected for the window to move to the left

Detailed Information:

The above: "What I ..." information is just an example. Basically, the problem is that the shift part of any keystroke combination is completely ignored (so for example, alt+shift+q does not kill a window because it's like I press alt+q).

In order to verify that this is a problem, I followed the steps described below:

  1. I created a clean Ubuntu 16.04.3 LTS Virtual Machine
  2. Did a vanilla installation of i3 with apt install i3
  3. In the configuration screen I selected "Alt" as my modifier (config line: set $mod Mod1)
  4. Added the following line at the end of the config file: exec --no-startup-id "setxkbmap -model pc105 -layout us,gr -option grp:alt_shift_toggle" which basically assigns Alt+Shift as a key combination for language switching.

After this change, the language switching happens without issues, but any key combination that involves $mod + shift stops working.

Related Issues:

#2417 : This is the exact problem that I'm facing. Somewhere in the issue comments it is mentioned that it has something to do with NumLock and it is closed in favor of #2418 , which is not the case for me since the state of NumLock does not seem to affect anything.

Basically, this issue is exactly what is described in this comment but I added the minimal steps that are requested in this comment.

@i3bot i3bot added the 4.14 label Nov 15, 2017

@Airblader Airblader added the bug label Nov 16, 2017

@stapelberg

This comment has been minimized.

Show comment
Hide comment
@stapelberg

stapelberg Mar 5, 2018

Member

Not sure I follow.

You’re configuring Alt+Shift to switch languages, and you’re saying key bindings involving Alt+Shift then don’t work anymore.

Isn’t this to be expected? There’s an obvious conflict here. How could your computer know when you mean Alt+Shift to switch languages and when to use Alt+Shift as part of a shortcut?

Does this behavior work in any other program/window manager?

Member

stapelberg commented Mar 5, 2018

Not sure I follow.

You’re configuring Alt+Shift to switch languages, and you’re saying key bindings involving Alt+Shift then don’t work anymore.

Isn’t this to be expected? There’s an obvious conflict here. How could your computer know when you mean Alt+Shift to switch languages and when to use Alt+Shift as part of a shortcut?

Does this behavior work in any other program/window manager?

@f1234k

This comment has been minimized.

Show comment
Hide comment
@f1234k

f1234k Mar 11, 2018

In the meantime I switched my $mod key to be the super key.

But, since this is an issue that many people might be facing I'll explain why it is bad. People that come from a Windows background are used to the alt-shift keystroke combination to change languages (since it's the default one). If for some reason they also choose alt as their mod key, they expect both things to work (and they don't).

As for the technical part of it (and specifically how could my computer know what I mean):

How does my computer know that when I press the alt alone, it should do stuff in various applications and when I press the alt with j for example it should do something in the current window? What I'm trying to say is that, conceptually, for the user, alt+shift is different than alt+shift+j.

I'm not sure how it can be done, but my guess would be that you could register the keystroke combination on the KeyUp event (?). Unfortunately, I have little to no knowledge of the apis that are used to capture user keystrokes in linux (in .NET you have a KeyData property that contains the key pressed plus the modifiers; not sure how they do it under the hood though).

The only reason why I created the specific bug request is that when I first tried out i3, everything worked OK, and it was one of the main reasons that I chose to go with Alt modifier and not Super. This means that it somehow understood that Alt+Shift alone is something and Alt+Shift+x is something else. It worked in 1 virtual machine, my laptop and my main work computer and after an update (I really can't remember what the update was) it stopped working.

Important note: the change that happened may have been a xorg change in setxkbmap that basically broke the i3 handling of alt+shift. I can't really be sure about this.

f1234k commented Mar 11, 2018

In the meantime I switched my $mod key to be the super key.

But, since this is an issue that many people might be facing I'll explain why it is bad. People that come from a Windows background are used to the alt-shift keystroke combination to change languages (since it's the default one). If for some reason they also choose alt as their mod key, they expect both things to work (and they don't).

As for the technical part of it (and specifically how could my computer know what I mean):

How does my computer know that when I press the alt alone, it should do stuff in various applications and when I press the alt with j for example it should do something in the current window? What I'm trying to say is that, conceptually, for the user, alt+shift is different than alt+shift+j.

I'm not sure how it can be done, but my guess would be that you could register the keystroke combination on the KeyUp event (?). Unfortunately, I have little to no knowledge of the apis that are used to capture user keystrokes in linux (in .NET you have a KeyData property that contains the key pressed plus the modifiers; not sure how they do it under the hood though).

The only reason why I created the specific bug request is that when I first tried out i3, everything worked OK, and it was one of the main reasons that I chose to go with Alt modifier and not Super. This means that it somehow understood that Alt+Shift alone is something and Alt+Shift+x is something else. It worked in 1 virtual machine, my laptop and my main work computer and after an update (I really can't remember what the update was) it stopped working.

Important note: the change that happened may have been a xorg change in setxkbmap that basically broke the i3 handling of alt+shift. I can't really be sure about this.

@stapelberg

This comment has been minimized.

Show comment
Hide comment
@stapelberg

stapelberg Mar 11, 2018

Member

i3 isn’t involved in the language switching at all, that’s an X11 thing. While i3 supports bindings on KeyRelease (see bindsym’s --release flag), I don’t think that helps here.

One possible solution might be to unconfigure alt+shift for language switching in X11 and explicitly configure an equivalent shortcut in i3 (with --release), but I haven’t tested that.

Member

stapelberg commented Mar 11, 2018

i3 isn’t involved in the language switching at all, that’s an X11 thing. While i3 supports bindings on KeyRelease (see bindsym’s --release flag), I don’t think that helps here.

One possible solution might be to unconfigure alt+shift for language switching in X11 and explicitly configure an equivalent shortcut in i3 (with --release), but I haven’t tested that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment