117 points · by todsacerdoti · 5y ago · 132 comments
The key things I needed to find out:
1. figuring out how to run a script when a display was connected or disconnected. This needed to be in a udev .rules file somewhere
ACTION=="change", SUBSYSTEM=="drm", ENV{HOTPLUG}=="1", RUN+="/usr/local/bin/monitor-hotplug.sh"
2. how to enumerate all possible video display names:
DEVICES=$(find /sys/class/drm/*/status)
3. Writing the rest of the script.
The last step is mostly left as an exercise for the reader. There are some good examples online; I'll put my current version here https://pastebin.com/V5yGgCbh for a couple of weeks.Been a while but I had real issues using udev rules as they created timing problems or something like that.
I also have far less complications as a result. My desktop hasn't changed in close to 10 years.
We Linux users keep endlessly personalizing our systems, forking off into the sunset with ever more weird and over-optimized specialisations, and then we wonder why stuff bugs and why new users have a hard time.
Look at Windows and OSX - and the numerous problems they have supporting just one system. And here we are with our 362894 million DEs and we want different initsystems and file systems and plugins and themes and god knows what, but we get so mad when this obvious mess does not work perfectly .
Maybe stop for second and marvle at the fact that this thing can boot at all, given that no 2 people in the community can agree on how that even should be done.
(To be read in a comedic tone, channeling my Lunduke here)
Now I'm back on Pop but this time I know enough to not customize too hard and it works great. A DE/WM is meant to function as one cohesive piece even if its built out of many components, so if you take a functional DE and start poking around then of course it will break. Even the amount of customization I can do easily without breaking anything is far above what Mac/Windows offer.
This is always my issue with Linux. Windows is boring and ugly - to the extent that I probably can't fix it - so I don't bother and I just get stuff done instead. But with Linux, I can imagine this perfectly configured workstation and I know it's possible because I've seen the things people do. So I spend hours tinkering until I break everything or get bored. Then I come back months later and the Nvidia kernel module fails to build after a kernel update or something and I have to start over from scratch. Not a recipe for productivity.
This isn't a problem with Linux, per se, more of a personal failing. I think I've almost got it out of my system.
The difference is that when setting up a new environment it costs nothing. If I had tons of tweaks and custom scripts that would be a setup cost every time.
Now I just change wallpaper and mouse cursor theme, check enabled services and remove the packages I consider unnecessary. Including the fresh installation time, it is less than 1 hour effort.
In part, this is why Apple can give their customers such a polished, "just works" experience. Buy all-Apple gear, and stay in their software ecosystem, and (modulo bugs) everything will work together seamlessly.
I don't like this outcome by any means. And I still think that some desktop components certainly benefit from loose coupling and well-defined interfaces, and it's possible to avoid the "polish" downsides in some cases. But doing everything that way, while still being able to put everything together in a polished way, might actually be impossible.
(But KDE? I don't know, I don't use it much, but it seems like at least their stuff is mostly-compatible-if-you-work-it-a-bit, unlike Gnome's full on hostility to 'cross-compatibility.')
I am not sure why you think they don't have a "share-it-back" mentality or why you would wish any project failure. They use mostly the same set of open source licenses as KDE.
Both work out of the box on almost any distro, just fine
You: "it has become much better with wayland and is improving fast".
Two comments above you: "wayland has been a steaming pile of crap since it still can't work in basic graphics modes 10+ years after being announced, to the fact that it has loads of quirks that vary from one environment to another."
The typical conservative mentality.
That is a misconception that I've noticed, maybe it's because KDE uses different APIs for a lot of things, or maybe it's because of the way some distributions package it. But none of the Linux desktops are really that tightly coupled when you actually dig into it. For example managing the desktop settings is handled by its own daemon appropriately called "gnome-settings-daemon" that loads all its settings modules via a plugin system. KDE is structured similarly in that its code is split across a great number of small support libraries. If there is no secondary consumer of those APIs it's probably because nobody has bothered yet to make and test additional combinations of packages that actually work.
My laptop is pretty much always in "Nvidia graphics" mode to power the external monitor. When I tried to install Stump I didn't have it hooked up. My laptop screen was completely blank, but everything was functional. To make a long story short, it was completely unrelated to Stump. My Nvidia output was prioritized and the internal screen wasn't activated.
I ended up learning a lot about udev, how to write udev rules (that ended up useful when trying to do something with a keyboard with a unicode symbol in its name that a program didn't like), and how to use xrandr. All in all, it was super satisfying to figure out, and I would say the frustration was worth it for me.
I know exactly zero other people in my life that would say the same thing, but I also know zero other people that would try to install StumpWM.
IMHO wayland has been a steaming pile of crap since it still can't work in basic graphics modes 10+ years after being announced, to the fact that it has loads of quirks that vary from one environment to another.
That said, intel graphics tend to work for me, but pretty much nothing else consistently in linux.
Sincerely, sad user running X11 on recent laptop with hybrid graphics...
macOS is totalitarian as UNIX is libertarian if I may have some fun with analogies. No top down direction but individualism is encouraged. There is something to be said about that! It’s a test bench for super cool ideas - e.g. suckless tools.
- logind because you probably still want lid/sleep events to work when at a VT
- gdm because you probably still want lid/sleep events to work while nobody is logged in
- desktop settings because different users may want different things to happen on those events
I'm a little confused as to why the gdm settings were needed, at least for me those only take effect when the greeter is actually open. And in GNOME the separate screensaver daemon has been removed, in part because it simplifies the whole equation.
But it seems to me that each of these things aren't entirely aware of the other, and constantly fight for control. I know logind has an "inhibit" API that lets another program take over some functions, but who knows if everyone uses it properly. And does GDM have the same thing? Or is it expected to just know when it should step aside?
Edit: The other part is the device handling logic in logind: https://www.freedesktop.org/software/systemd/man/org.freedes...
Older tools which may use suid helpers to open these devices will probably stomp all over the logind handling.
When I plug a monitor in, I expect the other ones I'm looking at to simply stay on. This doesn't seem like a huge development effort, but what do I know?
Ended up making an awk script that can be run by hand to create the xrandr command line based on the current configuration (to be applied when it fucks up). Not at my computer now but if anyone is interested in it, I can link to it.
On Linux I could just edit my xconf and everything was fine.
Installing Xmonad though introduced all of them. And my active conclusion is that there's simply a hundred corner cases and it takes time and effort to beat a specific configuration of window manager, graphics subsystem, and system status monitoring into submission. Change a major piece and break the accreted fixes.
Installing Xmonad was worth it, but lot of configuration was needed and the end result still isn't as reliable as what I left behind.
Meanwhile, ubuntu 18 + Mate - everything works fine.
I find the lack of advertising and nagging more than compensates for manually entering an xrandr command or setting a sleep mode.
If that's a problem you don't have though, it's not something you need to worry about.
sudo pm-suspend
Having to type that before I put my laptop in a bag is worth not having to worry that the laptop will spin up in the bag and cook itself trying to update the OS.At least you haven't gotten to the part where you can effectively(not literally) send hotplug events and such over displayport if you have two computers connected to one monitor. Kscreen gets a bit obnoxious in that situation. It wouldn't be too hard to send data between computers with that...
Yeah, that doesn't sound simple anymore. I'm not sure I've seen anything do that second bit.
Prior to that it was a nightmare, and I'm sure it's become a disaster all over again with Wayland.
That's where I stopped reading. Mac and Windows also have problems with such setups. Not to mention having displays with different resolutions and refresh rates
Lol no.
I have issues on my Windows laptop when I try to use 2x 4k + one 2k display display from the single thunderbolt connector, due to Dell TB19 dock allocating too much bandwidth for the DP and HDMI ports (while 2 of my screens are USB-C) regardless of the resolution they use or the number of screens connected.
But with just 2x 4k USB-C screen, it provides both power and display output over a single cable, both in Windows 10 and 11.
And if I connect the 3rd screen to the dock after connecting that single cable, everything works.
FYI, since it is a dock bug, the same thing happens in Linux.
> Not to mention having displays with different resolutions and refresh rates
Lol no!!!
My displays are different: the 3rd one connected by DP is an ultra wide CHG49 - so neither the same frequency, aspect ratio or DPI.
Yet it still all works fine. Linux users are weird when they start assuming just because I use Windows, I must have an experience as bad as theirs.
Even my terminal (mintty) is far better than the best Linux has to offer - and I'm not even talking about AHK that lets me control my keys in a language far more advanced what the few configuration xkb or xmodmap offer.
Also, what about audio that likes to update in the background and can simply fail until I reboot?
The thing is, OSs are goddamn complex and thus they have plenty of bugs all around.
I have noticed a little flickering on my Lumia 950 that runs Windows 10, but I'm ready to give a pass to 5 years old hardware running an experimental build of ARM64 Windows.
Maybe we have different hardware? I'm mostly using Lenovo laptops with one Microsoft and one Dells tablet.
> Also, what about audio that likes to update in the background and can simply fail until I reboot?
You mean driver updates? It depends on your Windows Update settings.
If you mean the audio getting rerouted, I like that when I plug a new device it gets the audio sink priority without fiddling.
And I like I can control that behavior with AutoHotKey scripts to do precisely what I want if I need to.
> The thing is, OSs are goddamn complex and thus they have plenty of bugs all around.
That is an absolutely fair comment! I'm just surprised linux geeks especially in a specific age group (over 25) seem to believe Windows is evil and anyone using it must not be a techie / must have a horrible experience and would find immediate enlightenment and satisfaction if installing Ubuntu.
All kind of nuance seems to be lost when you explain that it works fine for you, and give practical examples of advanced things that would be extremely complicated and sometimes totally impossible to do in Linux
This wasn't an issue with older models that had some other means to connect a monitor other than thunderbolt but these newer models only had thunderbolt display and it didn't work properly.
I believe Caldigit (The one Jeff Geerling uses) is the good one.
Sorry, but this is just not correct. I have used multiple monitors with varying resolutions and refresh rates with a Mac for well over twenty years.
I can see that. I had 2 27" 4K HDR 144Hz monitors that worked fine in Catalina. Big Sur and Monterey, they do not: they'll do 95Hz SDR and 60Hz HDR.
If on my screens I change DisplayPort mode from 1.4 to 1.2, they'll do better (120Hz SDR). So something in Big Sur broke DP 1.4. And Apple doesn't care, because there have been hundreds of bug reports on it ever since the Big Sur betas and it's still broken as of Monterey 12.0.1.
I guess Apple's philosophy is "we don't care if you don't have a Pro Display XDR" (and I say that as someone who owns one).
Been using that setup for almost 2 years, zero issues whatsoever, so I have no idea what you are talking about. I would be willing to concede that I just got lucky with the stability of my setup, but my friends who use similar multi-monitor setups with thunderbolt docks have no such issues either.
It's great that some of you, most people even, don't have these problems with multiple screens on your preferred OS. However, that doesn't mean that no one does.
Think about it. If everyone had these problems, they would have been fixed. Things are not black and white. Not every setup is the same.
Not at all. Windows just works.