How can I make my windows re-open/remember the virtual desktop they were in?

I love KDE, except for one thing…

When I restart my computer, all my windows re-open on Virtual Desktop 1, even though some of them were on other virtual desktops.

The virtual desktops remain through a reboot, but all windows re-open on desktop 1 regardless of their previous associated virtual desktop.

Is this possible to accomplish with window rules? Activities? A kwin script? I’m willing to do anything to get this working.

Honestly, I think it should be the default behavior like it is in GNOME and MS Windows.

Thanks for your help!

3 Likes

Really. I’ve had this setup for a long time.
Here is my setup, I have 6 desktops.
Desktop 1 is Nightly
Desktop 3 Firefox
Desktop 4 has Waterfox and they are always open there. Other apps like Konsole, Spectacle, and Dolphin are on all desktop.
Rules will also get it done, but I’m on a laptop and not always connected to an external monitor. So using the Force options is hit or miss.
The Windows specific settings are so much fun.

Thanks for your response! So it seems like you use Window rules to put specific programs on specific virtual desktops. That’s close to the behavior I want. The main difference is, I want it to be per-window, not per-app.

So if I have two Firefox windows, one on desktop 1 and one on desktop 2, I want each of them to remember their own desktop when I relog/reboot.

Would you be willing to share your window rule setup? Thanks!

Hm strange I have your desired effect without any window rules. Not sure what setting but I’m looking.

Go to Workspace Behavior > Activities > Tab: Switching: Check Remember for each activity
Unsure how this can be related though, but try.

I do have Startup & Shutdown > Desktop Session > On last logout
Maybe you do have that already though.

I do have only 2 Virtual desktop and they called Desko and Deskoo. (so, only 1 word, no numbers - also for my Activities)

I’m using X11and 5.27.11 still.

All this info might or might not help you… :slight_smile:

I can’t seem to find where Workspace Behavior > Activities > Tab: Switching has moved in KDE 6 system settings…

I do see Session > Desktop Session > Session Restore: On last logout. And the windows do in fact reopen on relog/reboot, just all on Desktop 1.

I’m on Wayland. I’d be surprised if X11/Wayland had any effect, but it’s certainly possible.

I’m also not sure if the Activities setting would cause this, since I’m not using activities. Do you use Activities instead of Virtual Desktops?

No, but alongside.

The only rules I have are for certain apps to be on all desktops and some have a size set. You know how many menus come small like the “Configure Special Windows Settings” window. I have no rules for the browsers.

This feature used to worked perfectly in KDE 5 and the issue was reported here weeks ago. I just cannot understand why would you ‘fix’ something that it isn’t broken. Too many problems with KDE 6, I wish I knew before so I could’ve blacklisted the package.

you can try this: right click the window title bar → more actions → configure special application settings - > add property → select virtual desktop in the dropdown menu - > select Force and the desired desktop then apply. It will open the app on the virtual desktop but not in the same place.
I think you can also configure the windows position in there and forcing it but I haven’t tried that yet.

This was my initial thought too, but OP also want to “fingerprint” each window and that that fingerprint somehow gets remembered after closing and opening the application again.

If you open Settings > Window management > Window rules > add new, you can click the “detect window properties” and then click on the window in question.
I tried opening 2 firefox windows, and there is no difference in the information it detects.
But maybe the “window title” can be used to find the exact correct window, but that assumes the title of the window is the same every time.

2 Likes

Just looked at my rules and I do have 1 for Firefox.


I would remove it, but don’t want to mess my good thing. :wink:
I’ll have to look at my other laptops to see if they all have the same setting.

I’m thinking that my desired behavior can likely be achieved via a Kwin script… but I don’t yet have familiarity with that. Perhaps I will give it a try! If I get something working I will update this thread.