Panels on shared screen edges

Plasma 5.8 will bring an improvement fixing a bug reported more than a decade ago. Back then Plasma did not even exist, the bug is reported against an early KDE 3 version. The addressed problem is the handling of panels on multi-screen setups.

This is if one has multiple screens and tries to put a panel between two screens – on the shared edge – the panel does not have a “strut” set and thus windows maximize below it:

[------------][------------]
|            ||P           |
|      1     ||P     2     |
|            ||P           |
[------------][------------]

In this illustrated setup the panel is “P” and windows on screen 2 ignore the panel. What might be surprising here is that this was not just a bug, but deliberate behavior. There is code making sure that the panel on the shared edge gets ignored. Now one doesn’t write code to explicit break useful features, there’s obviously a good reason for that.

And to understand that we must look at how panels and there struts work. First let’s look at Wayland. Wayland doesn’t have a concept for panels or struts by default. KWin provides the PlasmaSurface interface which Plasma can use to give a window the role “Panel” and to describe how the panel is used: whether it’s always on top, or whether windows can cover it or go below. KWin can use that to decide whether the panel should have a strut or not. Thus on Wayland KWin was able to support the setup shown above since it supports panels.

On X11, though, we have the NETWM spec which describes how to set a partial strut:

The purpose of struts is to reserve space at the borders of the desktop. This is very useful for a docking area, a taskbar or a panel, for instance. The Window Manager should take this reserved area into account when constraining window positions – maximized windows, for example, should not cover that area.

The start and end values associated with each strut allow areas to be reserved which do not span the entire width or height of the screen. Struts MUST be specified in root window coordinates, that is, they are not relative to the edges of any view port or Xinerama monitor.

Now here we see already the problem: it’s not multi screen aware. The strut is specified in root window coordinates. So in our case above we would need to set a strut for the left edge which spans the complete height. So far so good. But the width of the strut must be specified in root window coordinates which includes the complete screen 1. If Plasma would set this, we would have a problem.

In Plasma 5.7 KWin’s strut handling code got slightly reworked to perform sanity checks on the struts and to ignore struts affecting other screens. Basically KWin broke the implementation of given spec and in multi-screen setups only allows struts which make sense.

Now at least KWin could handle this situation properly, but Plasma still has the check to not set a strut on shared edges. For Plasma 5.8 we now changed the condition: if the window manager is KWin we allow such struts. For any other window manager we still go with the previous solution. We still think that we cannot just set a strut which would in the worst case exclude a complete screen. As that’s how the spec is written, we need to assume the window manager is standard compliant. For KWin we know that it is not standard compliant any more and support such struts, so Plasma can make use of it.

This change hopefully improves the multi-screen experience for our Plasma users who use KWin as a window manager.

11 Replies to “Panels on shared screen edges”

  1. I’ve spent time investing on this recently, because our team (deepin linux) is facing the same problem. I almost decided to not allow users to put the Panel/Dock on the shared screen edges, but now, after reading your post, it seems that breaking the standard is right way to go 😛

  2. Nice done. While at it, it seems one cannot put a plasmoid across two screens. This would be a must for permanent multiscreen systems. Something like that :

    [————][————]
    | photo||photo |
    | 1 frame||frame 2 |
    | || |
    [————][————]

    1. I’m sorry, but I don’t think that will ever be avaialable. It’s a rather corner-casing situation (except for photo frame it just doesn’t make sense) and can easily get wrong in many situations (e.g. when changing screen layouts). Let’s keep plasmoids bound to one screen.

  3. Sadly due to instability in KDE, and Winux (the joke term I’m using for the M$ Ubuntu Linux thing), I am currently debating whether I will install Linux on the laptop that I purchased and will show up next week.

    currently my panel freezes on a regular basis and the only way to switch windows is alt tab, often I have experienced plasma crashes, and various bugs in icon widgets. Things got better near the end of KDE 4. then of course there was the switch to 5 and I’ve been right back to lots of bugs and crashes that I don’t report because why bother, it takes 3 years to get a response, and then it’s usually to close.

    I’m tired of dealing with an unstable desktop after the last 15 years of using Linux. I was told the KDE 4 crap wouldn’t happen again, that unstable stuff like that wouldn’t be pushed on users, I don’t feel like that promise was kept.

    If I do decide to install linux on it, I’m debating on moving to a lighter window manager like Fluxbox. I enjoyed it back in the day, but got tired of manually mounting things like flash drives and cd-roms so I switched to KDE 3. Now I don’t use those. I needed a way to watch video’s, so I used SMPlayer, now I stream. I write Java, so Intellij works on anything. I’m simply not sure what KDE offers anymore.

    You fixed a 10 year old bug ‘grats… I realize this isn’t all your falt or kwins and you probably don’t care. I would have paid money to see a full time developed KDE desktop that was stable.

    sorry ’bout the rage quit.

    1. I’ve had the same desktop running stable since 4.x and updating over time through the versions to 5.7 without issue. Have you reported any of the issues you’ve been having?

    2. Why is it that below every blog post detalling an important bug fix or a new feature, somebody downplays the achievement and/or starts bitterly complaining about some completely unrelated thing? Can’t you stand the concept of success? Does everybody have to fail, so nobody is special?

      Your job here is to say “Thank you for your effort, good job”. Or provide some constructive criticism (like a bug report). Or ask a question. Is civility really that f**king radical a concept?

  4. Amazing work going on, one thing to report, from kde neon 5.7.4,the left hand side of the screen has no boundary, like it is part of a multi screen display, except in reality it isn’t, the cursor and windows can disappear down this side… Also the cursor movement display shudder and drag around windows and frames, leaving a trail… I’m not sure if this was reported, if so sorry for the hassle. Is this news, will there be a fix for this? Also keep up the amazing work, it’s a fantastic platform. With kubes on the way. Just need some updates to gwenview and either a major update our compete overhaul of okular… Let’s face it, document viewing is what most of us do outside of the net…. I know this may not be the right place to voice that but you’re closer to the developers ear than I am! Also can we have an update on 5.8!!

    1. Please don’t report bugs on my blog. That’s not the proper place to it – we have bugs.kde.org for that.

Comments are closed.