Setting Up a Macropad for Codex CLI on Linux
EM Mini Pad is a five-key aluminium macropad with a knurled knob. Linux can remap it as a separate keyboard, making it a compact control block for Codex CLI navigation rather than a substitute for reading prompts.
What does the Codex CLI loop actually need from hardware?
Most useful physical bindings sit around the agent interface: escape, return, tab, arrow movement and an interrupt shortcut. These are visible, reversible actions that also make sense in an ordinary terminal. Choose from that set based on the screens you see repeatedly.
Do not begin by assigning approval decisions or permission changes. Codex can ask about different actions, and the meaning of a selection comes from the text on screen. A fixed key cannot judge whether this request matches the previous one.
How do you configure keyd for a second keyboard?
Connect the pad by USB first, then use the keyd monitor to identify the device and the code sent by each control. Create a configuration that matches the pad identifier, not every keyboard. Map one harmless position, reload the service and confirm that your main keyboard is unchanged.
Add the remaining controls slowly. Keep the original configuration available in another terminal and know the remapper's emergency stop before experimenting. A malformed system-wide map can affect more than the graphical desktop.
Does the knob help with long diffs?
It can help if rotation produces keys that your terminal maps to scrollback or page movement. Test clockwise, counter-clockwise and press as separate inputs. Pick one behaviour and label it. Scrolling terminal history is not the same as moving through a selection inside Codex.
Use small, repeatable navigation events. Do not make each detent run a command. A quickly turned knob can emit many events before you notice the wrong window has focus.
What if your distro runs Wayland?
keyd remaps through Linux input facilities below the compositor, so basic device-specific substitutions are not tied to X11. Rules that depend on the active application can be more desktop-specific. Get the system-wide pad map working before adding application awareness.
The EM Mini Pad also supports Bluetooth and lists a 1000 mAh cell, but wired USB-C removes pairing and battery questions while you build the map. Five controls are enough when each one has a clear, safe job. Review the layout after a week. Remove any control you still have to look up, and keep a normal keyboard path for every action. The pad should shorten a known interaction, not create a second interface you must maintain.