Hacker News new | ask | show | jobs
by jraph 982 days ago
> Or do people actually want their keybindings to change when they change their layouts?

That's what actually happens everywhere. For instance undo is usually CTRL+Z. On QWERTY that will be CTRL + the key at the left side of the X, and on AZERTY that will be CTRL+the key at the left side of the E. Therefore, that's the behavior people expect and it has advantages. Having to write KEY_Z to actually have KEY_W is also jarring and very counter-intuitive. That also means UIs don't have to translate key bindings, unless they want them to correspond to some word (for instance word processors have CTRL+B for bold in English, but CTRL+G is allowed in French (Bold = Gras).

Now I also understand the benefits of your choice, and I appreciate that nobody is entitled to make you change this in any case. At worse everybody should be thankful for your choice to release this work as open source and spend time on it to the benefit of everyone. I'm also not a user so I don't have any stake in this.

2 comments

I am mostly trying to understand what people actually use. I hate exactly this thing in most applications: ctrl-z doesn't work when I use the german layout (usually I use qwerty/us), and assumed most people would dislike it as well...
I personally like the flexibility of i3's keybinding config.[1] For each binding it lets you choose either:

- a keysym (the letter Z, wherever it happens to be in your current layout)

- or a keycode/scancode (the physical button under your pinky, no matter the current layout)

I use both methods for different bindings. For example I've bound the vim keys (hjkl) by scancode, and the layout keys ("S"tack, "F"ullscreen, "R"esize, etc) by symbol.

[1]: https://i3wm.org/docs/userguide.html#keybindings

If someone ever does a survey, I'd be interested to read a blog post on this :-)

In my case I'm not sure what I prefer. When switching from AZERTY to QWERTY, I'm lost because the keybindings are not the same. Especially that CTRL+Z "becomes" CTRL+W which kills the current tab, and CTRL+W "becomes" CTRL+Q which kills the app.

OTOH, I don't usually switch layouts, and like that the configuration file / the UI matches the current layout.

I guess the conf could allow setting layout-specific keybindings. It complicates things quite a bit though.

But that's easy. All software does something like CTRL-Z accordingly to the chosen layout. So the physical position of the switch to press on the keyboard changes accordingly to the layout, it changes when switching from qwerty to qwertz and again when it switches to dvorak.

I saw a few games where it wasn't that way, it was always treated as a bug.

Think of it from the user side: People are used to their shortcuts. They are used to press CTRL+Z where it is on their layout, as their keyboard keys will also be printed accordingly. Someone with a non-qwerty-layout may have never seen CTRL+Z leading to the physical key on the bottom left, for them it was always somewhere else. How would they know what to press, when the config says CTRL+Z, and they press CTRL+Z on their keyboard and nothing happens? How would someone who grew up with azerty know qwerty?

If you want to support "what people actually use", the keypresses have to be evaluated according to the actual keyboard layout used. I say this with absolute certainty, and as a multilingual developer who switched from qwertz to qwerty and had azerty in use as well for a time.

To be fair, the example of a game is a pretty poor one: it's the main case where the key positions are more important than their code --WASD->ZQSD in AZERTY for example; if the game still maps WASD, it's just unusable as direction input. The "press W" and nothing happens is annoying, but in that case it's the lesser of two evils. And the only good answer in that case is that you need to rebind your keys.

Of course the best is the ability to remap and to adapt such positional keybindings to (known) layouts. But it's a big 'localization' task to consider all niche layouts (Dvorak, Colemak, Azerty, Bépo, ...).

One more thing to think about: some layouts don't have Latin letters. So if you switch from English to Ukrainian, you'd lose all your keybindings with the approach requested in the ticket..
> That's what actually happens everywhere.

That’s emphatically not what happens everywhere. It might be what happens everywhere people use a single Latin layout, but if you use two layouts or more you definitely want things to stay on the same physical key regardless of any switching—your muscle memory is bound to hate you otherwise.

For example, I expect CUA cut to be Ctrl-X, but also Ctrl-Ч and Ctrl-ס. This is how it works on all graphical desktops I’ve used and also, with some work, in Vim. (Not in Kakoune, though, which is a substantial annoyance.)

> your muscle memory is bound to hate you otherwise.

Yes, exactly what happens when I switch from AZERTY to QWERTY. Everything is messed up.

Now my use of everywhere was abusive, I guess not everywhere. It can't be Z if Z is not on your keyboard.