How to delete saved session [SOLVED]

How do I delete saved sessions when using the “When session was manually saved” setting? I have tried to do:

rm -r ~/.config/session/*
rm -r ~/.local/share/plasmasessionrestore/*

but the session is still getting restored at next log-in.
I know it is possible to just save the session again after closing the windows but I would like to delete the config files using a small script (or keyboard shortcut) instead. XFCE had a “forget session” button that I wish was in Plasma as well.
I am using Wayland and Plasma 6.4.1.

If I understand well, this is no sufficient? :

Regards

Thank you, but not what I was looking for this time, but I forgot that I could just save the session and do: find -type f -printf '%T@ %p\n' | sort -n | tail -10 to see the last 10 changes, and in that output I could see the file ~/.config/ksmserverrc and ~/.local/state/plasmasessionrestorestaterc being changed, so I guess they are the files I have been looking for.

you can simply delete the entire ~/.config/session folder.

plasma will recreate the folder and populate it with the necessary files to restore a session if it needs to.

probably a good idea to clean this out once in while, i found session files in there from 2024

No, i did try that. I had to delete ~/.local/state/plasmasessionrestorestaterc I think the session folder you mentioned only stores part of the information to restore a saved session. I think it has mostly Kwin stuff. not which apps that are open. I also had to delet part of ~/.config/ksmserverrc but not all, because this is the file that stores the setting that says that you want to manually save a session. So if you delete the whole file you are back to the setting that restores all apps that where open when you log out, and I dont want that, I want to restore only the apps that where open when I manually saved. We should really get a “forget session” button next to the “save session” button.

worked for me… my saved session no longer works and all i did was rename the session folder.

and now that i’m back into restore previous session (my usual default) then it’s working as expected.

but i’m on plasma 5 using x11 so maybe that matters.

yes , at first I was trying some commands from internet but they where for Plasma 4 , they did not work so I guess things have changed a bit. Maybe Wayland does things a little different as well.