Multi Screen

BlaBlaSoftware

Ah, working with more than one screen, nice and convenient, but always has been the scourge of usability, due to broken hardware and software, on every platform you can imagine. And yes, on Plasma we are notorious to have several problems with regard to multi screens, which spurred many bug reports.

TL;DR

For Plasma 5.27 we did a big refactor on how the screens are managed (and how they are mapped to desktops and panels) which hopefully should solve many of those issues, creating a much more predictable experience, both for “fixed” multi screen setups (like a setup at your desk) and “on the go” (like attaching a projector at a conference).

  • No more default empty desktops after connecting a screen that you already connected in the past
  • No more desktops, wallpapers, widgets and panels lost after restart
  • No more different sets of desktops between X11 and Wayland
  • Better experience when using USB-C based docks

UI wise on the Systemsettings module nothing will change in the most common case, when you have one or two screens, where you will be presented with the usual “primary” checkbox.

When you have 3 or more screens, instead of s simple “Primary” checkbox, you will be presented with a dialog where you can rearrange the screens in a logical order, so that you can say: “This is my screen number one, this is my screen number two etc.”

Reordering screen priorities

This will map exactly to what “screen number one, two etc” are for the Plasma shell, so that whatever desktops, wallpapers, widgets and panels are on the “screen number one” will always be on the “screen number one”, never disappearing again, same for each screen, giving a completely predictable, and stable multiscreen setup.

For 5.27 I worked mostly on the Plasmashell part, but many thanks and shouts to Ivan for his work on KScreen and to Xaver for his work on the KWin and Wayland protocol parts.

Long story: the moving parts

I would like to do a semi-technical but still quite high level description on how our multiscreen infrastructure works, and what did we change.

When you have multiple monitors connected, assuming the kernel and drivers will do the right thing (which… doesn’t always happen), either X11 or Wayland (so in our case the KWin Wayland compositor) will see the screens and have info about them we can enumerate and manage.

KScreen

In Plasma we have a daemon/library to manage the screens, called KScreen. It will save a configuration for each combination of screens it encountered. each screen is identified uniquely by its EDID, and when this fails for the above reasons, the connector name the screen is connected to (under X or libdrm they will have names like HDMI-A-1, DP-2, eDp1 and so forth). connector names are also not optimal, but is the best that can be done in case of a bad monitor (For 5.27 Xaver fixed a quite big issue on this fallback path which likely caused several of the reported bugs).

The user then can chose with the Systemsetting module how the screens are arranged, their resolutions, which is the primary and what not. When a screen is connected or disconnected, KScreen will search for an existing configuration for this set of screens and restore that one.

Plasma

The Plasma shell also has to be aware of multiple screens arrangement, because you want the desktops with their wallpapers, widgets and icons to be on the screen you expect it to, as well all the panels to be always on the “proper” screen you expect it to. And that’s where we had a lot of problems in the past, and various approaches have been attempted.

Current

Currently, up to 5.26 Plasma relied on two concepts for working out which screen a desktop and panel should be. Combining a single primary monitor and using screen connectors names for disambiguate second and third screens. In theory

There are a couple of things that can go wrong with this: between X11 and Wayland, connector names tend to be different (for instance HDMI-1 vs HDMI-A-1 on my system).

Another problem is related to the the USB-C based docks that have video outputs (such as the Steamdeck one, but is common to any other model and brand). They dynamically create and delete the outputs and connectors when they are plugged and unplugged, but the connector name is not stable between different plugs/unplugs: sometimes after re-plugging the old names are not recycled, but increased (so for instance if those were DP-2 and DP-3, they may become all the sudden DP-4 and DP-5). Since we used to store those names, we have a problem: each time a new connector name is encountered is treated as a completely new thing, giving its new empty default desktop and no panels, causing many wtf moments.

Plasma Containments (technical name of the desktops and panels) always had a screen property associated to them which is just an integer: 0 for the primary screen and then 1,2,etc for the others.

5.27

The new approach builds on a single design, extending the primary monitor concept to multiple monitors, which cleans up the codepaths even for the two monitor case.

So we now dropped this association map between screen number integers and connector names, and we go with this ordered list all the way down, so now Plasma, KWin and KScreen agree exactly who “Screen 1” is.

We have a new Wayland protocol for screen ordering (as well an X11 counterpart) for KScreen and KWin to agree to which one is the real logical ordering of the screens, so Plasmashell will now follow this without attempting to identify monitors by itself, removing a very big failure point.

As said, When your system has only 2 screens, in the Systemsettings module you’ll see exactly the UI it had: just a checkbox to select which one is the “Primary”, so no surprises here. When you have 3 screens or more then you are presented with a dialog where you can visually reorder the screens, to decide which is the first, which is the second etc.

In this way, you’ll always be sure that whichever screen was set as “first” will have your “main” set of panels and desktop widgets, that you will never lose, also whichever you set as “second” will always have the desktop and panels you set it and never change and so on.

63 thoughts on “Multi Screen

  1. Pingback: Update on new multi-screen support on KDE Plasma - My Blog

  2. Miha

    Wouldn’t it be better to name the layouts? It might be that that you use three monitors, so most of the time the secondary and tertiary monitor are designated for some programming task, while in other scenario you might only have two outputs. If the secondary output is projector, you might want to have completely different role for the secondary output. It would make sense not to enumerate different output devices by setting their priority, but picking plasma activities that they display.

    1. Gauthier

      Having some kind of manager / setting that allows to set a given layout to a given screen is something I proposed here (https://bugs.kde.org/show_bug.cgi?id=434711) and which would make layout management very slick.

      I imagine this will get easier to implement with the tidier approach explained here to identify screen (in combination with the existing work done on layout management which allows to move specific items – panels, etc – to a given screen).

    2. AD

      I agree, the secondary screen maybe used differently in different situations. Therefor, it’d be helpful if a window appeared up-on connecting, asking which layout to choose:
      A already defined and used one (work, presentation, …) or a plain new one (extending, mirroring, …)
      If certain screens can be uniquely identified, this dialog may be automatically skipped.

      All the best and thanks for your efforts!

      1. Marco Martin Post author

        Note that the saved screen layouts on kscreen side are stored per-screen(edid) rather than per-connector, so connecting for instance a (never connected before) projector at a conference will be already seen as a “different thing” from your dual monitor setup at home, prompting the on screen display asking whether you want to extend or clone

        1. Gábor Katona

          That is fine and I am very thankful that you have corrected multi monitor usage.

          However as I understand the others (and also me) would like the following: we have a never connected projector. We get the prompt whether to extend or clone. We chose extend. As far as I understand your post now the projector will be screen2 and will get the layout for screen2. However screen2 is set up for home use. We would like to be able to say that this is a different screen2, so we need other icons, widgets, etc, or just a clean desktop for presentation. Is it possible with the new solution? If not, do we have chance to have this feature?

          1. Gauthier

            I “think” what Marco said was that because layout are linked to specific screens, then if you connect a never connected projector and extend, then you’ll just have an empty desktop and NOT the the layout for “screen 2”. In fact AFAIU screen 2 does not have a meaning in that context, we need to think about as “set-up 1” (e.g. just laptop screen), “set-up 2” (e.g. laptop with two external screens at home), “set-up 3” (e.g. laptop with one external screen in the office), and so on. Am I getting this correctly? …I guess I’ll get to try in a few days 🙂

            However sounds like there is still one drawback (not meant as a criticism but just as a suggestion to improve what already sounds like a great improvement with this new approach :)) which is that if I go to the office, I’m likely to want to have the same layout in one of my external screens there to one of the screen I have at home, and so it would be nice to have a way to remember layouts and assign them to a “new screen” (never connected before) so we don’t have to re set-up a layout every time we connect a new screen.

            Hence the idea (as mentioned in previous post) to have some kind of “screen layout manager” which remembers layouts independently of screens so we could assign and reassign them easily to new and existing screen. We could even name the different layouts (e.g. projector). Additionally when you plug a “new screen” you could get the options: clone; extend (=empty) right/left, layout 1 (=primary) left/right, layout 2 left/right, and so one.

            Does any of that make sense Marco or not all all?

  3. Pingback: KDE Plasma 5.27 để cung cấp hỗ trợ đa màn hình tốt hơn - VI Atsit

  4. rottenpants

    Awesome improvements!

    Hope this fixes problems related to usb c docks. In my case, every time i boot my laptop with the usb c dock connected i get a black screen before login.

    1. Justin Webster

      Awesome news, can’t wait to try out, will this take into account rotated screens too? Have my 3 in a PLP/VHV layout (Portrait/Landscape/Portrait) or (Vertical/Horizontal/Vertical)

  5. galder

    About the primary monitor. I understand that the standard is to use this option to define whitch monitor will have the default panel. So if I have 3 monitors. I would choose the second monitor as primary monitor. The panel always goes there.
    Unless the panel has an option to define whitch monitor should follow.

    1. Marco Martin Post author

      yes, you can do like that, so the panel would be for instance in the internal laptop screen when there is nothing connected, and when you connect the external monitor, if you did set that’s the primary, the panel (and the desktop as well along with its wallpaper, widgets and icons) would automatically migrate to the external one, going back to the internal.
      This already worked, what changes now is that there is also the concept of a secondary, a 3rd and so on, so that you can define exactly which panel goes to which monitor even with more complicate setups that have 3 or more screens

  6. Pingback: KDE Plasma 5.27 for å gi bedre støtte for flere skjermer - All Things IT

  7. Michael

    In the current implementation of kscreen2, display-port monitors are handled differently. If a displayport connected monitor is powered down, kscreen2 moves the windows off that monitor and onto other powered-on monitors. I guess that’s because a power-off event /state can be detected for displayport only. In a mixed HDMI/DVI/Displayport desktop, treating one kind of monitor-connection differently isn’t desirable. Is that going to change? I actually disable kscreen 2 to avoid this issue.

    I think kscreen2 also caused me issues when I scaled my older 1900×1200 monitor by 1.75 to better match my 4k monitor. Do any of these changes related to scaling?

  8. Random guy

    I.ve got a simple idea. Kde allready have virtual desktops… So how about link them to monitors. There should be an option to choose which monitor should be linked to which virtual desktop.
    E.G. When you connect second monitor averything on virtual desktop 2 will shown on second screen…

  9. Corey Schuhen

    Hi, have any improvements been made for touch screen support? One of my external monitors has touch and most times the touch events are aligned to the wrong screen, deeming the feature useless. There does not seem to be a place to configure this. Under Wayland, even the command line tools don’t work properly.

    1. Oded

      It would be great if SDDM can be made to apply a kscreen configuration from a user, or SDDM KCM can deploy the kscreen configuration to the root account, like it pretends to do today.

  10. Pingback: Update on new multi-screen support on KDE Plasma - H4Host.com - Latest Web Hosting News

  11. Pingback: Update on new multi-screen support on KDE Plasma - SharewarePile.com - Latest Web Hosting News

  12. Vladimir

    >>In this way, you’ll always be sure that whichever screen was set as “first” will have your “main” set of panels and desktop widgets, that you will never lose, also whichever you set as “second” will always have the desktop and panels you set it and never change and so on.

    I hope this doesn’t apply to the case when the primary external monitor is unplugged from a laptop and laptop’s display becomes the primary (and thus all Plasma panels, widgets and settings apply to laptop’s screen) until the external one gets connected again.

    1. Marco Martin Post author

      when you unplug the external monitor, the laptop one becomes the primary. it did behave like that before and it did not change.

      Specifically, it’s always ensured that one of the connected outputs is always the primary

  13. Pingback: KDE Multi-Screen - My Blog

  14. Pingback: KDE Plasma 5.27 เพื่อให้การสนับสนุนหลายจอภาพที่ดีขึ้น - TH Atsit

  15. Pingback: This week in KDE: Wayland fractional scaling - My Blog

  16. Pingback: KDE Plasma 5.27 para fornecer melhor suporte a vários monitores - BR Atsit

  17. Pingback: KDE Plasma 5.27 Untuk Menyediakan Sokongan Pelbagai Pemantau yang Lebih Baik - MS Atsit

  18. Pingback: 重点优化多显示器应用场景,KDE Plasma 5.27 桌面环境预告新特性 - 神卡网

  19. Pingback: KDE Plasma 5.27 pour fournir une meilleure prise en charge multi-moniteurs - FR Atsit

  20. Pingback: KDE Plasma 5.27 Untuk Memberikan Dukungan Multi-Monitor yang Lebih Baik - ID Atsit

  21. Pingback: KDE Plasma 5.27 Para Magbigay ng Mas Mabuting Multi-Monitor Support - TL Atsit

  22. Pingback: KDE Plasma 5.27 für bessere Multi-Monitor-Unterstützung - DE Atsit

  23. Pingback: This week in KDE: Wayland fractional scaling and fixed multi-screen - My Blog

  24. Pingback: Update on new multi-screen support on KDE Plasma - IMoneyHub.com

  25. Pingback: KDE Plasma 5.27 om betere ondersteuning voor meerdere monitoren te bieden - NL Atsit

  26. Pingback: KDE Plasma 5.27 a jobb többmonitoros támogatás érdekében - HU Atsit

  27. Pingback: Update on new multi-screen support on KDE Plasma - makemoneyonlinecom.com

  28. Pingback: KDE Plasma 5.27 för att ge bättre stöd för flera bildskärmar - All Things IT

  29. Pingback: KDE Plasma 5.27 para proporcionar una mejor compatibilidad con varios monitores - ES Atsit

  30. Pingback: KDE Plasma 5.27 per fornire un migliore supporto multi-monitor - IT Atsit

  31. jpetso

    I use my laptop at work and at my WFH setup. In one case, the monitor is above my laptop screen with 4K resolution, in the other case it’s on the side of it with 1440p. I think the co-commenter’s point that temporary presentation displays shouldn’t necessarily be part of the regular 1, 2, 3, … priority pipeline is a good one as well, so count me as concerned that by fixing one set of issues, another set of issues might crop up instead. I’ll see how it works out before complaining though.

    But here’s an idea.

    If EDID isn’t available and display connector names are unstable, what about introducing another identifier in between that provides relative stability? And that identifier would be a representation of available display modes. You might get incrementing numbers when connecting or reconnecting DisplayPort cables, but for the same monitor you should always get a stable set of display modes. Hash them together and you have something better than DP-2.

    Now, this might not work perfectly if the same monitor provides a different set of display modes via HDMI compared to DisplayPort. And frankly, I think that’s okay. It’s still no worse off than switching between DP-1 and HDMI-1, while increasing stability in all cases that I can think of.

  32. Pingback: KDE Plasma 5.27 Για καλύτερη υποστήριξη πολλαπλών οθονών - All Things IT

  33. John

    1 simple question.

    You said this”When you have 3 screens or more then you are presented with a dialog where you can visually reorder the screens, to decide which is the first, which is the second etc.”

    Does that mean primary screen = screen 1
    OR
    Does that mean screen 1 as in left to right : 1,2,3
    OR
    Does that mean screen 1 as in right to left : 3,2,1

    Or does that mean we arrange our screens the way we want them, select our primary (in my case the middle one) and we hit hit apply the system names them 1,2 *primary, 3?

    IN simplest of terms i mean – I know that the name will actually be HDMA-1, DP-2, DVI-3 or whatever the connector type is (in my case all 3 = DP connector)

    1. Marco Martin Post author

      with the ui in that screenshot that says “change priorities” you can arrange them as you want, their “priority” is disconnected with their relative geometry, so you can have the middle one as primary

  34. Stuart K Smith

    Thank goodness! I am a multi-monitor user that has gone through various iterations of arrangement and have several different computers with all different setups. I have struggled with Kscreen for so long I now remove it completely and create scripts to set my screen configs for each new installation.

    As far as others comments about the “how” – I’d rather wait for the improvements and having a much more usable default system. THEN talk about how it could be improved or broadened.

    Thanks for the great effort!

  35. Bob

    This would be the biggest improvements in years. I’ve been loosing my desktops on weekly bases for years, especially when laptop wakes up with different monitors or when a screen quickly reconnects . I use a docking station with triple screen at work, single or dual screen at home, sometimes TV, sometimes just built in screen. I’ve given up on any customization, i just learned to quickly right-click and add default panel…

    Wish you luck! There have been many bug fixes in the past that claimed to have fixed it.

  36. Pingback: For KDE Plasma 5.27 we did a big refactor on how the screens are managed - My Blog

  37. Pingback: Revisiting KDE – Cybe™

  38. rik

    I’ve got 2 monitors on my desktop. The primary monitor is in front of me and my desktop extends to the LEFT. Will this finally fix the various glitches with this arrangement?
    Apparently in a two monitor setup everyone assumes that it extends to the RIGHT. KDE gets this mostly right, but not always.

    Also, in this setup sometimes when I turn off one or more monitors, various programs with jump to the other monitor. Does this version address the issue when one or both monitors are turned of? All of the windows should stay right where they are unless I explicitly change them.

    Other than that, keep up the good work. KDE, even with all it’s warts, manages to handle the extend to the left case much better than everyone else.

    1. Michael

      Is one of the connections DisplayPort? When I added a DisplayPort monitor I found I have to disable KScreen to stop that from happening.

  39. Pingback: Тестирование рабочего стола KDE Plasma 5.27 — AllUNIX.ru — Всероссийский портал о UNIX-системах

  40. Pingback: Κλασματική κλιμάκωση Wayland! Α, και διορθώσαμε επίσης την πολλαπλή οθόνη – Περιπέτειες σε Linux και KDE - Ιστολόγιο

  41. Pingback: How to report Multiscreen bugs | Mart

  42. Pingback: KDE Plasma 27 Beta in Debian Unstable – My CMS

  43. Pingback: KDE Plasma 5.27 LTS als letzte Ausgabe von Plasma 5 – My CMS

  44. Pingback: Plasma 5.27 LTS verbessert Multi-Screen-Setups – My CMS

  45. Pingback: KDE Plasma 5.27 LTS Beta – My CMS

  46. Pingback: KDE Plasma 5.27 veröffentlicht, das ist neu | UbuntuNetz

Comments are closed.