EXWM (Emacs X Window Manager)
github.com
github.com
A true comedy hack could be running and editing files in gvim, but to manage gvim's windows in Emacs.
As an evil user, I tended to remember this after I ran `git commit` and then try to remember how to pause evil so I could address vim. (I now use `with-editor` to set $EDITOR back to the parent emacs, and have mostly switched to magit)
I don't remember if I got as far as saving non-file buffers as temp files so they would be accessible to Vim or not. That would have been the next logical enhancement. Maybe it would also be possible to pipe the buffer directly into Vim? I'm not sure if Vim would display in the foreground if you did that or not. I feel like I've had situations where piping things into Vim managed to wedge it in the background, but some of that was on Windows where console process communication is a wasteland of broken dreams.
It’s not entirely clear to me from the page what features set it apart. I guess part is familiar keybindings if you’re an emacs user?
The screenshots look like it does some tiling, is that a good experience? I use i3 so would be curious to know how this would compare.
[1]: https://github.com/emacs-helm/helm
[2]: https://github.com/abo-abo/swiper
[3]: https://www.emacswiki.org/emacs/WindMove
[4]: https://github.com/abo-abo/ace-window
[5]: https://github.com/Bad-ptr/persp-mode.el
[6]: winner-mode, one of my favorite things. https://www.emacswiki.org/emacs/WinnerMode
The main problem it solves is that emacs is a tiling window manager (in a loose, non X-specific sense), so if you spend the majority of your time in emacs it gets quite annoying that you're having to use two different paradigms to manage windows: one for managing emacs "windows" and the "buffers" that they "visit" and one for managing X windows, of which emacs itself is one. EXWM makes X windows behave (mostly) as if they are emacs buffers, so you can use the same powerful tools to manage them.
As an example, I use ivy (https://github.com/abo-abo/swiper) so for switching between buffers I get a nice incremental fuzzy-matched buffer list. With EXWM that same buffer list also contains my web browser and other X applications.
I've written a toy window manager so I have some sense for what making a real one would entail. I've been using emacs for 20 years or so, so have some insight into that. I am in awe at the dedication and attention to detail it must have taken to turn EXWM from a crazy idea into a solid WM that is completely usable as a daily driver.
I can imagine that EXWM eliminates the need for SUPER, which for me would free a modifier pair for a useful LVL3.
I currently have a super on both sides and need to shift super in order to get level 3. Some pedals would be nice.
I gave a lightningtalk on EXWM at Congress last year: https://media.ccc.de/v/36c3-10525-lightning_talks_day_3#t=14...
Note: I'm not the developer, I'm not involved with the project, I was just a huge fan of it. And still is. But it's too slow and buggy for me these days.
But you can, of course, launch a graphical Emacs within EXWM. There you get a second Emacs thread.
One can also put X11 buffers in char-mode to pass through keybinds directly to that window. That way you don't have to do weird sequences to pass through emacs keybinds to another Emacs.
This can be a problem if you choose applications (like Gnus) which are known to have slow, blocking operations but those usually have modern alternatives.
I just tried again with one of the recommended configurations that uses ido and... it was confusing. ace-window looks fairly compelling, maybe.
I suppose the right approach to adopting this would be to spend some amount time with emacs full-screened first, trying to do almost everything in it, getting better with buffer and window management. Then make the jump to having it manage windows.
- a good terminal mode so I don't need to switch to another terminal, the builtin terminals either lag badly after 10K lines of input or render/behave strangely when used with ncurses programs
- pervasive, non-blocking async, this has gotten better over time especially with language servers being on separate processes, however many common tasks block usage completely, such as upgrading/installing packages
The reason I bring this up is because imagine those points but applied to your window manager. Since Emacs is not multi-threaded, if something inside Emacs freezes your whole X session will become in blocked case you run Exwm. For the same reason, it is a bit more responsive.
I found vterm[1] to be pretty reliable for any kind of "advanced" terminal use. Also much faster when dealing with large amounts of output.
EXWM does indeed block when emacs is busy. I haven't found it a problem with my usage, but I imagine it could be annoying. Killing emacs ends the X session of course, as it's the window manager, but I rarely need to restart emacs. Useful trick: If emacs really is stuck and Ctrl-G isn't working, switching to a virtual terminal (eg. Ctrl-Alt-F2) and running `killall -SIGUSR2 emacs` will usually make it snap out of it. (I haven't had to do that for months, though.)
If killing Emacs ends the session, that must have a different cause. Killing the WM doesn't usually end the session.
https://tech.toryanderson.com/2020/10/19/emacs-in-emacs-a-tr...
Seems weird that no one would have built a multi-threaded emacs by now.
I use Emacs as a platform, can see the benefits of using Emacs as a window manager, but consider the disadvantages (in light of Emacs hangs or crashes) as too much, versus using i3.
XMonad keybindings are great, though. I emulate some in Stump.
But the weird thing here is that text buffers are shared between frames, but X11 buffers aren't. There's a function one can call to move an X11 buffer to another frame.
Experimenting with different window managers is something I started to do very early in my linux journey and identified as a clear win.
This is putting a very high bar for me to try anything "wayland", since I'm not particularly fond of sway, won't ever go back to dumbed-down window manager, useless client-side decorations, very questionable input management and lack of pervasive unredirection.
It seems like in this case it's a limitation of elisp, not wayland.
My point is that you don't have to do any of that in X11 since window-management is implemented through a separate protocol and stand-alone process, which makes it much easier to implement.
;; 's-&': Launch application
(exwm-input-set-key (kbd "s-&")
(lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
Edit: There's an example configuration that has this and other bindings: https://github.com/ch11ng/exwm/wiki/Configuration-ExampleHave emacs itself provide wayland compositing or whatever within its buffers. Then we're cooking with fire and can just have init (or whatever abomination kids these days have replaced it with) boot right into emacs.
The future!