- Python 77.6%
- Nix 11.4%
- Shell 6%
- PowerShell 5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
xkeyboard-config_custom derives <shortDescription> from the layout name, so 'win8layout' produced the ugly taskbar short label 'win'. Naming the layout 'en' makes KDE show 'en' natively (like us -> en, ru -> ru). |
||
| data | ||
| dll | ||
| symbols | ||
| test | ||
| tools | ||
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| MAPPING.md | ||
| README.md | ||
win8layout
If you're like me (probably not, I haven't met a single person that has this same setup willingly), you're maybe used to the Windows UK layout because of it being your main OS your whole life, but you switched to Linux and, since you have an ANSI keyboard (because it's much better than ISO IMO), there's literally no such layout anywhere and you feel the pain.
No one on forums helps you with the issue, no response on KDE Matrix, no response on any of the Discord servers, LLMs won't help you with the issue, etc.
And that's why I decided to solve this once and for all, after using "UK, extended, Windows" + "UK, Macintosh, intl." for a year as a workaround.
Why every Linux UK layout is wrong for this?
Linux's gb and Windows UK agree on the base layer. The difference is the #~ key (scancode 0x2B, the backslash key on ANSI keyboards):
| base | Shift | AltGr | AltGr+Shift | |
|---|---|---|---|---|
| Windows UK / win8layout | # |
~ |
\ |
| |
Linux gb |
# |
~ |
— | — |
First, I checked ReactOS' kbduk.c (great project btw), and noticed that it has the same layout that Linux has, so I understood that it must be a version difference.
Apparently, Microsoft added that AltGr layer in Windows 8 so UK layout users on ANSI keyboards could still type \ and | (Shift + Right Alt + backslash = |). Linux's gb seems to be from the pre-Win8 layout, so it doesn't have it.
Full version history (from kbdlayout.info's dumps of every kbduk.dll back to NT 3.1):
| Windows | kbduk.dll |
AltGr \ / | on the #~ key |
|---|---|---|
| NT 3.1 / 3.5 / 4 | 3.10 / 3.50 / 4.0 | — |
| 2000 | 5.0.2180.1 | — |
| XP | 5.1.2600.0 | — |
| Vista | 6.0.6000.16386 | — |
| 7 | 6.1.7600.16385 | — |
| 8 → 11 | 6.2.8250.0 … 10.0.29667.1000 | \ / | |
The AltGr \ | layer arrived with Windows 8 and hasn't changed since.
So what's this repo?
The United Kingdom layout from Windows 8 onwards, extracted from Microsoft's own KBDUK.DLL and converted to XKB.
Packaged as a NixOS module.
Install
# flake.nix
inputs.win8layout.url = "git+https://git.versette.me/Versette/win8layout";
# your nixosConfiguration
imports = [ inputs.win8layout.nixosModules.default ];
The layout shows up as English (UK, Windows 8+) in KDE (System Settings → Keyboard → Layouts → Add — re-login once after switching, so the session picks up XKB_CONFIG_ROOT), or set it system-wide with services.xserver.xkb.layout = "en";.
It's registered under the XKB layout code en (not win8layout), so the taskbar shows the short label en instead of win, same as other layouts (us → en, ru → ru). If you set a manual short label in the KDE layout settings, you can remove it — this is handled upstream now.
It's registered through services.xserver.xkb.extraLayouts. NixOS merges it into the system-wide xkeyboard-config and exports XKB_CONFIG_ROOT, which libxkbcommon honours.
Verify
nix develop -c ./test/verify.sh
Compiles the layout with xkbcomp, then checks character → key + level resolution through libxkbcommon (xkbcli how-to-type, the same library Plasma uses).
About UK Extended
Windows ships a second UK layout, United Kingdom Extended (KBDUKX.DLL, the one with dead keys for à é ñ ü, etc.). It's deliberately not part of this repo, since I don't use it, but it can be extracted and converted in the same way. tools/parse_kbd.py should already handle dead keys.
Additional info
dll/KBDUK.DLLwas extracted from the officialWindows 11 x64 en-GB build 26300ISO. Per the table above, any Windows 8 or newer ISO contains the identical layout DLL.tools/parse_kbd.pywalks the DLL'sKBDTABLESstructure (self-contained PE parser) and dumps every scancode x modifier state plus the modifier/CapsLock maps todata/KBDUK.json.tools/gen_xkb.pygeneratessymbols/enandMAPPING.mdfrom it.- To regenerate from a fresh ISO,
tools/get-iso-url.ps1prints an official download URL (wraps Fido so it runs on Linux). The tool headers document the rest of the pipeline. - Intentional differences: Ctrl combos are not encoded (Windows marks them
WCH_NONE; XKB's standard Control handling covers letters identically), and only Right Alt is AltGr, where Windows also accepts Ctrl+Alt.