Skip to main content

A daemon to remap key events on linux input devices

Project description

evdevremapkeys

A daemon to remap key events on linux input devices

Motivation

The remapping of input key events is an problem, and one that has been solved at many levels over the years. On a traditional X11 desktop, the usual way to do this is with xbindkeys; it's simple and effective and you shouldn't try and write something different.

However, with the shift to Wayland, we have a problem. Wayland obviously isn't X11 so any X11 based remapping utility isn't going to work. Wayland compositors typically use libinput to manage input events, but while libinput supports remapping conceptually, it does not expose any mechanism to configure it. This is left as an exercise to the compositor and neither Weston nor Mutter expose remapping.

So where does this leave us? If we are to provide a remapping mechanism that is not dependent on the compositor, it must run below libinput, which means it must work with the linux input subsystem. And so, here we are.

Technical approach

There's only one real sane approach to doing event remapping at the input subsystem level: Read events from physical input devices, and then generate new input events on a virtual device managed through uinput.

One legitimate question is whether the virtual device attempts to fully replicate the original physical device, just with remapped events, or whether it's a dedicate device that only emits the new events which leaving the physical device free to send events directly to other clients.

Depending on your exact use-case, you might be able to leave the original physical device as-is, but for me, it turned out that I had to swallow the original events because they will be picked up by libinput and then trigger actions in my desktop environment.

To avoid this, you have to take a grab on the physical device, so no other client receives events, and then forward all un-modified events through your virtual device. It's annoying but unavoidable - you can't hide individual events from other clients.

Software Setup

Install from PyPI

The recommended way to install the program is to use pipx.

$ pipx install evdevremapkeys

You can also use pip, but on modern distros, pipx is a far better experience.

Create a configuration

You will need to create an initial configuration file for the program to be able to run and doing anything useful.

It's recommended to start from one of the example config files and adapt it for your hardware and the remapping you need.

Place your final file at: ~/.config/evdevremapkeys/config.yml

Run the program

evdevremapkeys

More details

See RUNNING.md for more details.

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

evdevremapkeys-1.0.3.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

evdevremapkeys-1.0.3-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file evdevremapkeys-1.0.3.tar.gz.

File metadata

  • Download URL: evdevremapkeys-1.0.3.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for evdevremapkeys-1.0.3.tar.gz
Algorithm Hash digest
SHA256 b98b8d8bfad023bde80bdd6fe9bc877ff62ebd793236e6473780a43a12da3fcd
MD5 16f129fd3e6aa61b60549cb361cbfa8a
BLAKE2b-256 856dde4be1715f786c69842445443ec1b64403b55de50285a0d1153d3ade3f9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for evdevremapkeys-1.0.3.tar.gz:

Publisher: unittests.yml on philipl/evdevremapkeys

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file evdevremapkeys-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: evdevremapkeys-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for evdevremapkeys-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3ddb452242d1ae7adc4063c27842a3b6020280ebc4173769f4597f9065a4d893
MD5 8fd2c59bcef832016c03536a581f3569
BLAKE2b-256 5665a1ef649ed3292e056c697c7f644f5520a2d28b59cca49d599e961a57cfac

See more details on using hashes here.

Provenance

The following attestation bundles were made for evdevremapkeys-1.0.3-py3-none-any.whl:

Publisher: unittests.yml on philipl/evdevremapkeys

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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