5 ms·
Mwm – The smallest usable X11 window manager
- neoden 1y agoIs anything similar possible with Wayland?
- ivanjermakov 1y agoWayland is a protocol, X11 is both protocol and a library. X11 client has much less functionality than Wayland compositor. Writing Wayland compositor is usually done with wlroots library to handle barebone stuff, but it has its own flaws: https://inclem.net/2021/04/17/wayland/writing_a_wayland_compositor_with_wlroots/ https://inclem.net/2021/04/17/wayland/writing_a_wayland_comp...
- ajross 1y agoHeh, it's a preprocessor DSL: #define on(_, x) if (e.type == _) { x; } #define map(k, x) if (e.xkey.keycode == stk(k)) { x; } #define grab(...) const char *l[] = { __VA_ARGS__, 0 }; \ for (int i = 0; l[i]; i++) XGrabKey(d, stk(l[i]), Mod4Mask, r, 1, 1, 1); Stephen Bourne lives on! (Actually he's not dead, I just checked.)
- 90s_dev 1y ago> Most software today is crappy. Do you really need all the bells and whistles? Probably not. I agree that most software today is bloated, but I wouldn't say crappy. There are legitimate reasons to choose bloat, for example using SDL or Electron to speed up development and have easier portability. But for some reason I do strongly enjoy writing and using minimalist software. That's why I removed C++, SDL and other libs from my app (hram.dev) and just used C, native Win32 APIs, and D3D, getting it down to 1.4mb and speeding up compilation a lot. So projects like this always appeal to me, and I love seeing different ways we can be minimalist without sacrificing too much functionality or convenience.
- gen2brain 1y agoThe best apps I've used have implementations for every OS and UI separately. Usually, everyone uses the easier route, but it will only be good enough, not the best. But again, now your app works only on Windows.
- 90s_dev 1y agoYeah those apps were my inspiration: use the native UI and share logic as a lib. I don't even have a Mac yet, so no point in shipping for that if I can't debug it. If sales are good, I'd be glad to buy a cheap macbook off ebay and port it.
- pjmlp 1y agoEven better if the library code is properly written, not only you can have multiple GUI frontends, you can make the CLI folks equally happy, and most of the code remains portable. Naturally nowadays this is too much to ask for, so many ship the Chrome Application Platform instead.
- jjrh 1y agoIt's a shame no one has figured out how we can get the flexibility of html/css/js in a way that is fast.
- 90s_dev 1y agoThis is the entire source: #include <X11/Xlib.h> #include <stdlib.h> #define stk(s) XKeysymToKeycode(d, XStringToKeysym(s)) #define on(_, x) if (e.type == _) { x; } #define map(k, x) if (e.xkey.keycode == stk(k)) { x; } #define grab(...) const char *l[] = { __VA_ARGS__, 0 }; \ for (int i = 0; l[i]; i++) XGrabKey(d, stk(l[i]), Mod4Mask, r, 1, 1, 1); int main() { Display *d = XOpenDisplay(0); Window r = DefaultRootWindow(d); XEvent e; XSelectInput(d, r, SubstructureRedirectMask); grab("n", "q", "e"); while (!XNextEvent (d, &e)) { on(ConfigureRequest, XMoveResizeWindow(d, e.xconfigure.window, 0, 0, e.xconfigure.width, e.xconfigure.height)); on(MapRequest, XMapWindow(d, e.xmaprequest.window); XSetInputFocus(d, e.xmaprequest.window, 2, 0)); on(KeyPress, map("n", XCirculateSubwindowsUp(d, r); XSetInputFocus(d, e.xkey.window, 2, 0)) map("q", XKillClient(d, e.xkey.subwindow)) map("e", system("dmenu_run &"))); } } I have to say, I'm not usually a huge fan of C macros, but it works here so well, it feels so elegant and clean somehow.
- qsort 1y agoIs it really that much better than this: #include <X11/Xlib.h> #include <stdlib.h> int GetKeyCode(Display* d, char* s) { return XKeysymToKeycode(d, XStringToKeysym(s)); } int main() { Display* d = XOpenDisplay(0); Window r = DefaultRootWindow(d); XSelectInput(d, r, SubstructureRedirectMask); XGrabKey(d, GetKeyCode(d, "n"), Mod4Mask, r, 1, 1, 1); XGrabKey(d, GetKeyCode(d, "q"), Mod4Mask, r, 1, 1, 1); XGrabKey(d, GetKeyCode(d, "e"), Mod4Mask, r, 1, 1, 1); XEvent e; while (!XNextEvent(d, &e)) { switch (e.type) { case ConfigureRequest: XMoveResizeWindow(d, e.xconfigure.window, 0, 0, e.xconfigure.width, e.xconfigure.height); break; case MapRequest: XMapWindow(d, e.xmaprequest.window); break; case KeyPress: if (e.xkey.keycode == GetKeyCode(d, "n")) { XCirculateSubwindowsUp(d, r); XSetInputFocus(d, e.xkey.window, 2, 0); } if (e.xkey.keycode == GetKeyCode(d, "q")) XKillClient(d, e.xkey.subwindow); if (e.xkey.keycode == GetKeyCode(d, "e")) system("dmenu_run &"); } } }
- teddyh 1y agoNot ICCCM compliant.
- yjftsjthsd-h 1y agoIt does say, > Not standards-compliant. in the very opening list of (non)features.
- blueflow 1y agoHow can you tell / what did you see that was missing for ICCCM compliance?
- rithikrolex 1y ago[flagged]
- poly2it 1y agoPardon? Welcome to HN :^)
- newlisp 1y agoThis WM is too extreme but in linux desktop, the less GUI you use, the better.
- ahlCVA 1y agoWhile this leaves a lot to be desired as a window manager, it illustrates one of my main gripes about the Wayland ecosystem: By effectively bundling the window manager and X server, it makes it much harder for more niche/experimental window managers to come about and stay alive. Even with things like wlroots, you have to invest a lot more work to get even the basics working that X11 will give you for free.
- tadfisher 1y agoTrue; but a counterargument is that the _display protocol_ is not the right abstraction layer for decoupling window management from the display server. There is nothing stopping someone from writing a batteries-included wlroots-like library where the only piece you need to write is the window management and input handling, or even an entire Wayland compositor that farms these pieces out to an embedded scripting runtime. But even then, I think we have rose-tinted glasses on when it comes to writing an X11 WM that actually works, because X11 does not actually give much for free. ICCCM is the glue that makes window management work, and it is a complete inversion of "mechanism, not policy" that defines the X11 protocol. It also comes in at 60-odd pages in PDF form: https://www.x.org/docs/ICCCM/icccm.pdf https://www.x.org/docs/ICCCM/icccm.pdf For an example, X11 does not specify how copy-and-paste should work between applications; that's all ICCCM.
- fmbb 1y agoCopy&paste between apps should work just fine using this window manager. I have not tried mwm but use my own 100 line C window manager and I can copy and paste without issue. Wayland will take 20 more years before it can dethrone X11. And even then we will mostly run X11 apps on XWayland.
- tadfisher 1y agoI'm sorry for not making it more clear, but that was just an example of something left unspecified by the X11 core protocol but instead defined in a standard convention. An example that matters for window managers would be complex window reparenting policies or input grabs, but that's a little less descriptive of the core concept I was trying to get across.
- yjftsjthsd-h 1y ago> No title bars, no status bars, no buttons, no borders, no menus, etc. > All windows are full-screen, just one is visible at any given time. Oh, it's like cage ( https://github.com/cage-kiosk/cage https://github.com/cage-kiosk/cage ) for X11. I was wondering ex. how you'd even move windows around in that little code; the answer is "you don't":)
- chmod775 1y agoNo it's not. It lets you cycle through active windows with a hotkey, lets you close the current window, and launches dmenu to let you open more applications.
- vidarh 1y agoThis one lets you move windows around: https://github.com/mackstann/tinywm/blob/master/tinywm.c https://github.com/mackstann/tinywm/blob/master/tinywm.c
- mosquitobiten 1y agoWhat's the point of the cage?
- yjftsjthsd-h 1y agoIt's probably for building appliance/kiosk systems, though it's handy for anything where you just want to run a single application fullscreen.
- 1718627440 1y agoIf you want a single application fullscreen, you can just not start a window manager though.
- p_l 1y agoIn practice multiple applications get confused, and some don't support -geometry or equivalent. One specific case I dealt with was Chrome/Chromium that provided all sorts of annoyances until we dropped in a minimal WM (back then it was awesomewm, I didn't know about cage or it didn't exist yet)
- trollied 1y agoI wish things were as easy as they were with X11. Being able to ssh into a box and “export DISPLAY=192.168.0.7:0.0” then start an app and have it show up locally is just magical.
- SbEpUBz2 1y agoThere's waypipe.
- supportengineer 1y agoWe had a bright future in the past.
- throwaway328 1y agoYou mean a kind of "Spectres of Marx", Jacques Derrida, 1993, hauntology type thing?
- c-hendricks 1y agoSomething tells me modern remote access tools that use video codecs are much more performant than SSH + X forwarding when dealing with resolutions and desktop effects we use today.
- dingnuts 1y agoThis still works if X11 is installed on the remote. I have a remote that runs Wayland locally, and I run Wayland in the client machine as well, but I have X11 installed on the remote and X11 forwarding still works, it just opens the remote application in an XWayland window inside the local Wayland session. No biggie
- theodric 1y agoFor now
- chasil 1y agoYour X network traffic would be clear text over the network if you did it this way. Instead, you should "ssh -x" or "ssh -y" to pull the traffic over the ssh encrypted channel. The -y option should be used with caution; read the docs.
- rs_rs_rs_rs_rs 1y ago"usable" is very generous
- throwaway328 1y agoIs there a repo or page somewhere listing the mini-est stuff? Very cool here!
- int_19h 1y agoIf you want something similar but more functional, check out https://www.nongnu.org/ratpoison/ https://www.nongnu.org/ratpoison/
- chasil 1y agoThis name conflicts with the original Motif Window Manager, part of OSF Motif. I don't know if mwm is found in modern Motif binary packages. https://en.m.wikipedia.org/wiki/Motif_Window_Manager https://en.m.wikipedia.org/wiki/Motif_Window_Manager The dtvwm eclipsed this in CDE.
- zshrc 1y agoMWM is included in modern Motif binary packages.
- anthk 1y agoI think EMWM it's a better MWM. It even has options to make the menu sticky, a la Window Maker. https://fastestcode.org/emwm.html https://fastestcode.org/emwm.html It's not CDE, but close. And some author wrote a tool to pin WindowMaker dockapps in a window, perfectly usable in a corner. https://web.archive.org/web/20250105005119/https://luke8086.dev/netbsd-on-thinkpad-380z.html https://web.archive.org/web/20250105005119/https://luke8086.... I wouldn't mind using it on my n270 netbook, but a customized OpenBSD base's FVWM it's close enough to EMWM, minus the XFT fonts.
- adxl 1y agoYou can read and understand the code in a minute. Very creative.
- scoreandmore 1y agoHow dare this person take `mwm`!!! I have been using mwm (MOTIF) since 1991. Exact same configuration. It’s the perfect wm in my opinion. I’ve tried every major wm since, and I just can’t quit it. I do everything on the commandline, so I don’t need anything more than mwm. Who’s with me? Anyone? Anyone?
- spauldo 1y agoI ran it a bit back in the day. Wound up on FVWM since it supports MWM's features in addition to tons of other functionality. These days I use KDE 'cause I'm lazy and it has decent customization options. It won't quite do what FVWM would, but it's in the right ballpark for me.
- userbinator 1y agoThe very essential things a window manager should let me do are: Launch applications (which might create new windows). Switch between windows. Close windows. That sounds like the people who grew up using nothing but a smartphone all their lives. I find that there's an entire new generation of developers (and likely users) who don't understand basic window management at all --- all they have on their huge monitors all the time is one maximised application. Meanwhile I have several dozen windows open, all of various sizes, and when they see it, they are surprised at how I can work in such an environment. No, I would not consider something that can't do what even Windows 1.0 could (tiled, nonoverlapping windows) a "window manager".
- blueflow 1y agoWhen you have scanning eyes, any window on-screen that you are currently not scanning is a waste of pixels. These pixels could display data from your focused window instead.
- mnw21cam 1y agoAgreed, but I'll often be looking at one window while typing into another.
- userbinator 1y agoI don't need the "focused" window to be 32" big.
- 0points 1y agoI find your stance uneducated. I use tiling vm fully (sway) and mostly work in single app full screen, one desktop per app, which is the least disruptive way possible to use a PC for work. You should try it.
- userbinator 1y agoIt's stupid to have a huge monitor (or monitors) and then use only a tiny fraction of it. I don't need a little window showing a few lines of text to be any bigger than it needs to be. You should try it. I've used an Android phone plugged into a monitor before when I had nothing else. Doesn't work for anything but the most trivial of situations, which IMHO says just how much work you actually do and how much information you actually use in your work. I need to look at multiple documents simultaneously to compare and refer to them. Switching between windows all the time and trying to memorise what they showed for a second or two is a stupid inefficiency.
- pjmlp 1y agoIt is smallest than twn or uwm though?
- hulitu 1y ago> Mwm – The smallest usable X11 window manager Usable ? And using a traditional name ? Why not name it GNOME or KDE ? Or better: Windows.