My I3-Emacs Integration

https://khz.ac/software/i3-integration.html

Comments

SubiculumCodeMay 24, 2026, 1:37 AM
Side note: I am really enjoying HN today with the set of stories with personal hacks like this i3-emacs integration, someone's desk setup, someone's writer-deck laptop install, the kinda hilarious but also hecka geeky thermal ttrpg thingamabob, and the 16 byte wake up demo. Fun geeky stuff that isn't AI,and I love AI, but it ain't everything.
noir_lordMay 24, 2026, 10:16 AM
I set up a crude set of Ublock Origin filters to nuke AI off the frontpage of HN a while ago.

It's been great, much more like HN used to be.

leephillipsMay 24, 2026, 2:20 PM
I set this up: https://hn-ai.org/

The problem now is that so many articles with innocent titles are really about AI slop. The title might be “A Space Exploration Game” and the content is about some vibe-coded garbage.

ristomattiMay 24, 2026, 4:18 PM
In my current favorite alternative HN frontend https://hcker.news, you can filter (include and/or exclude) posts by words found in the titles. There's _a lot_ of other customization options as well.
backwardsponchoMay 24, 2026, 9:52 PM
Dark mode? God finally

Edit: and PWA support! Woohoo!

diminishMay 24, 2026, 8:07 AM
Can you pls link to them?
torhMay 24, 2026, 10:50 AM
They are still on the front page, but here you go:

Two-part desk setup : https://news.ycombinator.com/item?id=48214311

Writerdeck: https://news.ycombinator.com/item?id=48250144

Wake-up demo: https://news.ycombinator.com/item?id=48253060

krupanMay 24, 2026, 12:17 PM
In case you don't understand the problem here, an emacs instance can be split into multiple "windows" and there are emacs key bindings to create and destroy these windows, move the "focus" from one window to another, resize the windows, etc. For many of us, this was our introduction to a tiling window manager experience before we'd ever heard of tiling window managers.

When we switched to using a tiling window manager for all our windows, we ran into a muscle memory problem. We were used to jumping between emacs windows/buffers using C-x o and C-x b and then without thinking about it we'd try and use the same keys to jump between i3/sway windows and of course it doesn't work. Or vice versa, trying to use i3/sway shortcuts to switch emacs windows/buffers.

To try and solve this problem I've been using less emacs windows and more i3/sway windows, so I can just use i3/sway keybindings everywhere, but emacs puts up some resistance to that. I like this approach

ristomattiMay 24, 2026, 5:01 PM
I'd be surprised if someone hasn't already solved this. I'm not an Emacs user myself but try searching for something like "seamless <tiling_system> <tiling_app> navigation site:github.com". I've seen several scripts/plugins to setup seamless navigation between i3/tmux, tmux/Vim, i3/tmux/NeoVim, i3/Zellij etc.

Recently I hacked together a Bash script for seamless navigation between i3 windows/tabs and Kitty windows/tabs using i3-msg, xdotool, jq, kitty's remote control sockets. Now if I only figured out how to add Helix windows into the mix...

Sometimes thinking outside the box helps. I've been able to unify a lot of keybindings by using a context aware remapping tool such as Keymapper (https://github.com/houmain/keymapper.

cmrdporcupineMay 24, 2026, 12:42 PM
Yep, I still find emacs' window management bindings more intuitive than any tiling window manager I've used. So much so that I thought naively that things like exwm would "solve" this problem for me. But in fact -- beyond being janky / single-threaded -- they don't really because you still end up with competing bindings.

I think the more elegant model would be for the window manager to own all the window management keybindings and then for there to be a background emacs-like process that owns the buffers (and the remaining keybindings) and can present them in standalone windows which the window manager presents. With some kind of IPC between the two for coordination, I guess.

I don't think GNU Emacs itself works well with this model tho. Its "server" mode is something else entirely.

alfiedotwtfMay 24, 2026, 8:39 PM
I got rid of the default bindings for my window manager and emacs…

So instead, I’ve made any keybinding with the Super key take ownership from the window manager, and ctrl-c * for emacs, but I’ve been thinking of binding the Hyper key to my keyboard so it’s one less level

9999goldMay 24, 2026, 4:32 PM
I can relate, finding myself pressing the wrong keybindings when moving between i3 and emacs windows. The idea in the post is interesting but I am not sure how I’m going to solve this. I have been thinking about trying EXWM or switch to another WM. Tried KDE but it didn’t have support for multiple workspaces in the secondary screen. And after using i3wm I found it difficult to get back to other WMs.
skulkMay 24, 2026, 12:59 AM
I've started using ewm to get this kind of unification between emacs window management and non-emacs window management.

https://codeberg.org/ezemtsov/ewm

stebalienMay 24, 2026, 3:56 AM
I keep trying it (coming from EXWM) but I get lots of lag, stutters, and poor fractional scaling. I'm not sure how much of that is "GTK under wayland", Emacs's PGTK build (known to have lag/rendering issues), AMD kernel drivers (?), or EWM itself; but it's not yet a replacement for EXWM in my experience.
krupanMay 24, 2026, 12:31 PM
"Writing a Wayland compositor from scratch is a staggering amount of work..."

I switched to Wayland and sway about 2 years ago and it hasn't been bad, but this is the thing that makes me most sad about Wayland. X has so many different window manager options, it's like, an embarrassment of wealth. Wayland has like, 3 "finished" ones (if sway even counts).

skulkMay 24, 2026, 2:36 PM
it is sad, X11 had a suite of tools like xrandr that worked regardless of your wm/compositor but now with Wayland these tools are compositor-specific (or have to agree to a standard).
PunchyHamsterMay 24, 2026, 12:03 AM
I just use super(win key)/hyper (bound to capslock) for i3-related commands and leave emacs to its own devices with normal binds
noosphrMay 24, 2026, 1:15 AM
There can never be too many modifier keys:

https://xcancel.com/octonion/status/1341113219142828039

topaz0May 24, 2026, 3:59 AM
That's fine as far as it goes, but I don't think that gets you what this article is for, which is things like using the same binding context-dependently to navigate between emacs splits and regular window manager windows, context-dependently. Which is a fun bit of overengineering.
PunchyHamsterMay 25, 2026, 4:12 PM
Yes, the entire point would be to avoid such brittle engineering and entanglement of the two
krupanMay 24, 2026, 12:05 PM
The problem some of us have is we get used to jumping between emacs windows/buffers using C-x o and C-x b and then without thinking about it try and use the same keys to jump between i3 windows and of course it doesn't work. Or vice versa, trying to use i3 shortcuts to switch emacs windows/buffers.
royal__May 24, 2026, 12:27 AM
Yeah this is what I do. This article feels like crazy overengineering for something that's not really a problem
dima55May 24, 2026, 12:41 AM
A dedicated key for all window-manager things is what people that have thought about it do (I use the "windows" key). But keyboard manufacturers haven't thought about it, so sometimes reasonable things aren't possible. I don't know.
sudahtigabulanMay 24, 2026, 6:30 AM
Unless you have RSI. Then it might be worth it. Depends on what hurts.
rileymat2May 24, 2026, 12:37 AM
Yes, I am misunderstanding the problem. The windows/mac command key leave shift, control and alt free for i3.
ZambyteMay 24, 2026, 7:49 AM
Ooo this is nice. I may have to try to get this working with my personal setup using Emacs and Sway.

My long term vision is to make an Emacs implementation that is compatible only in philosophy. It would use Guile instead of Elisp, default to bindings that are more familiar to people coming from more modern systems, and would be built from the beginning with concurrency and graphics in mind. For now it remains a dream though.

volemoMay 24, 2026, 10:15 AM
I know, right? However, one of the strongest points of Emacs is the huge amount of existing packages.
cmrdporcupineMay 24, 2026, 8:21 AM
Sounds like you want Lem. Though it's common lisp instead of guile.

https://github.com/lem-project/lem

ZambyteMay 24, 2026, 2:15 PM
Nope! I should have elaborated, but by "graphics in mind" I meant full support for graphical applications. I want it to be a Wayland compositor. It would either be used as a top level compositor like EXWM, or as a nested compositor, like how gamescope is used.

I want it to be as easy to make scripts to automate graphical applications as it is to automate textual ones in Emacs or shell scripts.

cmrdporcupineMay 24, 2026, 2:22 PM
Yeah fair enough. I think we likely agree, too.

As I said in my other comment in this topic I actually would love to see an arch where the UI portions are split up with a background daemon holding buffers, lisp execution etc and then IPC to frontend pieces for window management and buffer editing.

So window management can be done by ... a window manager, but with intelligent interaction to the editor pieces so you don't lose all the awesome emacs stuff.

EDIT: I would say however that something like lem is probably more amenable to that refactoring/restructuring than GNU emacs, which is a single-threaded monolith.

krupanMay 24, 2026, 11:58 AM
ZambyteMay 24, 2026, 2:12 PM
I'm familiar. The difference is that this is targeting source compatibility with existing Elisp. I don't feel like that is worth it for most people who would be interested in what I want to build.
grumpyproleMay 24, 2026, 8:12 AM
VSCode is pretty much this. But with typescript instead of Guile. After 30 years of Emacs, I switched .
iLemmingMay 24, 2026, 8:30 PM
Pfff... it's like my teenage daughter who's never driven a car brags to her friends how Mazda is better than Toyota, because "she switched".

"Using Emacs" means actively reading, writing, evaluating Lisp code. How many packages have you written? If not too many, I'm afraid, you're only "riding it", not "using" it, just like my daughter has been riding in one car and now in a different one.

There's a huge fundamental gap between Emacs and VSCode. In Emacs, the editor is the Lisp runtime. Every piece of the editor is a live Lisp object you can inspect, redefine, and compose at runtime. There's no boundary between "editor" and "extension" - they're all just functions and variables in the same image. VSCode doesn't offer anything remotely close to that.

Without understanding that gap, there's no understanding of what Emacs actually is. There's no "switching" between Emacs and an editor/IDE. "IDE" is a much smaller category than what Emacs actually is. You switched editors while not realizing you gave up something that isn't an editor.

alfiedotwtfMay 24, 2026, 8:43 PM
A bit harsh, but 100% on point. THIS is why emacs is fundamentally different to the core of what emacs is vs all other editors - you’re driving a Mazda, but you’re your own mechanics with that Toyota
krupanMay 24, 2026, 12:21 PM
Heresy! ;)

I would guess you hadn't done as much emacs yak shaving as some of us other emacs users if the switch to VSCode was a simple one

bergheimMay 24, 2026, 9:15 AM
after 30 years you say this? this cannot be serious.
timonokoMay 24, 2026, 7:59 AM
Unrelated, but me and Gemini just invented "C-x 4" for multiscreens.

  (defun my-external-readonly-split ()
    "Open the current file in an external xfce4-terminal as read-only."
    (interactive)
    (if buffer-file-name
        (start-process "xfce-terminal-split" nil 
                       "xfce4-terminal" "-x" "emacs" "-nw" 
                       "--eval" "(find-file-read-only (pop command-line-args-left))"
                       buffer-file-name)
      (message "Current buffer is not visiting a file!")))

  (global-set-key (kbd "C-x 4") 'my-external-readonly-split)
the-lazy-guyMay 24, 2026, 11:50 AM
You should use emacsclient, so file will be actually shared. Or better yet - use GUI emacs with its ability to have multiple frames.
timonokoMay 24, 2026, 12:11 PM
No Thank You

  export EDITOR="emacs -nw"
krupanMay 24, 2026, 12:19 PM
export EDITOR="emacsclient -nw"

It really speeds things up

timonokoMay 24, 2026, 8:30 AM
Incredibly splendid. I just tested it myself.

Try C-x 2, C-x 3 and C-x 4

klik99May 24, 2026, 3:33 PM
I have to mainly drive Windows 11 for work reasons so I use komorebi for a tiling window manager (highly recommended btw). I bet the ideas in this post can be applied in that environment too, gotta try it now, great idea
nesarkvechnepMay 24, 2026, 8:56 AM
I did the same integration with an Erlang daemon. All relevant key presses are sent to it and based on the current focused application the daemon does different things. I built an Erlang library i3_IPC to listen for events and send commands to Sway.
Pay08May 24, 2026, 2:11 PM
I'm curious; why Erlang?
nesarkvechnepMay 24, 2026, 9:33 PM
Why not Erlang?

It's is great in everything which requires talking to and/or listening on a socket. It's amazing for writing and running daemons.

krupanMay 24, 2026, 12:33 PM
Care to share?
gigatexalMay 24, 2026, 5:17 AM
Ah no video it action??

Very interesting though. I don’t always read entire posts on blogs but this one I did. Lisp looks really interesting.

Pay08May 24, 2026, 2:30 PM
Unrelated to the content of the article, but I absolutely hate the lack of capitalisation.