Skip to main content

KBMAP

Linux keyboard mapping utility

About

Mapping physical keyboard keys under Linux system is tricky. Since there is multiple places where you can interrupt and handle keystroke, there is a ton of solutions for different levels. KBMAP focuses on handling keystroke straight from the physical device, before converting keycode to the keysym (it's a place, where windowing system applies keyboard layouts and locales).

KBMAP allows you to apply flexible configurations directly to the keyboard input device without writing a mess of C code or breaking system config files.

KBMAP is heavily inspired by QMK - highly customizable mechanical keyboard firmware. Basically, ideally KBMAP will be the QMK of any non-programmable keyboard (and maybe not only keyboard).

Installing

pip install kbmap

Usage

Usage: kbmap [OPTIONS] DEVICE_NAME

  Create virtual device that will remap keyboard events from device with
  name DEVICE_NAME.

Options:
  --version          Show the version and exit.
  -c, --config TEXT  Mapping configuration path.
  -n, --name TEXT    Name of the virtual device that will write events.
  -v, --verbose      Print detailed logs.
  --help             Show this message and exit.

FAQ

Q: How it works?
A: KBMAP uses evdev - a Linux input event interface. There is python binding for evdev library: python-evdev. Mapping algorithm:

  1. Find a target device by name (specified with DEVICE_NAME argument)
  2. Create new uinput device (kind of a virtual input device) with specified name (--name option)
  3. Grab target device (so only KBMAP process receive input events)
  4. Listen for key events from target device
  5. Perform remapping based on config file (specified with CONFIG_PATH argument)
  6. Dispatch events through created uinput device

Q: Linux only?
A: Yes, since evdev is a specific Linux interface, KBMAP cannot be used on non-unix operating systems.

Q: Alternatives for Windows?
A: AutoHotkey.

Q: How is KBMAP related to QMK?
A: QMK has a lot of mapping features. But QMK is a firmware and you cannot use it unless your keyboard is programmable. The mind behind KBMAP is to allow non-programmable keyboard users to achieve QMK-like customizability with their input device. Current goal is to reach TMK (a program, QMK being forked from) functionality.

Q: I am getting UInputError: "/dev/uinput" cannot be opened for writing.
A: Solution.

Q: How to run KBMAP at system boot?
A: It can be done in several ways, check out stackoverflow question and Arch Linux wiki page.

Q: What features are already implemented?
Q: How to configure KBMAP?
Q: KBMAP keycodes?
A: See wiki.

Documentation

Documentation and useful resources can be found in wiki.

Metadata

Release files for kbmap 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kbmap 1.1.0
File Size Uploaded Provenance Actions
kbmap-1.1.0.tar.gz 16.7 kB Without provenance Details for kbmap-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kbmap 1.1.0
File Interpreter ABI Platform Actions
kbmap-1.1.0-py3-none-any.whl Python 3 none any Details for kbmap-1.1.0-py3-none-any.whl

Total release size: 39.7 kB

Release files / kbmap-1.1.0.tar.gz

Download URL kbmap-1.1.0.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0eb08704761a82c6dd03486aeaad84c40179ed1c79232ecaed5ff9b7d8aa36f7
BLAKE2b-256 checksum
How to use checksums
60cd34bac3adb30bd7e7a1f21c0a775af05f5e4ec61278303b3b5a983157e370
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.5

Release files / kbmap-1.1.0-py3-none-any.whl

Download URL kbmap-1.1.0-py3-none-any.whl
Size 23.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b122c0c3aa2cbaf1792f3a2cde34f8c22ae00886673b7f84886390441b4bd171
BLAKE2b-256 checksum
How to use checksums
9eec6ab842d472d67b14e8246fed3dfe8039d8fbad8fba22b6d072facba17067
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.5

Security for kbmap 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page