||9 months ago|
|.git-assets||1 year ago|
|klf||9 months ago|
|output||9 months ago|
|svg||9 months ago|
|LICENSE||1 year ago|
|README.md||1 year ago|
|keys.txt||9 months ago|
|klf2tux.py||9 months ago|
|translations.json||9 months ago|
Converts Keyboard Layout Files to TUXEDO Computers SVG keyboard layout.
Works with Python 3.
Allows anyone to convert their personal keyboard layout from XKB, PKL, KLC, Keylayout, TMK and AHK format to a TUXEDO keyboard layout SVG file for laser printing.
NB: "Keyboard Layout Files" refers to the JSON format generated by the klfc tool. It isn't an official term.
klfc is a tool to convert keyboard layout formats.
klf2tux uses their JSON output format to replace values in Tuxedo's SVG keyboard layout, which first needs to be edited to be a "template SVG".
Create a SVG template
The first step is to get a SVG keyboard layout template. If you already have one, you can skip this step.
If you can't find the corresponding template for your model, you'll have make it from one of the official SVG keyboard layouts from TUXEDO Computers repositories, which are open-source and available here: https://github.com/tuxedocomputers/keyboard-layouts
Here's an example with the InfinityBook Pro 15.
The official keyboard layout for this model (with QWERTY en-US) looks like this:
- Open your favourite SVG editor (Inkscape is fine) and replace all the letters with the percent
- Write four
%per key (for regular, Shift, AltGr and Shift+AltGr letters).
- Try to align them all, to center them perfectly on each single key. Use the measurement tool and the zoom for more accuracy.
- Write four
You've done half of the work.
- Replace translated texts like "Home" or "SysRq" with the corresponding template value.
- Check out keys.txt file and/or the template below to know which value you should write.
- You don't care if it the text is larger than the key, the script will replace it anyway.
- Special case for ESC workaround: you must create two "Esc" keys (
%ESC2) to avoid overflow if the "Esc" translation is larger than 3 characters.
- Replace each percent with its corresponding uppercase letter on the QWERTY keyboard layout and the following letter:
Nfor a regular lowercase (bottom-left) letter ;
Ufor an uppercase (top-left) letter ;
Afor a lowercase AltGr letter ;
Gfor an uppercase AltGr letter.
- For example, the uppercase
Qletter will become
%QUon the keyboard.
Qkey on the keyboard will have
%QNat the bottom-left,
%QUat the top-left,
%QAat the bottom-right and
%QGat the top-right.
- Note: Since this step is a hassle, you can try to copy-paste all keys from an already existing template, for another computer model, which uses the same (or similar) spacing as yours.
Here's the final result for the model we're working with:
You're done. Please consider making your work available to other people by uploading it and sharing it, so no one will have to go through this hassle again.
Convert your keyboard layout to KLF
Now the easy steps.
We'll use klfc to convert your layout to a JSON format.
At the time of writing, klfc supports XKB, PKL, KLC, keylayout, TMK and AHK formats.
git clone https://github.com/39aldo39/klfc cd klfc ./klfc <your keyboard layout> > your-layout.klf
You can find the default keyboard layouts in
/usr/share/X11/xkb/symbols/ for most Linux distributions.
For example, to get the French AZERTY keyboard layout from a XKB file, use this command:
./klfc "/usr/share/X11/xkb/symbols/fr(azerty)" > fr-azerty.klf
This is the most simple AZERTY variant, but you can use another variant by changing the variant name in parenthesis.
Don't forget that if you decide do use a variant with a lot of AltGr and AltGr+Shift keys, your keyboard layout will display those keys as well, so you might prefer simplified layouts.
Beware of the layout type of your computer model (ISO vs ANSI). Your selected layout might not include a binding for the "Iso" key. More information about this here.
Please refer to klfc's documentation for help: https://github.com/39aldo39/klfc
Convert your KLF to a TUXEDO Computers keyboard layout using your model template
Now you should have everything you need.
git clone https://git.42l.fr/neil/klf2tux cd klf2tux ./klf2tux.py <yourtemplate.svg> <yourlayout.klf> <your language code> > final-layout.svg
yourtemplate.svgwith your SVG keyboard template
yourlayout.klfwith the JSON file you just retreived from klfc
your language codewith a two-letter code representing your language. For now, klf2tux supports
de. Feel free to add your own language or to edit translated strings in
Example (used to generate example outputs in the
./klf2tux.py "svg/InfinityBook Pro 15 - Inter.svg" klf/azerty-simple.klf fr > output/fr-azerty-simple.svg ./klf2tux.py "svg/InfinityBook Pro 15 - Inter.svg" klf/bepo.klf fr > output/fr-bepo.svg ./klf2tux.py "svg/InfinityBook Pro 15 - Inter.svg" klf/qwerty-simple.klf en > output/en-qwerty-simple.svg ./klf2tux.py "svg/InfinityBook Pro 15 - Inter.svg" klf/qwerty-intl.klf en > output/en-qwerty-intl.svg ./klf2tux.py "svg/InfinityBook Pro 15 - Inter.svg" klf/qwertz.klf de > output/de-qwertz.svg
Double check the final result. Check if everything is mapped correctly: the Iso key, Escape key... also ensure that no letters or words are larger than the keys. If it isn't the case, you can slightly edit the SVG file manually. Feel free to upload your work for other people.
Then you have your final result:
Print a clean layout with script parameters
Unless you prefer having all the letters (including AltGr and AltGr+Shift) displayed on your keyboard, the easiest way to map your layout is to find a simplified layout in
If you can't find a simplified layout, you can edit the script (lines 15 and 21) and set the following values:
This will hide all AltGr and AltGr+Shift keys from the layout, except AltGr keys for the number row (which seems to be an average standard). If you don't want the AltGr keys in the number row, set
Hide duplicate letters
HIDE_DUPLICATE is enabled by default and will prevent the same letters from appearing on the same key (e.g. if
/ and altgr+
/ both prints a
/, the altgr+
/ key will be hidden).
If you don't want this behavior, set the
HIDE_DUPLICATE variable to
Disclaimer: I'm not personally affiliated with TUXEDO Computers of any way.
klf2tux.py is under WTFPL.
This repository includes partial content from: