Live data from Hacker News

How X Window Managers Work, and How to Write One (2014)

jichu4n.com

21–30 of 250 posts

Re: How X Window Managers Work, and How to Write One (2014)

#21
post #2

Maybe don't write an Xorg window manager right as the replacemeant for Xorg starts to take off though

This is exactly why I would rather do. I see absolutely no reason to abandon X and want to learn its internals to be able to maintain it myself. To me X seems a perfect piece of software which just works and does its job flawlessly, while having all the features I ever needed (including remote execution - I used Windows apps running on a remote Linux machine with Wine over SSH over OpenVPN on a local Windows machine and that was very easy).

Re: How X Window Managers Work, and How to Write One (2014)

#22
This is a great article and I remember reading it numerous times while I was implementing my own window manager.

For someone interested in working on a really fun and rewarding hobby project a WM is a great one to look into since there are so many resources starting from really small implementations:

- https://github.com/mackstann/tinywm

- https://github.com/venam/2bwm

- https://github.com/dylanaraps/sowm

- https://github.com/dcat/swm

- https://github.com/JLErvin/berry

Which are great at introducing the concepts and allowing you to grok the required libraries.

To larger more full featured packed window managers which will introduce you to more advanced topics:

- https://github.com/baskerville/bspwm

- https://github.com/herbstluftwm/herbstluftwm

- https://www.nongnu.org/ratpoison/

- https://github.com/conformal/spectrwm

Gradually as you get more familiar with the ecosystem a few questions will come up:

Should I use X11 or XCB? - I personally used XCB and didn't find it too difficult to interface with, and there are a large number of implementations which use it (2bwm, bspwm, ratpoison, etc) so you shouldn't have an issue with learning more about it. But the documentation is pretty limited. If you are just wanting to write a toy WM than X11 is perfectly fine.

X or Wayland? - If you're wanting to write your first WM as a hobby project than I would recommend X over wayland just due to the much larger amount of reference material and documentation. You will have a much easier time getting your feet wet. Ignore the comments about X dying as it doesn't really matter for a hobby project, since the whole point is to have fun.

Feel free to check out my window manager which is an example of what just reading this blog post and getting inspired can result in: https://github.com/cfrank/natwm

Re: How X Window Managers Work, and How to Write One (2014)

#23
post #14
post #13

Earlier quoted context omitted.

Keep in mind that DWM explicitly does not obey the ICCCM [0] (because they don't like it), meaning that large groups of applications might function erratically on it. This is not an idle concern -- I've had several bugs reported to me in some applications I've written were because the user wasn't running an ICCCM-compliant WM. [0] https://www.x.org/releases/current/doc/xorg-docs/icccm/icccm... , the standard for how…

Do you have a link to a bug report? I tried digging around a bit as I got curious how bugs like these would manifest, but could not find anything good to link. What I am aware of is that Java application can break without workarounds (saw it in the documentation somewhere) and that Steam needs an explicit workaround [1]. [1]: https://dwm.suckless.org/patches/steam

All java applications refuse to render without said workaround, because AWT expects the WM to reparent its windows. This is IMO a bug in the JRE, because there is no requirement for the WM to reparent.

I use steam on dwm without the steam patch, haven't noticed an issue so far.

Re: How X Window Managers Work, and How to Write One (2014)

#24
post #2

Maybe don't write an Xorg window manager right as the replacemeant for Xorg starts to take off though

> replacemeant for Xorg

WHY. What's the compelling reason for Wayland? How will it make my life better? As someone who's used Linux as their only computing environment for 20 years, I'm terrified of my Xorg being taken away. It works! I understand it! And, I'm still bitter over my init system becoming unnecessarily complicated and stupid with systemd.

There's what feels like a rising attitude in the F/OSS community of people wanting to replace things simply because they are old.

Re: How X Window Managers Work, and How to Write One (2014)

#25
post #17
post #2

Maybe don't write an Xorg window manager right as the replacemeant for Xorg starts to take off though

Does upstream Wayland work on any platform except for Linux? Does this display server have any form of colour management for, you know, the stuff it's displaying? Wayland is taking off like the Spruce Moose...

Feel free to continue using X11 of course, no one's forcing anybody to switch. That said:

> Does upstream Wayland work on any platform except for Linux?

Yes, FreeBSD. Patches welcome to make it work on other BSDs.

> Does this display server have any form of colour management for, you know, the stuff it's displaying?

No more than X11 right now, ie. none. But it's in the works.

Re: How X Window Managers Work, and How to Write One (2014)

#26
post #11

Earlier quoted context omitted.

That statement feels like a Tesla FSD announcement. I think Wayland people started to claim that before most Linux desktops even had a working replacement for any of the hundreds of things like screenshots, copy paste, etc. that where build into X11 but stripped out of Wayland.

What "Wayland people"? You probably mean the former Xorg developers who shifted to full time Wayland development long ago. Xorg is on life support, it has been getting bug fixes and nothing else for the past several years. From reading the sibling comment, if BSD guys want to keep using Xorg, they'll probably have to maintain it themselves.

While it's supposed to be "maintenance only", it got a very important addition recently (but not a definitive solution by any means) that helps with dreaded multiscreen setups, AsyncFlipSecondaries.

Re: How X Window Managers Work, and How to Write One (2014)

#28
post #24
post #2

Maybe don't write an Xorg window manager right as the replacemeant for Xorg starts to take off though

> replacemeant for Xorg WHY. What's the compelling reason for Wayland? How will it make my life better? As someone who's used Linux as their only computing environment for 20 years, I'm terrified of my Xorg being taken away. It works! I understand it! And, I'm still bitter over my init system becoming unnecessarily complicated and stupid with systemd. There's what feels like a rising attitude in the F/OSS community o…

Well it doesn't rely on using a giant buffer for multiple monitors so it supports hidpi scaling. Have you ever tried hidpi on xorg? It's a mess, even on Ubuntu where they tried their best to clean it up. The xorg apps from the compatibility layer still suffer from it, probably until they update to Wayland.

Sidenote: Google tried to use xorg for ChromeOS and ended up writing their own UI system for hidpi scaling among other things when it didn't work

Some relevant links for those curious about other people hitting into this:

https://www.foell.org/justin/simple-hidpi-monitor-scaling-wi...

Gnome team:

https://wiki.gnome.org/Initiatives/Wayland/XWayland

Re: How X Window Managers Work, and How to Write One (2014)

#29
post #16

Earlier quoted context omitted.

What "Wayland people"? You probably mean the former Xorg developers who shifted to full time Wayland development long ago. Xorg is on life support, it has been getting bug fixes and nothing else for the past several years. From reading the sibling comment, if BSD guys want to keep using Xorg, they'll probably have to maintain it themselves.

> Xorg is on life support, it has been getting bug fixes and nothing else for the past several years. Imagine two cars: X11 its an old one, it doesn't quite start right, the windows are chipped, the paint is peeling of and no one really wants to invest money into maintaining it, it defaults to brakes and a steering wheel from 1980 but has seen continous upgrades over time and you can generally swap in a steering whee…

Xorg barely works on nvidia (source: me) vsync requires a compositor to work, and even picom needs a very specific combination of flags to get vsync to work. Chromium cannot gpu accelerate video playback. On rolling release distros, most major kernel updates leave your system broken, because nvidias out-of-tree driver can't build against new kernel versions. If nvidia stops supporting your old gpu, like they just did with Kepler, you're screwed.

The problem with nvidia on linux isn't wayland, it's nvidia.

Re: How X Window Managers Work, and How to Write One (2014)

#30
post #2

Maybe don't write an Xorg window manager right as the replacemeant for Xorg starts to take off though

> right as the replacemeant for Xorg starts to take off though

It has been "taking off" for 13 years at this point. It seems like it doesn't have much thrust behind it.

Post reply on HN