2020-11-26 22:45:24 +00:00
|
|
|
<h1 align="center">Key Mapper</h1>
|
2020-11-26 22:34:52 +00:00
|
|
|
|
2020-11-27 20:38:54 +00:00
|
|
|
<p align="center">A Linux tool to change and program the mapping of your input device buttons.</p>
|
2020-11-26 21:19:30 +00:00
|
|
|
|
2020-11-26 23:36:05 +00:00
|
|
|
<p align="center"><img src="readme/pylint.svg"/> <img src="readme/coverage.svg"/></p>
|
2020-11-22 20:43:22 +00:00
|
|
|
|
2020-10-31 18:21:17 +00:00
|
|
|
<p align="center">
|
2020-11-26 23:36:05 +00:00
|
|
|
<img src="readme/screenshot.png"/>
|
2020-10-31 18:21:17 +00:00
|
|
|
</p>
|
2020-11-26 22:58:29 +00:00
|
|
|
<br/>
|
2020-10-31 18:21:17 +00:00
|
|
|
|
2020-11-26 22:52:58 +00:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
To open the UI to modify the mappings, use:
|
2020-11-22 21:07:54 +00:00
|
|
|
|
2020-11-22 21:08:21 +00:00
|
|
|
```bash
|
2020-11-26 22:52:58 +00:00
|
|
|
key-mapper-gtk
|
2020-11-22 21:07:54 +00:00
|
|
|
```
|
|
|
|
|
2020-11-26 22:52:58 +00:00
|
|
|
You can also start it via your applications menu.
|
|
|
|
|
2020-11-22 21:07:54 +00:00
|
|
|
To keep injecting the mapping after closing the window, the daemon needs to
|
2020-11-25 20:55:04 +00:00
|
|
|
be running. If it doesn't already after logging in, you can use:
|
2020-11-22 21:07:54 +00:00
|
|
|
|
|
|
|
```bash
|
2020-11-26 20:53:21 +00:00
|
|
|
key-mapper-service
|
2020-11-22 21:07:54 +00:00
|
|
|
```
|
|
|
|
|
2020-11-27 20:27:15 +00:00
|
|
|
## Macros
|
|
|
|
|
|
|
|
It is possible to write timed macros into the center column:
|
2020-11-27 20:31:58 +00:00
|
|
|
- `r(3, k("a").w(10))` aaa
|
|
|
|
- `r(2, k("a").k("-")).k("b")` a-a-b
|
|
|
|
- `w(1000).m("SHIFT_L", r(2, k("a"))).w(10, 20).k("b")` AAb
|
2020-11-27 20:27:15 +00:00
|
|
|
|
|
|
|
Documentation:
|
|
|
|
- `r` repeats
|
|
|
|
- `w` waits in ms (randomly with 2 parameters)
|
|
|
|
- `k` writes a keystroke
|
|
|
|
- `m` modifies
|
2020-11-27 20:31:03 +00:00
|
|
|
- `.` executes two actions behind each other
|
2020-11-27 20:27:15 +00:00
|
|
|
|
2020-11-27 20:57:21 +00:00
|
|
|
For a list of supported keystrokes and their names, check the output of `xmodmap -pke`
|
2020-11-27 20:55:14 +00:00
|
|
|
|
2020-11-26 22:52:58 +00:00
|
|
|
## Git Installation
|
2020-11-22 21:07:54 +00:00
|
|
|
|
2020-11-02 19:55:17 +00:00
|
|
|
```bash
|
2020-11-26 22:52:58 +00:00
|
|
|
git clone https://github.com/sezanzeb/key-mapper.git
|
|
|
|
cd key-mapper
|
|
|
|
sudo python3 setup.py install
|
|
|
|
usermod -a -G input $USER
|
|
|
|
usermod -a -G plugdev $USER
|
2020-11-01 20:32:06 +00:00
|
|
|
```
|
|
|
|
|
2020-11-26 22:52:58 +00:00
|
|
|
Depending on how those packages are called in your distro,
|
|
|
|
you need the following dependencies:
|
2020-11-21 13:57:08 +00:00
|
|
|
|
2020-11-22 20:45:58 +00:00
|
|
|
`python3-distutils-extra` `python3-evdev` `python3-dbus`
|
|
|
|
|
|
|
|
It works with both Wayland and X11.
|
2020-11-01 20:32:06 +00:00
|
|
|
|
2020-11-26 22:46:06 +00:00
|
|
|
## Tests
|
2020-11-01 20:32:06 +00:00
|
|
|
|
2020-11-02 19:55:17 +00:00
|
|
|
```bash
|
2020-11-22 20:41:29 +00:00
|
|
|
pylint keymapper --extension-pkg-whitelist=evdev
|
2020-11-08 17:51:35 +00:00
|
|
|
sudo python3 setup.py install && python3 tests/test.py
|
2020-11-01 20:32:06 +00:00
|
|
|
```
|
2020-11-01 19:19:50 +00:00
|
|
|
|
2020-11-26 22:46:06 +00:00
|
|
|
## Roadmap
|
2020-10-26 22:45:22 +00:00
|
|
|
|
2020-11-22 21:04:30 +00:00
|
|
|
- [x] show a dropdown to select valid devices
|
2020-11-19 00:45:12 +00:00
|
|
|
- [x] creating presets per device
|
|
|
|
- [x] renaming presets
|
2020-11-22 21:04:30 +00:00
|
|
|
- [x] show a mapping table
|
2020-11-15 11:15:58 +00:00
|
|
|
- [x] make that list extend itself automatically
|
2020-11-22 21:03:44 +00:00
|
|
|
- [x] read keycodes with evdev
|
|
|
|
- [x] inject the mapping
|
2020-11-10 22:21:19 +00:00
|
|
|
- [x] keep the system defaults for unmapped buttons
|
2020-11-19 00:45:12 +00:00
|
|
|
- [x] button to stop mapping and using system defaults
|
2020-11-15 00:35:35 +00:00
|
|
|
- [x] highlight changes and alert before discarding unsaved changes
|
2020-11-26 23:00:21 +00:00
|
|
|
- [x] automatically load presets on login for plugged in devices
|
2020-11-22 20:43:22 +00:00
|
|
|
- [x] make sure it works on wayland
|
2020-11-28 14:43:24 +00:00
|
|
|
- [ ] support timed macros, maybe using some sort of syntax
|
2020-11-08 20:39:31 +00:00
|
|
|
- [ ] add to the AUR, provide .deb and .appimage files
|
2020-11-26 23:00:21 +00:00
|
|
|
- [ ] automatically load presets when devices get plugged in after login
|