Skip to main content

a cross-platform Keyboard Layout Maker

Project description

A cross-platform Keyboard Layout Maker, blatantly stolen from the qwerty-lafayette project.

Basic Usage

Draw your keyboard layout in ASCII-art and include it in a TOML document:

name = "qwerty-ansi"
name8 = "q-ansi"
description = "QWERTY-US layout"
version = "1.0.0"
geometry = "ANSI"

base = '''
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┲━━━━━━━━━━┓
│ ~   │ !   │ @   │ #   │ $   │ %   │ ^   │ &   │ *   │ (   │ )   │ _   │ +   ┃          ┃
│ `   │ 1   │ 2   │ 3   │ 4   │ 5   │ 6   │ 7   │ 8   │ 9   │ 0   │ -   │ =   ┃ ⌫        ┃
┢━━━━━┷━━┱──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┺━━┯━━━━━━━┩
┃        ┃ Q   │ W   │ E   │ R   │ T   │ Y   │ U   │ I   │ O   │ P   │ {   │ }   │ |     │
┃ ↹      ┃     │     │     │     │     │     │     │     │     │     │ [   │ ]   │ \     │
┣━━━━━━━━┻┱────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┲━━━━┷━━━━━━━┪
┃         ┃ A   │ S   │ D   │ F   │ G   │ H   │ J   │ K   │ L   │ :   │ "   ┃            ┃
┃ ⇬       ┃     │     │     │     │     │     │     │     │     │ ;   │ '   ┃ ⏎          ┃
┣━━━━━━━━━┻━━┱──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┲━━┻━━━━━━━━━━━━┫
┃            ┃ Z   │ X   │ C   │ V   │ B   │ N   │ M   │ <   │ >   │ ?   ┃               ┃
┃ ⇧          ┃     │     │     │     │     │     │     │ ,   │ .   │ /   ┃ ⇧             ┃
┣━━━━━━━┳━━━━┻━━┳━━┷━━━━┱┴─────┴─────┴─────┴─────┴─────┴─┲━━━┷━━━┳━┷━━━━━╋━━━━━━━┳━━━━━━━┫
┃       ┃       ┃       ┃                                ┃       ┃       ┃       ┃       ┃
┃ Ctrl  ┃ super ┃ Alt   ┃ ␣                              ┃ Alt   ┃ super ┃ menu  ┃ Ctrl  ┃
┗━━━━━━━┻━━━━━━━┻━━━━━━━┹────────────────────────────────┺━━━━━━━┻━━━━━━━┻━━━━━━━┻━━━━━━━┛
'''

Build it:

kalamine qwerty-ansi.toml

If you get some UnicodeEncodeError on Windows, try specify this environment variable before executing Kalamine

$Env:PYTHONUTF8 = 1

Get all keyboard drivers:

dist/
├── q-ansi.klc        # Windows
├── q-ansi.keylayout  # macOS
├── q-ansi.xkb        # Linux
└── q-ansi.json

Install

Windows

  • download a keyboard layout installer:

    • either MSKLC — proprietary freeware, compatible with Windows XP to 10

    • or KbdEdit — proprietary shareware, compatible with Windows XP to 10

  • run this installer to generate a setup program;

  • run the setup program;

  • the keyboard layout appears in the language bar.

macOS

  • copy your *.keylayout file into:

    • either ~/Library/Keyboard Layouts for the current user only,

    • or /Library/Keyboard Layouts for all users;

  • restart your session;

  • the keyboard layout appears in the “Language and Text” preferences, “Input Methods” tab.

Linux

On Xorg, *.xkb keyboard descriptions can be applied with xkbcomp:

xkbcomp -w10 layout.xkb $DISPLAY

To get back to the standard us-qwerty layout:

setxkbmap us

XKalamine

xkalamine is a Linux-specific tool for managing keyboard layouts with xkb.

To apply a keyboard layout in user-space:

# equivalent to `xkbcomp -w10 layout.xkb $DISPLAY`
xkalamine apply layout.toml

This has limitations: it doesn’t work on Wayland and the keyboard layout doesn’t show up in the Gnome keyboard manager. Besides, on some distros, media keys might stop working.

The proper way to install a keyboard layout on Linux is to modify directly the files in /usr/share/X11/xkb. This is where xkalamine comes in:

sudo xkalamine install layout.toml

There’s also:

  • xkalamine list to enumerate all installed Kalamine layouts

  • xkalamine remove to uninstall a Kalamine layout

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kalamine-0.15.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

kalamine-0.15-py3-none-any.whl (35.4 kB view details)

Uploaded Python 3

File details

Details for the file kalamine-0.15.tar.gz.

File metadata

  • Download URL: kalamine-0.15.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for kalamine-0.15.tar.gz
Algorithm Hash digest
SHA256 9ad2c5d6bd95f35a87bc07bfa0fa461ad4d0847c64920313b118490275df3b40
MD5 3e57a66178a602bafea85e576d35379d
BLAKE2b-256 761c06c300c00c9c60771bca4ddbcff8a8887ebf80b7001e37bd4be25d070bca

See more details on using hashes here.

File details

Details for the file kalamine-0.15-py3-none-any.whl.

File metadata

  • Download URL: kalamine-0.15-py3-none-any.whl
  • Upload date:
  • Size: 35.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for kalamine-0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 e7f9e47549bfe26e635dd69299382e20ba2af0c01c74269a54b9e6686d4a78ee
MD5 063f9a1738b319210e145c6e7072d0db
BLAKE2b-256 ed6523453a5d50516f7834f3c6e9c508a0524b96453a108bbf48ccb1aad0bfb7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page