|neil 5e4b4a1151||1 month ago|
|.git-assets||1 month ago|
|klf||1 month ago|
|output||1 month ago|
|svg||1 month ago|
|LICENSE||1 month ago|
|README.md||1 month ago|
|keys.txt||1 month ago|
|klf2tux.py||1 month ago|
|translations.json||1 month 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".
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:
%per key (for regular, Shift, AltGr and Shift+AltGr letters).
You've done half of the work.
%ESC2) to avoid overflow if the "Esc" translation is larger than 3 characters.
Nfor a regular lowercase (bottom-left) letter ;
Ufor an uppercase (top-left) letter ;
Afor a lowercase AltGr letter ;
Gfor an uppercase AltGr letter.
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.
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.
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
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:
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 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: