Hacker News new | past | comments | ask | show | jobs | submit login
Exwm – Emacs X Window Manager (github.com/ch11ng)
184 points by rfreytag on Feb 10, 2019 | hide | past | favorite | 71 comments



I really like exwm but I currently prefer using StumpWM: https://stumpwm.github.io/. If there was no StumpWM I'd use Exwm.

Both have really similar designs, but for me StumpWM has a decisive advantage: it's implemented in Common Lisp and doesn't run inside of Emacs. Still, it has pretty good Emacs integration and many commands are Emacs-inspired. For example, there's a winner-mode equivalent.

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.

After a decade using XMonad, I switched to StumpWM after carefully test-driving exwm and other options. I found I really prefer manual window tiling. StumpWM is really underappreciated. It's the successor of ratpoison, which kind of started the whole tiling window manager saga in Linux.


I agree with you about preferring manual tiling, the worst thing about manual tiling managers is that there are so few choices. EXWM is my favorite with StumpWM a close second and i3 a distant 3rd.

I've been using EXWM for a few years now and the fact that emacs isn't multi-threaded has caused me very little pain. It really isn't something to worry about. I've had way more issues with StumpWM than I have ever had with EXWM.

I find it slightly amusing that you list Common Lisp as a plus for StumpWM. At the time the gigamonkeys lisp book was published I was using StumpWM and had some issues I wanted to fix (which still existed when I finally switched to EXWM). Trying to learn Common Lisp exposed me to a community that is, to this day, the absolutely most toxic I have ever experienced. For a decade lisp was anathema to me until I discovered Clojure and from there realized that the Scheme and other non Common Lisp communities are great.


Speaking of tiling WMs in general - is there any tiling WM that can be controlled entirely by mouse? I find that I have to do any sort of window management rarely enough that shortcuts aren't worth learning, but I do like tiled windows, so if there's something where you can e.g. lay things out by dragging them around and having them snap etc would be much preferable.


There was such a window manager, and it was absolutely brilliant. Powerful manual tiling with application tabs, full, comfortable mouse support, scripting using Lua. It was totally ahead of it's time. I never found anything as flexible and ergonomic as it. It was also one of the predecessors of i3.

Unfortunately the developer stopped supporting it. Because of that I stopped using Linux. There is a fork which was maintained at least for some time, but I don't know how feasible to use with modern X/Wayland apps it is right now.

https://en.wikipedia.org/wiki/Ion_%28window_manager%29


I really miss the tuomov usability rants[1] :(

[1]: http://tuomov.bitcheese.net/b/


I'm pretty sure that KDE at least (no idea about gnome) has the same kind of tiling feature that recent Windows version have where dragging a window to the left/right/corners tiles it.

Before I discovered tiling window managers I used to use evilwm and later fvwm customized to work the same as evilwm. Both of those window managers had options to make windows snap to the screen edge or each others borders if moved within so many pixels of each other. Maybe something like that would work for you?


Tiling in Windows isn't full featured - you can tile windows by dragging, yes, but as soon as you resize them, you get disconnects. I want something where I can e.g. snap two windows side by side, and then drag the divider between them, such that it resizes both windows.


It's been years and years, but for a while I was using various Gnome Shell extensions that gave me tiling window management. I gave up only because I wanted to get out of the Gnome DE (all the associated CPU and memory hogging services that I don't want). I actually have fond memories of Gnome Shell and Mutter -- all of the functionality is exposed through the JS extension infrastructure, so it's virtually trivial to implement any kind of window manager that you want. (well... it helps that I enjoy programming in JS...) I just wish that it was decoupled from Gnome.


GNOME has left and right (no corners) by dragging and Super+Left/Right. Recent versions can even drag the middle border to resize both together!


As someone who has no idea about the CL community, what kind of experiences did you have, or what did you see, to give you such a negative impression?


I did a quick search and found the /. post that convinced me to buy Practical Common Lisp https://news.slashdot.org/story/05/04/28/1936206/lisperati.c... which was nostalgic. So this happened a while ago I don't really remember most of the specifics.

I believe at the time I gave up I was trying to get weather information into StumpWM by querying the NWS SOAP api over https. I vaguely remember that there was no http library that supported SSL? I was told to just use the SBCL FFI to wrap libcurl, that SSL was useless anyway and I was an idiot for even wanting to use it.

Maybe the community is better now, but I see comments on Clojure articles from Common Lispers sometimes and I have my doubts.


Calling curl (or similar) from CL as an external program is a valid answer.

I don't think that answer makes a large and diverse 'community' of thousands of people forever 'toxic'.


I'm just reporting my personal experience. That wasn't the first or only poor interaction I had asking for help trying to learn.

You also are not helping make the case that the Common Lisp community is fine. Your response completely ignores the actual issue which makes it feel like a passive aggressive attack.

I don't know, that probably wasn't your intent. But I already stated that I had extremely poor experiences with the community so I'm not exactly primed to give the benefit of the doubt.


> You also are not helping make the case that the Common Lisp community is fine.

I don't make the case. There is no single 'Common Lisp community' and I have no idea how all the various groups are doing.

I know lots of great people in the Common Lisp community. It would make me sad to see them labelled as 'toxic'.


A decade ago, you had to have pretty thick skin to tolerate some of the regulars.


I've been using Ratpoison and StumpWM for almost 15 years. They really hit the sweet spot for me. I don't even need to configure them, beyond changing the font and maybe adding one or two extra key bindings.

I only rarely use the splitting function; mostly, I work with one window per monitor. I've worked for years on a laptop like this. Now I have two external displays and my laptop display. The main one in front of me usually shows Emacs; a vertical one on the side shows a terminal or two.


With StumpWM I found myself constantly wish it behaved like i3, and I never had enough time to write the CLisp code to make it do so.

That said, it was neat running slime inside Emacs to connect to and reprogram the window manager Emacs was running inside, in real time.

If StumpWM would get a “i3-mode” easily enabled OOB, I would probably give it another try.


What behavior of i3 did you miss? I missed some aspects of XMonad and it was straightforward to set up.


One thing that doesn't quite line up well between stumpwm and emacs is emacs buffers and stumpwm groups. I'd like to have a single emacs running with some buffers associated with one group and others with another. However it jumps from group to group when I change buffers.

Is there a way around this?


> if something inside Emacs freezes your whole X session will become in blocked case you run Exwm

I just played around with exwm a bit, and that seems like it would be a major issue for me. I love the idea of exwm, though.

BTW, I had to run exwm under emacs26 (the first blocker for emacs25 in my case was the function string-version-lessp). The wiki[0] says that it'll work with emacs24 and greater.

I also had to install it with package-check-signatures set to nil, because my emacs couldn't verify the signature on elpa package exwm-0.22. It's possible that's a spacemacs configuration issue, or something to do with switching from emacs25 to 26.

[0]https://github.com/ch11ng/exwm/wiki


I mentioned in another post that I've found that in practice emacs blocking isn't an issue for me. What I didn't say is that I did need to do some configuration to make that happen.

Mostly I just installed the async package and enabled all its features. I could have also sworn that I spent a lot of time configuring gnus so it wouldn't freeze my X session. Looking at my init.el though I don't see anything other than the standard gnus configuration. Maybe my tweaks got rolled into gnus as defaults at some point?


Tiling is really in distant second place to cascade for window management IMO. Giving up overlaps and easy mouse window selection that you get from cascade seems a poor return vs forcing visible windows to be entirely visible.


> StumpWM has a decisive advantage: it's implemented in Common Lisp

Why is CL an advantage? How does it make the software better than if it weren't written in CL?


Compared to Emacs Lisp it’s nuanced but compared to most other non-Lisps it’s very clear: you can connect your Emacs to the Lisp runtime and hack on the program while it runs, which is great for an interactive environment like a window manager.


Why did you switch away from XMonad? (Curious b/c it’s the only tiling we I’ve used)


Automatic tiling never worked as I expected. And since the tiling setups I typically use are quite simple, manual tiling makes a lot more sense to me.


EXWM is great but one place it is in dire need of help is managing fullscreen applications such as videogames. Right now, those windows are unmanaged, meaning they don’t show up in your buffers. If you manage to leave the unmanaged window to check something else, it is impossible to return and you need to force kill the application in question.

It is a big big problem and one that has almost driven me to leave EXWM more than once. The developer has stated this is intended behavior which is insane to me.


I just started using exwm and was wondering about the cause of this, thanks for sharing. There should really be a way to open unmanaged windows into their own individual workspaces.


The way to get around this, until (or if) this is ever fixed, is to first switch to a different numbered workspace than your primary then open the fullscreen app there. If you need to look something up without quitting the app you can then just use whatever keyboard shortcut you’ve assigned to your primary to switch.


I do the same for games in StumpWM: I just switch to an unused virtual desktop.

I don't really see the issue once you're used to it.


Is it possible for emacs-exwm to run within another window manager, so that I use i3 as my main WM, but can also open X windows inside emacs?

Love emacs, but I hang/tweak/break it enough that I would be scared to use it as my main WM. But it would be awesome to open R graphics inside it, a la Rstudio.


back when I last looked, xnest[1] was the go-to for that sort of thing. It's been the best part of a decade though, so YMMV.

[1] https://www.x.org/releases/X11R7.7/doc/man/man1/Xnest.1.xhtm...


I switched to Xephyr[1] for reasons I can't remember some time ago, iirc it superseded xnest.

[1] https://en.wikipedia.org/wiki/Xephyr


How much configuration/yak shaving is required to get this or StumpWM running? I would love to set this up but am always afraid it will suck 3 days of my time


As someone who's used EXWM exclusively for over a year: Getting it up and running is very quick, finding the workflow you want can take a while - it depends on how familiar you already are with Emacs.

For example you might initially keep using tools like dmenu to launch applications, and over time move to using things like ivy/counsel for that instead. My window management (inside of emacs) habits also changed a lot.

If it's of interest, my emacs configuration is here: https://github.com/tazjin/emacs.d

Most of the EXWM specific stuff is in `init/nixos.el`.


My sentiment will be considered very ‘n00b’ by StumpWM and EXWM connoisseurs, but give i3 a go and see if you like the general idea. It’s generally considered the most foolproof tiling WM. You’ll also need a menu bar and a lock screen which are likely separate i3-* packages. I think I was up and running over the course of a leisurely Sunday afternoon, including changing a few keybindings, and getting everything documented and reproducible in my dot files.


If your distribution packages StumpWM, it just works. I can use it very happily with zero configuration, although I do change the font.


What distro do you use?


I fixed the NixOS package, it works fine now.

The Arch AUR package is also fine.

Lastly, you can go the Quicklisp route (which is a Common Lisp package manager, equivalent to pip or gem). That works fine too and is distribution independent.


Cool, I’ve been using StumpWM from an old Nixpkgs tree because it was broken for some time, I guess I can upgrade it now!


I'm not the person you're replying to, but stumpwm just works in NixOS.


It's not like you really have do anything but download with your package manager and add it to your .xinitrc or xsession files if you just want a vanilla experience.


Why not just run a tiling wm like i3 and use emacs 'make-frame'.


With EXWM, X windows are Emacs buffers and rendered inside of Emacs windows, so you switch between X windows the same way you switch between Emacs buffers; you use the same tiling system for both Emacs and other programs, so you don't need an extra set of key bindings, etc. It's a very nice unification.


Does emacs have a common leader key set up ? I’m new to emacs


It can, and a significant part of the community uses that setup including me. You might be interested in checking 1. Spacemacs - http://spacemacs.org/: A config for emacs with starter packs. They have a good collection of leader key and vim bindings. 2. evil mode and evil-leader - Well integrated standalone vim emulation and leader key.

I personally started building into vim keybindings in emacs via spacemacs, and then over time created my own config with the features I needed from spacemacs (which is much more than just vim emulation).

PS: Should also mention https://github.com/noctuid/general.el. I don't use this one, but it is pretty popular too.


Thanks! I hopped ship from vim to emacs recently precisely because my vim setup was getting super bloated from adding hacky extensions to try to make it like an IDE. Trying to set up an ide per language in vim is an exercise in frustration.

I guess I made a good choice since emacs is able to integrate an x manager (lol).

The issue for me is my tmux leader is Ctrl-f and my vim Ctrl-p uses ctrl-p.. ctrl-d and ctrl-u are used in vim for page up and down. And some other nice Ctrlkeys are taken by vim as well. I will need to carry these key bindings into emacs evil mode...

So Really running out of good leader keys I can use !

I started on evil-mode only. Heard about space macs but I wasn’t sure how well it could work with emacs ide-packages such as SLIME for lisp (and I will want to find emacs ides for Java, Js, Python, C, Cpp, ruby, Ocaml - any suggestions here much appreciated as well)


Also consider https://spacevim.org/ (inspired by Spacemacs)


or, avoid spacemacs & spacevim, and just install evil-leader, evil-surround, and evil-matchit. Emacs starts up faster in this case too.


Recommendation to a former Vimmer who wants to try Emacs to avoid Spacemacs IMO is irrational. Spacemacs and Doom-emacs are the best things to try. Spacemacs is well documented, community supported and extremely popular among former Vimmers. Trying to learn and configure Emacs from scratch usually does the opposite effect - an overwhelmed person gives up and runs back to the comfort of the familiar tool.


My guess is “even more keyboard driven”.

I am currently a happy i3/neovim/Mate User, but this looks really cool


That is really cool!

I just recently started using i3wm but miss my some features from OpenBox, this seems like it has some features of both i3wm and OpenBox.

But will it work well with dmenu/i3bar i wonder?


Can someone explain to an emacs noob what this does exactly? And how it differs from the window manager of Windows/Mac for example.



Emacs is my favorite software (I do "basically" everything in emacs, except I also use firefox) but how is exwm a ood idea? Emacs is single threaded... How did they solve this problem?


The answer is that they didn’t. If emacs freezes up, you just have to wait.


In reality this almost never happens. Besides - it is so lightweight - killing a session and starting a new one takes seconds.


Not sure what you mean? I don't use exwm but my emacs gets stuck e.g. when tramp-mode is connecting to ssh. This is not a problem for tasks I use emacs for, but if my entire OS gets stuck because I'm trying to connect a server, I'd get annoyed.


Maybe it's less of an issue because your window manager doesn't need to connect to ssh servers or even do any kind of heavy lifting.


What's the value of the dynamic workspace support being built in to EXWM, rather than using one of the many packages which does something similar (e.g. persp-mode.el)?


I'm using Spacemacs and Layouts (they based on persp-mode). Either way - multi-monitor setup is a pain, but that's IMO more like X11 problem. I rarely use multiple monitors with my Linux machine though.


It has as much impact on my workflows as Magit does. If you are an Emacs user on Linux, you should give it a try.


What does your magit workflow look like?


You have to tell us what you were using earlier?

Magit people usually compare with stock git.


I can share my anecdotal experience. I've used IntelliJ for about 7 years. For a long time I hesitated to switch to Emacs because IntelliJ has superb git integration. I thought Emacs simply cannot deliver same kind of experience. Oh boy - how wrong I was. Not only Magit turned out to be way more capable, but I also learned so much more about Git internals. I had no idea about so many things you can do with it. Most Git UIs are shallow and don't let you do extremely advanced stuff, like they're afraid users will be overwhelmed and perplexed. Magit doesn't lie to you, doesn't try to hide things.

I simply can't imagine my life without Magit, Org-mode and (EXWM on Linux).


Let me try to explain what so awesome about this project and why I have chosen it instead of other, more popular WMs. The function of a window manager like managing windows to me is kind of secondary - more important is to have a complete keyboard-driven workflow.

What this exactly means to me is the ability to manage as much possible with keeping fingers on the "home row", ideally without having to touch mouse or arrow keys at all. Is that achievable? Without having to introduce plethora of different keybindings?

Yes, that's possible with modality. So for example: I want to be able to control my music volume by pressing `j` and `k`. And move windows up and down also by using `j` and `k`. And resize windows vertically, again, by `j` and `k`. And move windows across multiple monitors, and resize font in my browser, scroll up and down in my pdf viewer, etc. etc. Sounds crazy? Well, maybe. But I promise you, once you get used to it - you wouldn't want to go back to your ordinary, boring and complicated old way.

My main work machine is a Mac and fortunately for OSX there's an automation tool called Hammerspoon. One day I wrote a nice config inspired by Spacemacs, so for the lack of better ideas I called it Spacehammer. You can find it here: https://github.com/agzam/spacehammer.

To my surprise sadly there's nothing similar to Hammerspoon exists for Linux. Initially I simply wanted something trivial: "how do I rebind `Ctrl+Tab`/`Shift+Ctrl+Tab` to `Win+J`/`Win+K` so I can switch between tabs in my browser more efficiently?". See? `j` and `k` again. Even something simple like that turned out to be difficult to achieve. And AFAIK none of the popular WMs let you do that sort of stuff. With the exception of StumpWM (formerly known as RatPoison).

I wanted to try StumpWM but honestly I didn't give a heartfelt attempt to actually use it. I am still skeptical and the main reason is - CommonLisp. It is an amazing language but its popularity has declined drastically and at this point it's pretty much "Latin" of PLs. Yes, it's cool to know it but practicality of that knowledge might be a bit questionable. Learning whole new language for the sake of configuring a window manager doesn't feel very enticing to me. But at some point maybe I will give it a try.

Then I found EXWM. And almost immediately regretted not trying it out sooner. It took a few days to configure it and next thing I know I wrote a plugin for it: https://github.com/agzam/exwm-edit. Yes, the project is still young and from time to time you stumble upon some rare quirks. Multimonitor setup is a pain. It doesn't support "gaps" so praised in other WMs - I personally don't care about aesthetics of my WM though.

With EXWM everything simply becomes just a buffer in Emacs - your browser, Slack, pdf-viewer, music player - you name it. Because everything goes through Emacs you can create complex keybindings and "simulate" keypresses, for example: you can make `Win+W` to act like `Ctrl+W` in your browser or any other app (no context switching between Mac and Linux).

It is indeed an awesome project and if you are an avid Emacsen and seasoned Linux user - I really encourage you to give it a try.


Your next to last paragraph might just have sold me on EXWM.


This looks just like AWesomeWM - Only more awesome!


Needs a text editor, though.


With Exwm you can run KDevelop or whatever editor you like inside Emacs!





Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: