Bug 509691

Summary: On X11, xosview session-restored twice and at the wrong place
Product: [Plasma] plasmashell Reporter: Jörg Habenicht <j.habenicht>
Component: Session ManagementAssignee: Plasma Bugs List <plasma-bugs-null>
Status: REOPENED ---    
Severity: normal CC: natalie_clarius, nate
Priority: NOR Keywords: X11-only
Version First Reported In: 6.4.5   
Target Milestone: 1.0   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Jörg Habenicht 2025-09-19 18:00:37 UTC
SUMMARY
I use session restore (with german translation, so no exact wording. sorry)
-> restore last opened
I have one xosview app running at the side of my desktop, without a window frame or window border.
And one konsole app besides that.

There seems to be an error in the session restore component.
The konsole app is restored at the correct (the previous) place with the same size.
The xosview app is started twice and at a different place, the center of the screen. The size is correct though.
Besides I run xosview without the window border. The app is restored with border. But this may be defined behaviour?

This is a long existing bug. Probably since plasma version 6.0 .
With plasma version 5.xy there was no error visible restoring xosview. 
Please note: Back then (plasma 5) I did run xosview with window borders. So I can not tell if restoring xosview borderless in plasma 6 did work in plasma 5.

I tested closing the session with two xosview apps. Session restores with four apps started.
I tested closing the session with no xosview app. Session restores correctly with no app started.

STEPS TO REPRODUCE
1. start xosview, move it to the side of the desktop. May run without window borders, this does not matter.
2. In plasma settings -> session -> restore session (x) last opened
3. restart plasma session

OBSERVED RESULT
xosview started twice and at the wrong place (and with window borders enabled)

EXPECTED RESULT
xosview restored just like konsole or any other KDE app.

SOFTWARE/OS VERSIONS
Linux: Gentoo
KDE Plasma Version: 6.4.5
KDE Frameworks Version: 6.16.0
Qt Version: 6.9.2
Graphics Platform: X11

ADDITIONAL INFORMATION
Further information like config files, etc. can be provided.

thank you for having a look into this.
best regards
Comment 1 Nate Graham 2025-10-22 20:46:49 UTC
Is xosview set to auto-start?
Comment 2 Jörg Habenicht 2025-10-23 09:44:32 UTC
Hello Nate,
no currently not, according to the system settings GUI. I did not check the configuration files in .local/ directory though.
It may have been configured to auto-start back then, if the history of old configs matter.

A grep search in .local/ revealed the string "xosview" exists in .local/share/applications/xosview.desktop,  .local/share/kactivitymanagerd/resources/database, .local/share/kactivitymanagerd/resources/working-backup/database, .local/state/plasmasessionrestorestaterc .

The desktop is set to restart the running programs from the previous session.
Comment 3 Nate Graham 2025-10-23 14:20:00 UTC
Thanks. That means the app is doing something strange and saving itself twice or something. I'd recommend asking the app's author about it.
Comment 4 Jörg Habenicht 2025-10-24 09:32:13 UTC
Hello Nate,
sorry, I can not figure it out. Can you give me one more hint?
xosview is a very old app back from the 90s, it got no connection to kde or plasma. I installed version 1.23 and 1.22 with the same result. xosview is started twice during the login autostart. Version 1.22 was dumped during plasma5, so most likely I used that version 1.22 flawless during plasma5. With plasma5 xosview only started once during autostart. What gives?

I tested xterm as another X app. But xterm only starts once during the login autostart.
So yes, plasma6 does not seem to start x apps twice. But the xosview version (1.22) I used with plasma5 (started only once) now starts twice with plasma6. So where is the error in the logical analysis?

Do you got a hint where to look further?
Thanks
Comment 5 Nate Graham 2025-10-24 16:17:05 UTC
When you say "autostart" do you mean "autostart" or "session restore"? Because they're different things. If the app is set up auto-start at login, then it's getting started twice: once by autostart and another time by session restore, and that's tracked by Bug 393844.

Is that what's happening here?
Comment 6 Jörg Habenicht 2025-10-24 19:28:58 UTC
Ah, my bad. Sorry.
No, xosview is not configured in the "autostart" setting. At least this is what the GUI reflects to me.
It is kept running during logout and restored with "session restore".

Quite strange during session restore xterm just starts once, xosview twice.
Closing xosview before logout, no xosview app starts during session start.
Starting xosview from cmd line, the app only starts once. With a second call I can start a second app view of xosview. Just like it should be.

Is there a trace point where I can look with gdb and backtrace the source of the system call to start xosview?
Is there a config file or db entry where I can verify GUI is consistent with the stored "session restore" config?
Is it possible that the switch from plasma5 to plasma6 left some old config behind on the hard disk, which is evaluated by plasma6?

best regards
Comment 7 Nate Graham 2025-10-29 17:08:43 UTC
It might be a good troubleshooting idea to try with a new clean user account on the same computer.
Comment 8 Jörg Habenicht 2025-11-10 22:58:14 UTC
Hello Nate,
good idea. I gave it a try.

1) setup new user with #useradd -m testuser
2) log into the new testuser with sddm login
3) check system settings -> session -> restore previous session, checked
4) start xosview and move the app to the left corner
5) close the session
6) log into the session
7) see see two xosview apps in the middle of the screen (instead of one app in the left corner)
8) if I leave the session with two xosview app windows open, the session restarts with three app windows
9) if I leave the session with three xosview app windows open, the session restarts with four app windows
10) if I leave the session with no xosview app windows open, the session restarts also no app windows

There might be something in the session restoration logic, or maybe a double database entry?

best regards