SUMMARY When logging out and back in, some apps get moved and in my case seemingly to the right. STEPS TO REPRODUCE 1. Have a whole bunch of things open, probably necessary with multiple monitors. 2. Take a snapshot of your screen 3. Log out and back in 4. See what's moved OBSERVED RESULT Things move EXPECTED RESULT Windows to come back up in their original place. SOFTWARE/OS VERSIONS Operating System: openSUSE Tumbleweed 20230417 KDE Plasma Version: 5.27.4 KDE Frameworks Version: 5.105.0 Qt Version: 5.15.8 Kernel Version: 6.2.10-1-default (64-bit) Graphics Platform: X11 Processors: 16 × Intel® Core™ i7-5960X CPU @ 3.00GHz Memory: 30.9 GiB of RAM Graphics Processor: AMD Radeon HD 7700 Series Manufacturer: ASUS Product Name: All Series ADDITIONAL INFORMATION I've setup a script to take snapshot of the screen on login and logout. It also gathers as many configuration files as I could. I will put all this in a zip file and upload it. Also, I took snapshots before login out for a full comparison. QUESTION: Is there any way to run a script pre-logging out? That way I could take a screenshot and gather config info. automatically before the logging out process. Right now, if I want that I have to do it myself. The problem with the logout script running as it is, is that most things have been removed from the screen before the script can take a screen snapshot. That said, it looks to me that the things that are being moved ARE the ones that are still showing when logout script is run so that might be a good clue as to the cause.
There are a few things that have moved and the most obvious visually in the attached files is the clock moving to the right. I logged out and back in twice so you can see what's happening clearly. In the attached are images and backups of the KDE configuration all of which are file names with dateTime stamps to make it very easy to see the sequence of events. The images I had to reduce down and upload one at a time so your system would take them, the config files are all in a tar.gz file.
Created attachment 158295 [details] Time stamped sets of configuation files
Created attachment 158296 [details] 2023-04-21_15.30.45-Logout
Created attachment 158297 [details] 2023-04-21_15.30.59-Login
Created attachment 158298 [details] 2023-04-21_15.28.30-Login
Created attachment 158299 [details] 2023-04-21_15.28.14-Logout
Created attachment 158300 [details] 2023-04-21_15:29:31-Pre-Logout
Created attachment 158301 [details] 2023-04-21_15:24:11-Pre-Logout
On X11 it's up to apps to store and restore their window positions; KWin doesn't and can't do this, due to the way X11 works and what apps expect from it. On Wayland, it will eventually be possible for KWin to save and restore window positions itself; see Bug 15329.
(In reply to Nate Graham from comment #9) > On X11 it's up to apps to store and restore their window positions; KWin > doesn't and can't do this, due to the way X11 works and what apps expect > from it. > > On Wayland, it will eventually be possible for KWin to save and restore > window positions itself; see Bug 15329. Thanks for pointing me to that. Wow! A 20 year old bug, that was quite a read going through all those comments. One quick question as I asked this before I'll just past the question as asked below: QUESTION: Is there any way to run a script pre-logging out? That way I could take a screenshot and gather config info. automatically before the logging out process. Right now, if I want that I have to do it myself. The problem with the logout script running as it is, is that most things have been removed from the screen before the script can take a screen snapshot. That said, it looks to me that the things that are being moved ARE the ones that are still showing when logout script is run so that might be a good clue as to the cause. FOLLOW UP: It's not just for debugging I am asking this. I am software developer and I do run command line scripts for reasons other than debugging and it would be incredibly useful to be able to do this. For example, one I can think of immediately: "If close the apps before the logging out process manually then when I log in most of those apps that moved (maybe all of them, I'll have to check) come back in their right place. It's only when I log out without first closing them that this issue happens." Hm, maybe that's a nicety that KDE could do for people until there is a proper fix? That is, log all these apps out like a user manually closing the apps before any of the other logging out operation occurs because that solves most if not all of it anyway. My guess is that's probably because the apps have a chance to record their proper position whereas right now something is changing first so that when they get logged out they record a wrong position. Maybe this is a KDE bug after all since a manual operation produces the correct result but just logging out without first closing the apps does not??? Sorry, I didn't think to mention that previously because it just didn't occur to me but I regularly log out of my most important apps that I don't want to change on me, particularly my Jetbrains IDE so that it comes back with all the windows in the right place. Again, sorry I didn't think to mention this previously. But back to my question, is there way to perform an operation before anything else on a logout? ...because with that I can immediately effect a fix.
Unfortunately I'm not aware of a built-in facility to do that. The logout scripts you can add using System Settings > Startup and Shutdown > Autostart > "Add..." button > "Add Logout Script" run quite late. If you're a software developer, you may be able to write a small program to do this by listening for a DBus signal sent by ksmserver when the system is told to shut down.