0

I've just installed i3 with the default configuration, and there's a major issue with keyboard shortcuts: even though my keyboard layout isn't QWERTY the keyboard shortcuts are mapped to the relevant QWERTY keys. So I have to press Win+the key marked "F" in the QWERTY layout to fullscreen a window, even though pressing that key produces a "u" character (in Dvorak layout). How do I work around this so that pressing Win+f works in any layout, without needing separate configuration per layout?

1

Short answer:

If you want to use the default configuration, you can just copy /etc/i3/config to ~/.config/i3/config (or ~/.i3/config; replace whichever already exists to avoid confusion).

Long answer:

i3 supports configuring keyboard shortcuts by key symbols as well as by key codes.

  • Key symbols are the characters that are sent by a keypress and depend on the keyboard layout. They are bound with the bindsym keyword. For example, in order to bind toggle fullscreen to the combination of Win and the key that sends an "f" you would use:

     bindsym Mod4+f fullscreen toggle
    

    This method lends itself for use with mnemonics (Fullscreen, reSize, etc.) and you can immediately find the desired shortcut by just looking at the configuration. But if you switch between keyboard layouts, the key might also move around. Also if you switch between differing alphabets not every symbol will be represented in both layouts.

  • Key codes represent the physical key on the keyboard and do not depend on the keyboard layout but only on the keyboard model (e.g. pc104, pc105). In order to bind toggle fullscreen to the combination of Win and the key that is labeled as F on an US keyboard (homerow, left index finger) :

     bindcode Mod4+41 fullscreen toggle
    

    This method keeps shortcuts in the same physical place across differing keyboard layouts. This is especially useful, if you sometimes switch between layouts but find your shortcuts mostly by muscle memory. On the other hand the configuration is not very readable (f vs. 41).

Depending on personal preference you might want to choose either method. You can even mix them but you have to take some care to not assign the same key twice, e.g. bindsym f … and bindcode 41 … at the same time.

Usually i3 packages come with a default configuration for each method. /etc/i3/config for bindsym and /etc/i3/config.keycodes for bindcode. If i3 does not find a user configuration, it offers to create one using i3-config-wizard. This takes the config.keycodes default configuration and replaces all bindcode configurations by the equivalent bindsym configurations on the current keyboard layout. This ensures that all keys are in the same location as shown in the User's Guide and that the configuration file is easily understandable at the same time. The drawback is of course that it breaks some mnemonics if you are not using a QWERTY or QWERTZ layout.


My personal suggestion would be to have a (long) look at the User's Guide and only use the default configuration as a starting point to create your own configuration, that fits your workflow and preferences.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.