Live data from Hacker News

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

jichu4n.com

241–250 of 250 posts

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

#241

I used to write an X11 window managers as a kick-the-tires exercise when learning a new language. The most fun one was Common Lisp with CLX. You could stay in the WM and code it live. When something went wrong you could continue after making fixes. It’s what lead me to Common Lisp being my favorite language going on decades now.

There was a window manager (gwm) written in a lisp dialect (wool). It was very nice.

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

#242
post #78

Earlier quoted context omitted.

if you buy a high pixel density display (ex a 15 inch laptop with a 4k display) then you need to be able to map 2 real pixels to 1 logical pixel (what apple did with retina displays)

And this works perfectly fine already with X11. You only encounter issues when you add an additional display with different DPI. But dual monitor setups are the exception, and mixed DPI setups are even less common.

Mixed DPI setups are very common. A Retina Mac getting docked to external monitors of different DPI is tremendously common all over the place. Ironically on the Windows side I see tons of non HiDPI laptops that end up docked to higher DPI external monitors, but the other direction isn’t exactly rare either. Even if you don’t use those monitors simultaneously - this is still mixed dpi for all the apps that are currently running.

This does not work smoothly at all in X11. This is a mixed bag with Windows because of reasons that are well documented. The compromise chosen by Apple works reasonably well.

This is not about my personal preferences unlike the GP asserts, it’s based on observing hundreds of deployments in industry and academia - which both Apple and Microsoft are very much aware of - they don’t try to support these features for no reason at all. I personally don’t love the scaling done by Mac OS, and in an ideal world apps would just magically scale geometry and “do the right thing”, but that is a fantasy land and the best FLOSS unix has to offer with X11 does not meet a lot of users needs.

As for nothing wrong with X? Lol this is a display system that still does not have a sane unified way to prevent screen tearing - despite 30 years of shitty attempts.

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

#243

Earlier quoted context omitted.

Waypipe ships client-rendered images across the network; datacenters would fall back to software rendering because there’s no way to take advantage of a user’s desktop GPU. I think the industry will continue moving to Javascript or Wasm apps as the most widely portable and accelerated remote display system we have.

> Waypipe ships client-rendered images across the network That's also exactly what most modern GUI toolkits do when they run on X11.

Sorry if I'm being obtuse, but... why would X11 toolkits need to ship client-rendered images across the network?

Doesn't the server tell the client what to render, and the rendering happens on the client? Why would that result then be shipped over the network?

https://en.wikipedia.org/wiki/X_Window_System

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

#244
post #195

Earlier quoted context omitted.

> I'm still bitter over my init system becoming unnecessarily complicated and stupid with systemd. Systemd is neither unnecessary nor stupid. And I am sure, if you really think about it, you know this yourself. It would not have been adopted so widely and quickly if it were. Systemd offers countless advantages over previous init systems: https://www.reddit.com/r/archlinux/comments/4lzxs3/comment/d...

> Systemd is neither unnecessary nor stupid. I'm living a pretty good life without systemd, so it's clearly not necessary. I'm sort of willing to acknowledge that it fits some people's needs better than alternatives however. systemd doesn't have the ability to cancel tasks from the console like other init systems do, for example when my laptop can't get a DHCP response from the network card that's not plugged in, so…

> systemd doesn't have the ability to cancel tasks from the console

Yes, it does… not sure what you are talking about.

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

#245
post #201
post #181

Earlier quoted context omitted.

Please avoid making bad faith interpretations. I'm reading that comment as this: surely you can acknowledge that sysvinit is not a good solution for many people? And just for the purpose of adding some structure around sysvinit, systemd does an adequate job? And if you have an advanced use case that requires a very specialized init system, I hope you can understand how that is uncommon?

You didn't ask, but I think that: >Systemd is neither unnecessary nor stupid. And I am sure, if you really think about it, you know this yourself. It would not have been adopted so widely and quickly if it were. Was bad faith, naive, and frankly... insulting -- so I just chose to ignore it. My reservations are well grounded, and when ones concerns are echoed by ESR, Linus, and tytso, I don't think they can be dismiss…

> But surely everyone in this conversation is experienced enough to know that just because "lots of people" choose something, that doesn't always mean it's a good choice. :)

Sure, but systemd has quickly been adopted by the experts, namely the maintainers of every mainstream distribution. The people who maintain all of that infrastructure think it is much better than what we had before. That does say something about its quality.

> It's a monolith (right?)

That‘s a common misconception. You don‘t have to use all of systemd. And I am not talking about all of systemd, just the init system.

That also invalidates your point regarding networking, btw. You could keep using your setup with systemd.

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

#246
post #195

Earlier quoted context omitted.

> Systemd is neither unnecessary nor stupid. I'm living a pretty good life without systemd, so it's clearly not necessary. I'm sort of willing to acknowledge that it fits some people's needs better than alternatives however. systemd doesn't have the ability to cancel tasks from the console like other init systems do, for example when my laptop can't get a DHCP response from the network card that's not plugged in, so…

> systemd doesn't have the ability to cancel tasks from the console Yes, it does… not sure what you are talking about.

On other init systems, if you hit ^C it cancels the current task. On the one systemd machine that I used, ^C did nothing while waiting for DHCP, and no gettys had started yet either, so as far as I could tell, there was no way to get the system to respond other than wait for the timeout (minutes) or reboot and maybe reconfigure in single user mode.

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

#247
post #231

Earlier quoted context omitted.

You certainly can, but the problem is that there is no agreed standard from the toolkits to do it. E.g. Qt has its own way.

Why does QT needs to be smarter ? Just asking.

Qt runs on platforms where there is literally only a kernel + the Qt app running, through for instance EGL for rendering. So it has to have its own way.

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

#248

Earlier quoted context omitted.

> Waypipe ships client-rendered images across the network That's also exactly what most modern GUI toolkits do when they run on X11.

Sorry if I'm being obtuse, but... why would X11 toolkits need to ship client-rendered images across the network? Doesn't the server tell the client what to render, and the rendering happens on the client? Why would that result then be shipped over the network? https://en.wikipedia.org/wiki/X_Window_System

That’s been tried, but most toolkits stopped doing that because it was unreliable, slow, and the number of primitives offered by X wasn’t sufficient for any modern GUI.

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

#249

Earlier quoted context omitted.

> Waypipe ships client-rendered images across the network That's also exactly what most modern GUI toolkits do when they run on X11.

Sorry if I'm being obtuse, but... why would X11 toolkits need to ship client-rendered images across the network? Doesn't the server tell the client what to render, and the rendering happens on the client? Why would that result then be shipped over the network? https://en.wikipedia.org/wiki/X_Window_System

Also, in X terminology, the server owns/controls the display, the client is the app that wants to draw a window on the server’s display. The classic architecture would be client telling server what to draw, but these days what really happens is that clients draw locally into a buffer and then tell X server to draw the contents of the buffer.

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

#250
post #188

Earlier quoted context omitted.

sway and wlroots have some of the worst error handling I've ever seen in C code. The number of null pointer bugs and assertion bugs is just mind-boggling. I don't really understand how hard it is to just gracefully handle errors. Literally no one would prefer to crash their entire desktop environment rather than have it silently skip over errors and output them to a log. I recently used i3 again because my office com…

I don't know where you heard that, but wlroots is not the defacto standard, there are several other libraries. Off the top of my head, there is libweston, mutter, mir, qtwayland, smithay, and probably some others aimed at embedded that I can't remember... Edit: also this one somebody wrote in HTML5 and typescript https://github.com/udevbe/greenfield

Not sure why this is downvoted. wlroots wants to be a de-facto standard, and the devs have put in a lot of effort to document how to use it. But it's far from a true de facto standard, since most wayland window managers use their own library.
Post reply on HN