[Bug Fix] Per-screen virtual desktops

Thanks for the explanation. I understand your point, and from a technical architecture perspective you’re probably correct that this is primarily a session restore problem and not directly a per-screen virtual desktop problem.

I think my expectation was more feature-oriented than implementation-oriented. As an end user, what I wanted was simply:

  • Firefox always on the left monitor, Desktop 1.
  • VMware always on the left monitor, Desktop 2.
  • Teams on the right monitor, Desktop 3.
  • Obsidian always on the right monitor, Desktop 4.

Whether this is achieved by session restore, the virtual desktop implementation, or some other component doesn’t really matter from my perspective—the end result is what I was looking for.

The reason I associated it with per-screen virtual desktops is that session restore already brings my applications back. The missing piece is that they all come back on the wrong virtual desktops or monitors. Somewhere in the stack, something has to become responsible for restoring not only the window geometry, but also the virtual desktop assignment and screen assignment.

Since per-screen virtual desktops introduce this entirely new concept of independent desktop layouts per monitor, my intuition is that this responsibility could naturally belong to that feature. As it extends the existing virtual desktop functionality, I would expect it to “take over” after session restore has recreated the windows and move them onto the correct virtual desktops for each monitor. Of course, I’m not a KDE developer, so I may be completely wrong about where this responsibility should live—it just seems like the most logical place from an architectural point of view.

If that isn’t the correct place, perhaps the people working on the Wayland session restore protocol should take this extension into account and restore not only the windows themselves but also their virtual desktop assignments. If you see the work in this corner so to speak i will ask them if they can implement the missing things. Just give me a short feedback for this as im not familiar with the inner workings of KDE dev structure.

Technically, I can absolutely see your argument. From the user’s point of view, however, the current implementation doesn’t really improve my workflow yet. Every morning I still spend time moving windows back to the monitors and desktops where I need them. In fact, because there are now independent desktops per screen, manually restoring everything arguably requires even more interaction than before.

So for me, the groundwork is clearly there, but the workflow isn’t complete yet. Once applications reliably return to the correct monitor and the correct virtual desktop, this would become a huge productivity feature.

From my testing, I think the remaining pieces are roughly:

  • Wayland session restore: Restore windows onto the correct monitor and the correct virtual desktop.
  • KWin Window Rules: Rules should consistently be honored, even for applications restored automatically by the session manager. If I force an application onto a specific monitor and virtual desktop, it should always end up there.
  • Per-screen virtual desktops: Once session restore has recreated all windows, this feature could be responsible for placing them onto the correct per-monitor virtual desktops, since it extends the traditional virtual desktop model.

As a thank-you for getting the foundation into Plasma after all these years, I’d still like to paypal you €250 toward the groundwork that has been done. It’s an important milestone, even if it doesn’t yet solve the workflow I was hoping for. Hopefully the remaining pieces can be built on top of it.

Out of curiosity: do you consider this feature complete?

From my perspective, it’s a bit like building a swimming pool without the water. The structure is there, and it’s good work, but the part that actually makes it useful in day-to-day use is still partly missing.

Right now, with session restore bringing windows back onto seemingly arbitrary monitors and virtual desktops, the situation is actually more confusing for me than before. I honestly spend more time reorganizing my workspace after every login than I did with global virtual desktops. So while I can absolutely appreciate the technical achievement, it doesn’t yet translate into a productivity improvement for my workflow.

How do you see the path forward? If you were to implement the missing workflow, where would you put it architecturally? Would you extend the per-screen virtual desktop feature to reposition restored windows, or would you rather have the session restore team/component restore monitor and virtual desktop assignments directly? If the later please let me know and i will open an issue with them. Thanks again for your hard work and making free software better!

If that isn’t the correct place, perhaps the people working on the Wayland session restore protocol should take this extension into account and restore not only the windows themselves but also their virtual desktop assignments. If you see the work in this corner so to speak i will ask them if they can implement the missing things. Just give me a short feedback for this as im not familiar with the inner workings of KDE dev structure.

I’m not familiar with session restore, but based on a quick glance it seems that it does restore virtual desktop assignment, position (i.e. the monitor, as long as you didn’t change your monitor layout) and bunch of other stuff. I assume that it doesn’t work because the applications don’t support the protocol yet.

So for me, the groundwork is clearly there, but the workflow isn’t complete yet. Once applications reliably return to the correct monitor and the correct virtual desktop, this would become a huge productivity feature.

I understand that manually sorting your windows every morning is annoying. But I would assume that it’s a minor issue compared to being forced to switch virtual desktops on all monitors at the same time for the rest of the day (i.e. as it was before Plasma 6.7), which is completely unusable for me.

Per-screen virtual desktops: Once session restore has recreated all windows, this feature could be responsible for placing them onto the correct per-monitor virtual desktops, since it extends the traditional virtual desktop model.

This is the responsibility of the session restore functionality. The per-screen virtual desktops just make it possible to show different desktops on each monitor (and fix all of the places that previously relied on all monitors showing the same desktop: this was the majority of the work).

As a thank-you for getting the foundation into Plasma after all these years, I’d still like to paypal you €250 toward the groundwork that has been done. It’s an important milestone, even if it doesn’t yet solve the workflow I was hoping for. Hopefully the remaining pieces can be built on top of it.

Thank you. I received the money.

Out of curiosity: do you consider this feature complete?

I have a few bugfixes waiting for review and other bugs may be discovered in the future. But I do consider it feature complete. I switched my work machine to Plasma with the release of 6.7 (from AwesomeWM) and it’s been working very nicely for me (albeit with many configuration changes).

How do you see the path forward? If you were to implement the missing workflow, where would you put it architecturally? Would you extend the per-screen virtual desktop feature to reposition restored windows, or would you rather have the session restore team/component restore monitor and virtual desktop assignments directly? If the later please let me know and i will open an issue with them. Thanks again for your hard work and making free software better!

AFAIK everything that you’re describing belongs session restore. Since kwin supports the session restore protocol already, it should be just be up to the applications/toolkits to implement it as well.

Though (as far as I can tell) it goes through the same codepath as window rules, so it’s probably going to be subject to the same bugs/weird behaviors. IMO you should be able to set up the desktop and monitor assignment through window rules, but I can confirm that they don’t seem to work 100% correctly. I’m using them with autostart: there’s probably some race-condition and sometimes a window ends up on an incorrect desktop (+ task manager thinks that some of the windows are on a different desktop than they are). Not to mention that it’s annoying for desktops to be switching back and forth as the various apps start.