Remapping a Macropad With xremap

EM Mini Pad provides five keys and a knurled knob in a compact anodised aluminium block. xremap can give those inputs different meanings by application on Linux, including supported Wayland sessions.

What does xremap add beyond a global remap?

xremap reads Linux input through evdev and creates output through uinput. Its configuration supports direct substitutions, combinations, sequences, tap-versus-hold behavior, device filters and application filters. The last feature lets one physical key navigate an editor while doing nothing in a browser.

That flexibility is useful only when conditions are accurate. A window-class rule can stop matching after an application update, and focus can change between press and output. Keep consequential commands out of long key sequences and use the target application's own shortcut system when possible.

How do you write a per-application remap?

In the YAML configuration, a keymap entry can include an application condition with an only or not list, plus its remap table. Use xremap --list-windows where supported to discover the current application class rather than guessing from the title bar.

Window discovery differs under GNOME and KDE Wayland, and xremap documents separate methods for those desktops. Begin with one output such as Escape or an arrow key. Confirm that it changes only in the intended program before adding command launches or multi-key sequences.

How do you target only the macropad device?

xremap can filter a keymap or modmap with a device only condition. It accepts device paths, event filenames, names, name substrings and vendor or product identifiers. Run xremap --list-devices or xremap --device-details and compare results while connecting the pad.

A stable device name or by-id path is usually safer than an event number that can change after reboot. Check the startup log to confirm the match. The watch option can notice newly connected devices, but it does not correct an overly broad filter.

What extra setup does Wayland need?

xremap must be built or installed with support for the compositor that supplies active-window information. Its official installation lists separate feature choices for major Wayland environments and documents permission setup for running with or without administrative elevation. Follow the exact path for the installed compositor.

The EM Mini Pad supports both USB-C and Bluetooth. Verify how each mode is named before trusting one filter. Keep a terminal available, validate the YAML, disable command launching until ordinary remaps work and test application conditions after desktop upgrades. Keep a copy of the working configuration outside the watched path. If a live reload fails, restore that file before investigating more ambitious rules.

Back to blog