Keybinding issues (when remapping keys in OS)

This subforum contains all the issues which we already resolved.
posila
Factorio Staff
Factorio Staff
Posts: 5153
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Keybinding issues (when remapping keys in OS)

Post by posila »

tl;dr
"I updated from 0.16 and keybindings are all messed up."
- What keyboard layout do you use? Go to Control options in the game and reset to default.

"The game doesn't seem to detect some keys.", "The control settings change after restart."
- Sounds like bugs.

"I remapped keys in OS and the game does not respect that."
- It's a bug if the issue is when typing text. Re-mapping modifier keys for in-game shortucts needs to be solved by us. Other cases mostly are not bug, you need to rebind keys in control settings to whatever you like.

---------------------------

There are lot of report regarding to different keybinding issues. So I'd like to address them here in general to reduce number of duplicate threads.

The differences between 0.16 and 0.17 come from migration from Allegro to SDL2, which introduced some bugs; at the same time we switched from handling keys by their keycode (which represents "meaning" of keys) to their scancode (which identifies positions of keys on keyboard). See: FFF #259

For the most part, we are designing default control bindings around positions of key and not their meaning. If player movement is supposed to be controlled by WASD, we mean very specific keys not necessarily keys that produce letters W, A, S or D. For example on French AZERTY keyboard movement is on ZQSD, but these are physically the same keys as WASD on QWERT* keyboards.

Because before 0.17, people with keyboard layouts that diverged a log from QWERTY had to change their default control settings, these setting don't make sense anymore in 0.17, which can create issues when updating from 0.16. We have added auto-reset of 0.16 bindings when AZERTY layout is detected during startup, if there are some other widely used layouts that would benefit from auto-reset (Dvorak? Colemak?), please let me know.

So, because of using scancodes, remapping keys in your OS doesn't have any effect on the game. This is intended.

There couple of exceptions to this:
- When typing text, the game should respect your keyboard layout. So if you swap Backspace and CapsLock, it should work as it would in a text editor when your writing to chat or other text boxes.
- Shortcuts for Undo, Cut, Copy and Paste should respect your keyboard layout (to some extent) Ctrl+Z, Ctrl+X, Ctrl+C, Ctrl+V, because these shortcuts are universaly used. There is already exception to this exception, because due to conflict with other controls, we default Undo to Ctrl+W on AZERTY layout as of 0.17.2.

One could argue, that Esc is also universal shortcut ... maybe, we need to think more about this.

My point is - in-game controls are (and should be) based on positions of keys on keyboard, if they don't feel right to you, change them in control settings.

Problem is - the game won't let you use any key as a modifier key, so we need to solve that somehow. Most likely fix will be detecting modifier keys based on keycode instead of scancode.

Issues to solve:
  • Handle remapped modifier keys.
  • Respect OS keyboard layout when typing text.
  • macOS doesn't seem to register Cmd key for some players.
  • Determine if Esc should be also treated specially.

Risce
Burner Inserter
Burner Inserter
Posts: 11
Joined: Thu Feb 28, 2019 5:50 pm
Contact:

Re: Keybinding issues

Post by Risce »

I propose that modifier keys should be handled by key code, not scan code.

The Ctrl, Escape, Shift, Alt, Meta, (etc) keys are not in meaningfully different places on the keyboard in different layouts. They are more commonly similar in MEANING than in LOCATION. Those of us who have moved their location (by OS remappings, for example) want the INTENTION of the key to move.

It seems that this isn't having the desired effect in Factorio (because of scan code) and that there aren't sufficient control options in Factorio to actually create these mappings in the Factorio settings. (See viewtopic.php?f=7&t=65402)

haifishtime
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Feb 26, 2019 7:20 pm
Contact:

Re: Keybinding issues

Post by haifishtime »

There is also the thing that duplicate keybindings only work with one of the functions. I espacially tested it with and picking up Items as well as getting into vehicles. It worked in 0.16 but doesn't work in 0.17.0 and 0.17.3 anymore.
Since there isn't a warning about duplicate keybinds this seems lika a bug und it probably belongs to the same topic.

tehfreek
Filter Inserter
Filter Inserter
Posts: 391
Joined: Thu Mar 17, 2016 7:34 am
Contact:

Re: Keybinding issues

Post by tehfreek »

haifishtime wrote: ↑
Thu Feb 28, 2019 6:54 pm
There is also the thing that duplicate keybindings only work with one of the functions. I espacially tested it with and picking up Items as well as getting into vehicles. It worked in 0.16 but doesn't work in 0.17.0 and 0.17.3 anymore.
Since there isn't a warning about duplicate keybinds this seems lika a bug und it probably belongs to the same topic.
The thing is that E and Q have multiple bindings and yet no reports have come up regarding them failing to work as expected.

nerhee
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed Feb 27, 2019 6:11 am
Contact:

Re: Keybinding issues

Post by nerhee »

glad that this is already on the radar :D

legendre6891
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Feb 27, 2019 11:12 pm
Contact:

Re: Keybinding issues

Post by legendre6891 »

Really glad this is being looked at. Please consider allowing (under X11, using xkb) Caps Lock to function as Ctrl. This greatly reduces RSI for me, and is important to my painless enjoyment of the game :-)

tsani
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Mar 01, 2019 4:06 am
Contact:

Re: Keybinding issues

Post by tsani »

I think using scancodes is an excellent idea, but the ability to remap the escape key in the controls menu should also be present. In my OS I have the escape and caps lock keys swapped. The upshot is that in factorio pressing the physical escape key has the effect of logically pressing the caps lock key (future text is in uppercase) as well as the escape key (the game pauses and the menu comes up).

kitchsUsername
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Feb 27, 2019 4:54 am
Contact:

Re: Keybinding issues

Post by kitchsUsername »

tehfreek wrote: ↑
Thu Feb 28, 2019 6:57 pm
haifishtime wrote: ↑
Thu Feb 28, 2019 6:54 pm
There is also the thing that duplicate keybindings only work with one of the functions. I espacially tested it with and picking up Items as well as getting into vehicles. It worked in 0.16 but doesn't work in 0.17.0 and 0.17.3 anymore.
Since there isn't a warning about duplicate keybinds this seems lika a bug und it probably belongs to the same topic.
The thing is that E and Q have multiple bindings and yet no reports have come up regarding them failing to work as expected.
I'm wondering if it is solely related to the pickup item function then? I'm suffering the same thing (Pickup bound to Keypad +, which is also the key to enlarge the area for say.. landfill (Yeah, I'm a lefty) ). It worked in all versions I've played before, and does not in 0.17. And I've seen at least two bug reports related specifically to the pickup item key.

haifishtime
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Feb 26, 2019 7:20 pm
Contact:

Re: Keybinding issues

Post by haifishtime »

kitchsUsername wrote: ↑
Fri Mar 01, 2019 5:12 am
tehfreek wrote: ↑
Thu Feb 28, 2019 6:57 pm
haifishtime wrote: ↑
Thu Feb 28, 2019 6:54 pm
There is also the thing that duplicate keybindings only work with one of the functions. I espacially tested it with and picking up Items as well as getting into vehicles. It worked in 0.16 but doesn't work in 0.17.0 and 0.17.3 anymore.
Since there isn't a warning about duplicate keybinds this seems lika a bug und it probably belongs to the same topic.
The thing is that E and Q have multiple bindings and yet no reports have come up regarding them failing to work as expected.
I'm wondering if it is solely related to the pickup item function then? I'm suffering the same thing (Pickup bound to Keypad +, which is also the key to enlarge the area for say.. landfill (Yeah, I'm a lefty) ). It worked in all versions I've played before, and does not in 0.17. And I've seen at least two bug reports related specifically to the pickup item key.
Besides the F key with picking up items and getting into vehicles, I have tried entering vehicles with G which is also bound to coupling trains but I'm not sure if I just didn't use it correctly or if it actually didn't work.

sqwishy
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Mar 01, 2019 10:37 pm
Contact:

Re: Keybinding issues

Post by sqwishy »

I map caps lock to control under X11 and that doesn't work anymore in 0.17 so I'm just posting here to say that I feel sad now.

(0.17 looks really amazing otherwise though.)

User avatar
Ekevoo
Inserter
Inserter
Posts: 47
Joined: Sun May 28, 2017 4:26 am
Contact:

Re: Keybinding issues

Post by Ekevoo »

posila wrote: ↑
Thu Feb 28, 2019 12:41 pm
if there are some other widely used layouts that would benefit from auto-reset (Dvorak? Colemak?), please let me know.
Dvorak user here. I went straight into the tutorial and Compilatron told me to use WAR to move. I was throughly confused and then I realized all my keybindings were completely jammed up again. Then I noticed a conveniently placed reset button (nice!), and noticed it reset to Dvorak-friendly keybindings (NICE!), and that the tutorial caught on, which means saying "use ,AOE to move" NIIIICEEEE

My reaction:
Image

I would be nicer to have it automatically reset and I imagine it would be the same for most Dvorak users but it's kind of second-nature to me to go straight into keybindings immediately when the controls don't make sense, so it didn't feel like a considerable speed bump.
Image

riddochc
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Feb 28, 2019 4:52 am
Contact:

Re: Keybinding issues

Post by riddochc »

So, because of using scancodes, remapping keys in your OS doesn't have any effect on the game. This is intended.
Please, please reconsider this, even if only on Linux.

All of the listed "issues to solve" at the bottom of the post by @posila would be fixed by letting the user's OS-level key mapping do the work for you. It will be *far* easier to support the game if you assume that the user of any non-qwerty layout is accustomed to going into a game's settings for keybindings and adjusting them to whatever they find most convenient with their personal layout.

I wish this were a minor issue for me, but I can't actually play 0.17 yet because it physically hurts to do a lot of one-handed chords with the control key so far away from everything else. I have my control key switched with my caps lock key for this reason.

I'd really, really like to be able to play 0.17!

Please and thank you.

beatryder
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed Mar 06, 2019 8:07 am
Contact:

Re: Keybinding issues

Post by beatryder »

I'm not sure if this is related or not, so please move/delete if it is.

I am on MacOS 10.13 and I am unable to use blueprint books because my mouse scrolls are ignored.

I tried to remap them. but it only detected mouse wheel down, and not up (in any direction).

Further, only the right hand side CMD key is being respected (so removing items from the shortcut bar is a bit annoying)

Pi-C
Smart Inserter
Smart Inserter
Posts: 1297
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Keybinding issues

Post by Pi-C »

riddochc wrote: ↑
Sun Mar 03, 2019 2:57 am
So, because of using scancodes, remapping keys in your OS doesn't have any effect on the game. This is intended.
Please, please reconsider this, even if only on Linux.

All of the listed "issues to solve" at the bottom of the post by @posila would be fixed by letting the user's OS-level key mapping do the work for you. It will be *far* easier to support the game if you assume that the user of any non-qwerty layout is accustomed to going into a game's settings for keybindings and adjusting them to whatever they find most convenient with their personal layout.
Well, I'm on Linux, too, and I had a really hard time before that change. With 0.16.51(yes, I'm relatively new to Factorio, so that is the first version I've played), I couldn't get CTRL to work -- and you really need this for everything (copying/pasting blueprint code from browser to game, inventory operations etc.). Remapping helped, sometimes, but there really was no system to it and changes to keymapping would persist only until I logged out of the system, or even until I restarted Factorio. Mind you, the system itself still worked and recognized CTRL regardless of what physical key it was mapped to -- it was just Factorio that went bonkers. After 0.17 was released, I've reset the keymapping for CTRL; now I just start the game and everything works. So I am very happy that the new Factorio uses scancodes instead of keycodes and would be devastated if this would be reverted. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

beatryder
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed Mar 06, 2019 8:07 am
Contact:

Re: Keybinding issues

Post by beatryder »

Can I revert back to the old way of keybindings?

I am unable to use any shortcut that uses my scroll wheel and it's made blueprints and copy/paste unusable.

I understand the need to be cross compatible, but this change maybe should be reverted until it is fixed.

Rseding91
Factorio Staff
Factorio Staff
Posts: 12275
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Keybinding issues

Post by Rseding91 »

beatryder wrote: ↑
Thu Mar 07, 2019 3:17 am
Can I revert back to the old way of keybindings?

I am unable to use any shortcut that uses my scroll wheel and it's made blueprints and copy/paste unusable.

I understand the need to be cross compatible, but this change maybe should be reverted until it is fixed.
Nope. There is nothing to fix - as the first post here talks about.
If you want to get ahold of me I'm almost always on Discord.

posila
Factorio Staff
Factorio Staff
Posts: 5153
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Keybinding issues

Post by posila »

beatryder wrote: ↑
Thu Mar 07, 2019 3:17 am
I am unable to use any shortcut that uses my scroll wheel and it's made blueprints and copy/paste unusable.
What's your use case of scroll wheel that doesn't work in 0.17 and used to work in 0.16? Changes described in the first post are exclusive to keyboard presses (and maybe HW that emulates keyboard presses in some way)

sqwishy
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Mar 01, 2019 10:37 pm
Contact:

Re: Keybinding issues

Post by sqwishy »

Rseding91 wrote: ↑
Thu Mar 07, 2019 9:35 pm
Nope. There is nothing to fix - as the first post here talks about.
Are you saying that the way keybindings work in Factorio in 0.17 is considered complete? The first post mentions several issues:
My point is - in-game controls are (and should be) based on positions of keys on keyboard, if they don't feel right to you, change them in control settings.

Problem is - the game won't let you use any key as a modifier key, so we need to solve that somehow. Most likely fix will be detecting modifier keys based on keycode instead of scancode.

Issues to solve:

Handle remapped modifier keys.
Respect OS keyboard layout when typing text.
macOS doesn't seem to register Cmd key for some players.
Determine if Esc should be also treated specially.
At the moment, Factorio doesn't support rebinding the keys so that they behave as they did in 0.16. My reading of what I quoted above is that this will be fixed as a compromise (in lieu of respecting how the user has configured their system and behaving predictably, like every other application). If not, maybe don't statically link with SDL so users can hack the key events with LD_PRELOAD or something?

Have I misunderstood your post that "there is nothing to fix" or the original post?

brab
Long Handed Inserter
Long Handed Inserter
Posts: 52
Joined: Sun May 18, 2014 2:08 pm
Contact:

Re: Keybinding issues

Post by brab »

legendre6891 wrote: ↑
Thu Feb 28, 2019 7:22 pm
Really glad this is being looked at. Please consider allowing (under X11, using xkb) Caps Lock to function as Ctrl. This greatly reduces RSI for me, and is important to my painless enjoyment of the game :-)
Same here. I cannot use the in-game settings to change this, as caps-lock + left mouse button is only interpreted as left-mouse button.

kivsiak
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Feb 27, 2019 3:18 pm
Contact:

Re: Keybinding issues

Post by kivsiak »

Same problem here. I have altered ctrl-win-alt block. And i cannot use WIN key cause it not recognized by factorio. And i cannot CTL key cause it remapped to WIN and start system launcher.

Post Reply

Return to β€œResolved Problems and Bugs”