While Xremap uses `evdev` and `uinput`, which is a lower layer than X11 and Wayland,
Xremap also uses X11 or Wayland compositor-specific protocols to support `application` config.
If you need this feature, make sure you specify the correct binary or `--features` option,
and follow the following instructions.
#### X11
You may need to run `xhost +SI:localuser:root` before starting `xremap`.
It prints `No protocol specified` for such cases.
You may also need to install `libx11-dev` to run the `xremap` binary for X11.
#### GNOME Wayland
Before using `xremap`, update `/usr/share/dbus-1/session.conf` as follows and reboot your machine
to allow `sudo xremap` to talk to your user's D-Bus.
```diff
<policycontext="default">
+ <allowuser="root"/>
<!-- Allow everything to be sent -->
<allowsend_destination="*"eavesdrop="true"/>
<!-- Allow everything to be received -->
```
## Configuration
Your `config.yml` should look like this:
```yml
modmap:
- name: Except Chrome
application:
not: Google-chrome
remap:
CapsLock: Esc
keymap:
- name: Emacs binding
application:
only: Slack
remap:
C-b: left
C-f: right
C-p: up
C-n: down
```
See also: [example/config.yml](./example/config.yml)
### modmap
`modmap` is for key-to-key remapping like xmodmap.
If you want to remap modifier keys, you need to use `modmap`.
Note that `modmap` remapping happens before `keymap` remapping.
```yml
modmap:
- name: Name # Required
remap: # Required
KEY_XXX: KEY_YYY
application: # Optional
not: [Application, ...]
# or
only: [Application, ...]
```
For `KEY_XXX` and `KEY_YYY`, use [these names](https://github.com/emberian/evdev/blob/1d020f11b283b0648427a2844b6b980f1a268221/src/scancodes.rs#L26-L572).
You can skip `KEY_` and the name is case-insensitive. So `KEY_CAPSLOCK`, `CAPSLOCK`, and `CapsLock` are the same thing.
Some [custom aliases](src/config/key.rs) like `SHIFT_R`, `CONTROL_L`, etc. are provided.
### keymap
`modmap` is for remapping a sequence of key combinations to another sequence of key combinations or other actions.