Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Problem with Alt modifier when Alt+Shift is set as a language switcher keystroke combination #3046
URL to a logfile as per https://i3wm.org/docs/debugging.html:
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
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:
After this change, the language switching happens without issues, but any key combination that involves $mod + shift stops working.
#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.
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?
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.
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.