Developer Patches i3 Window Manager to Resolve Emacs Keybinding Latency
A software developer has modified the i3 source code to allow key events to pass directly to Emacs, bypassing the latency issues associated with previous external tooling solutions.
A software developer has modified the source code of the i3 tiling window manager to enable key event passthrough to Emacs when it is the focused window. The patch addresses latency issues found in previous script-based integration methods by intercepting key presses at the X11 level and re-emitting them to the target application. The solution includes custom Elisp functions to handle window movement between i3 and Emacs frames, and scripts to launch terminals such as Mistty and Alacritty from either environment.
The developer previously attempted a script-based solution using xdotool and emacsclient, which resulted in latency of 30 to 100 ms from invocation to exit, plus additional unexplained delays between input sending and registration. The author evaluated EXWM (Emacs X Window Manager) but deemed it unsuitable due to issues with graphical applications like Steam and input methods. The patch modifies i3’s source code, specifically src/bindings.c, src/handlers.c, and include/data.h, to add a 'passthrough' field to the Binding structure.
The i3 configuration parser was modified to accept a '--passthrough' flag for bindsym commands, allowing specific bindings to be routed to Emacs. Custom Elisp functions, including nausicaa/find-other-window, were developed to allow Emacs to attempt window selection internally before instructing i3 to handle the movement if no Emacs window is found. Terminal launching scripts (mistty-create and alacritty-create) were created to ensure consistent behaviour across environments, allowing terminals to open in the current project directory regardless of whether invoked from i3 or Emacs.
The developer notes that i3 maintainers have previously deemed such features out of scope, so this remains a personal patch rather than an upstream contribution. The author uses Nix for development and provides a shell.nix configuration for building the patched i3 version. The solution aims to provide a common set of keybindings between the two applications without the performance penalties of launching external shell processes for every keypress.
This development highlights the ongoing efforts by developers to optimise workflows within open-source Linux environments. By addressing the technical constraints of X11 event handling, the patch offers a more direct integration path for users who rely heavily on both tiling window management and the Emacs text editor. The code changes remain available for those wishing to build a custom version of the window manager.


