Program the keyboard with QMK US international setting and use setxkbmap -layoub us
-variant altgr-intl
in your X11 based OS (e.g., all distros that use Gnome, KDE, Xfce,
i3, etc).
When å is typed on a Swedish keyboard, it is in fact the [ character that is typed and the OS, with the Swedish keyboard layout, maps the appropriate character. This means that there are no language-specific characters in QMK. However, QMK provides language-specific keycode aliases for many keyboard layouts, these can be found here.
There are three ways to get non-English characters in the QMK firmware. You can use the language-specific keycodes (e.g., the Swedish layout), you can use the US international keycodes, and you can output Unicode characters. I´ve tried all three, all have compromises, but to me the US international option is the best.
The language specific layout means that you use QMK´s language specific keycodes and you
change the keyboard layout in your OS to, e.g., Swedish with setxkbmap se
. The problem
with this is that you cannot use the regular KC mapping in QMK, this means that you
cannot use the QMK Configurator website, and it becomes a bit tedious when you want to
try new layouts and change settings. If this is not a problem for you this option might
be a good choice.
I have also tried to output Unicode characters from the keyboard and have had some problems with how the OS interprets them. Furthermore, each OS potentially interprets them differently, so switching computers might be limiting, and therefore not very general.
Lastly, the US international layout is initiated on Linux by setxkbmap -layout us
-variant intl
and allows the keyboard to write, e.g., ö by first pressing “ and then
pressing o. However, this is not usable since the “ key is changed to another character!
A dead key (“) that can create, e.g., an ö, but it is not the “ character! This means
that you cannot use this for coding! If you write git commit -m "Add awesome update"
it will not work, since you are not actually typing the charater “ that git can
interpret as a string. The solution is to use setxkbmap -layout us -variant
altgr-intl
, which solves all of my problems. Now “ is typed as it should, my åäö are on
my specific keys.
What follows is the steps I took to flash my Corne keyboard such that I can use åäö in the US international layout.
python3 -m pip install --user qmk
qmk setup
You can set your default keyboard and your default keymap with:
qmk config user.keyboard=<keyboard>
qmk config user.keymap=<github_username>
cd ~/qmk_firemware/keyboards/<keyboard>/keymap/
mkdir <github_username>
where <keyboard>
is, e.g., crkbd
if you are using the Corne like me.
To set language-specific characters, you can create a regular keymap using the
QMK Configurator, leave the keys where you want your language
specific characters blank (“KC_NO”), compile it, and save it on your computer as json
.
Now, navigate to where you saved your json
keymap and run:
qmk json2c crkbd_rev1_new_crkbd_rev1.json -o keymap.c
cp keymap.c /home/magnus/qmk_firmware/keyboards/crkbd/keymaps/HanssonMagnus
Also paste the default config.h
for your keyboard into the same directory, it is
located, e.g., at
/home/magnus/qmk_firmware/keyboards/crkbd/keymaps/default/
. This is where you can
change TAPPING_TERM
etc, I usually have the tapping term set to 100
.
In ~/qmk_fireware/quantum/keymap_extras/
you will find all the language-specific
keymap files, in my case keymap_us_international.h
. Include your keymap file in
keymap.c
by adding:
#include "keymap_us_international.h"
You can now replace your KC_NO
positions with the keycodes defined in the
language-specific keymap file. E.g., in the keymap_us_international.h
there is:
#define US_ODIA ALGR(US_P) // Ö
Thus, you can write US_ODIA
instead of KC_NO
for the key you want to be öÖ.
You might want to copy the rules.mk
to your keymap directory and modify it such that
you can use media keys:
cd ~/qmk_firmware/keyboards/crkbd/keymaps/HanssonMagnus
cp ~/qmk_firmware/keyboards/crkbd/rules.mk ./rules.mk
Then you can add the following to that file:
EXTRAKEY_ENABLE = yes
Before flashing the firmware onto our keyboard it is a good idea to compile it locally to check for any errors.
cd ~/qmk_firmware/keyboards/crkbd/keymaps/HanssonMagnus
qmk compile -kb crkbd/rev1 -km HanssonMagnus
You will see [OK]
outputted if each step is successful.
On my Corne keyboard I have two different microcontrollers on the halves. Elite-C on the left half and Pro Micro on the right. The reason is just that the Pro Micro is cheaper, but I wanted a USB-C port on the half that is connected to the computer.
The Elite-C and Pro Micro have different boot loaders and therefore they need to be flashed differently.
Flash the firmware onto the device by:
cd ~/qmk_firmware/keyboards/crkbd/keymaps/HanssonMagnus
qmk flash -kb crkbd/rev1 -km HanssonMagnus -bl dfu
QMK will tell you in the terminal to reset the microcontroller. Press the reset button on the Elite-C or short the GND and RST (ground and reset) pins on the controller with tweezers if there’s no reset button.
qmk flash -kb crkbd/rev1 -km HanssonMagnus -bl avrdude
Reset the microcontroller in the same way as with the Elite-C.