The "on login: restart apps that were open" option in startup/shutdown are inconsistent. How can I fix this?

I have the setting so that it uses my last login as the settings. My problem is that apps I’ve closed out of will restart at startup (even though they have been closed for a while).

It’s especially a problem for Firefox and VSCode. I get prompted with 5 remote sessions (vs code) and about 100 tabs in FF. Even though I’ve been closed out of them for a bit.

I would like to know more about how KDE recognizes the programs I have open and stores that data. Mostly to satisfy my curiosity.

I will probably switch to using the manual option to save my sessions from now on. But I’d still like to know why this is happening. And why it is inconsistently happening.

Side note, sometimes the app instance (vscode or FF or whatever) is in a different activity and it opens in the “default” activity. I’d like to know if there is a way I can make an app instance (e.g. a VScode session for one specific server) open in a specific activity?

this behavior is when using the Activities feature?

what setting do you have for Desktop Session, under the When logging in rule?

if you change that to Start with an empty session, do you still get this behavior?

It was set to “last logout”.

The problem was that the setting would inconsistently startup previous applications. e.g. I would close all of my FF tabs and VS code windows. And then shutdown.

Then at startup all of my windows from FF and VScode and Dolphin… etc. would open. Despite the fact that at logout I had closed all of those windows.

I’ve changed it to “manual”. I’ll test to see if I get the same behavior after switching to “empty session”. FYI, the firefox setting to resore last session is/was turned off. However, VScode has that same option and it was turned on. So that might explain the problem with vs code. But not FF.

Are you using Wayland or X11?

1 Like

try sudo killall firefox next time you “close” firefox without any tabs open… there might be a stray process still running in another workspace.

you didn’t say if you were using Activities or not… this behavior might be related to having FF open in more than one activity, so when you close it on one it is still open in another.

are you using the snap version of FF or the deb?

In a general sense, the literal answer to your question is that you can’t fix this. Session Restore uses an X11 protocol that not all apps implement–even after like 40 years of X11. So even on X11, not all apps that were open at logout will get opened on the next login when using session restore. This is quite disappointing.

On Wayland, there isn’t even such a protocol at all; it has yet to be agreed upon and rolled out. So if you’re using Wayland, what I suspect it happening is that it’s session-restoring the apps you had open in your last X11 session. On Wayland I would recommend turning off session restore for now as it is quite broken.

In the future when such a Wayland protocol is agreed upon and rolled out, we’ll probably implement a sort of fake session restore for the apps that don’t yet implement the protocol; we’ll record if they were open at logout and then simply launch them again at the next login, relying on them to provide their own state management/restoration behavior until and unless they implement the protocol.


Thank you. I ended up leaving the session restore as “manual save”. This is working well for me.

Concerning vs code. It was a setting in vs code that was causing it to launch 10 screens of previously closed windows.

Im glad to know that about Wayland. I have that as my default on one pc. I like Wayland. But it seems it’s still a few years away from being the default.