From 8d40777e5c8b5a0089be3e17f91d8d76a15ce835 Mon Sep 17 00:00:00 2001 From: Vincent de Lau Date: Thu, 18 Apr 2024 16:00:50 +0200 Subject: [PATCH] Update README, add instructions for exporting and transforming KLC files --- README.md | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 45527a0..f7aac7a 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,33 @@ -The [EurKEY keyboard layout](https://eurkey.steffen.bruentjen.eu/start.html) -source for the [Keyboard Layout Files Creator]( https://github.com/39aldo39/klfc) +The [EurKEY keyboard layout](https://eurkey.steffen.bruentjen.eu/start.html) +source for the [Keyboard Layout Files Creator]( https://github.com/39aldo39/klfc) (KLFC) Build with: ``` $ klfc eurkey.json altgr.json control.json deadkeys.json -o output -``` +``` The layout is split into multiple files: - `eurkey.json`, the main file, includes the None and Shift shift-states - `altgr.json`, includes the AltGr and Shift-AltGr shift-states, except dead keys - `control.json`, includes the Control shift-states, mostly for some control characters -- `deadkeys.json`, (Shift-)AltGr shift states for the dead keys and dead key key pairs +- `deadkeys.json`, (Shift-)AltGr shift states for the dead keys and dead key key pairs + + +## Converting a MSKLC file to JSON + +The [Microsoft Keyboard Layout Creator](https://www.microsoft.com/en-us/download/details.aspx?id=102134) (MSKLC) can export a keymap to a KLC file. KLFC currently not read such a file directly. + +MSKLC was used to extract the information from an installed EurKEY layout. MSKLC exports to KLC files, which KLFC can work with. + +To convert the KLC file from UCS2 (UTF-16) to UTF-8, you can use `iconv`. The additional `sed` command removes the Byte-Order-Mark. +``` +iconv -f ucs2 -t utf8 eurkey.klc | sed '1s/^\xEF\xBB\xBF//' > eurkey.utf8.klc +``` + +KLFC can than convert the KLC file to a JSON file. +``` +klfc --from-klc eurkey.utf8.klc --json eurkey.json +``` + +This JSON file has been split up by hand into the individual files to create a bit of logical separation.