Skip to main content

No project description provided

Project description

map2

Linux input remapping
Remap your keyboard, mouse, controller and more!

GitHub MIT License Discord Build Donate

Want to remap your input devices like keyboards, mice, controllers and more?
There's nothing you can't remap with map2!

  • 🖱️ Remap keys, mouse events, controllers, pedals, and more!
  • 🔧 Highly configurable, using Python
  • 🚀 Blazingly fast, written in Rust
  • 📦 Tiny install size (around 5Mb), almost no dependencies
  • ❤️ Open source, made with love

Visit our official documentation for the full feature list and API.


If you like open source, consider supporting

Buy Me a Coffee at ko-fi.com

Install

The easiest way is to use pip:

pip install map2

For more, check out the Install documentation.

After installing, please read the Getting started documentation.

Example

import map2

# readers intercept all keyboard inputs and forward them
reader = map2.Reader(patterns=["/dev/input/by-id/my-keyboard"])
# mappers change inputs, you can also chain multiple mappers!
mapper = map2.Mapper()
# writers create new virtual devices we can write into
writer = map2.Writer(clone_from = "/dev/input/by-id/my-keyboard")
# finally, link nodes to control the event flow
map2.link([reader, mapper, writer])

# map the "a" key to "B"
mapper.map("a", "B")

# map "CTRL + ALT + u" to "META + SHIFT + w"
mapper.map("^!u", "#+w")

# key sequences are also supported
mapper.map("s", "hello world!")

# use the full power of Python using functions
def custom_function(key, state):
  print("called custom function")

  # custom conditions and complex sequences
  if key == "d":
    return "{ctrl down}a{ctrl up}"
  return True

mapper.map("d", custom_function)

Build from source

To build from source, make sure python and rust are installed.

# create a python virtual environment
python -m venv .env
source .env/bin/activate

# build the library
maturin develop

While the virtual environment is activated, all scripts ran from this terminal will use the newly built version of map2.

Contributing

If you want to report bugs, add suggestions or help out with development please check the Discord channel and the issues page and open an issue if it doesn't exist yet.

License

MIT

Authors

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

map2-2.0.11-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

map2-2.0.11-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (3.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

map2-2.0.11-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

map2-2.0.11-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (3.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

map2-2.0.11-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

map2-2.0.11-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (3.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

map2-2.0.11-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

map2-2.0.11-pp37-pypy37_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (3.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

map2-2.0.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

map2-2.0.11-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (3.2 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686

map2-2.0.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

map2-2.0.11-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (3.2 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

map2-2.0.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

map2-2.0.11-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (3.2 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

map2-2.0.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

map2-2.0.11-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (3.2 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

map2-2.0.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

map2-2.0.11-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl (3.2 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686

map2-2.0.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

map2-2.0.11-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl (3.2 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ i686

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