SUMMARY There are numerous bugs both here and elsewhere that report how KDE and Google Chrome do not behave nicely on logout. Particularly how on future sessions, Chrome opens with no memory of previously opened tabs. Most of these suggest a logout script (installed under KDE autostart) to kill Chrome prior to logout. I had applied such a solution and found that while not perfect, it achieved what was required. Since transitioning to Wayland, this script no longer functions, and I am unable to guarantee a clean logout that will allow me to resume in future sessions. Given how ubiquitous Chrome is, how long this issue has existed, and the recent push to move to Wayland, this is becoming a bigger issue SCRIPT I have the following script code set to run on logout: #!/bin/bash killall -INT chrome sleep 2 OBSERVED RESULT UNDER X11 This is not a perfect solution, the script will kill all running instances of Chrome, then wait two seconds to allow Chrome to write currently open tabs to disk. In a future plasma session, when I launch Chrome, it will report that Chrome crashed and ask me if I wish to restore all previously open windows/tabs. If I select yes, it will re-open all tabs I had from the previous session. This is not perfect, I would prefer Chrome to just open without asking me, but I can live with that "issue" OBSERVED RESULT UNDER WAYLAND Observed outcomes are random, I see one of three situations occurring with roughly equal probability when I start Chrome in a future plasma wayland session a) The same as above, Chrome reported it crashed and asks me if I wish to restore previously opened windows/tabs. I select yes and all is OK b) Chrome reports that it crashed and asks me if I wish to restore previously opened windows/tabs. I select yes and some of my previously opened windows/tabs are restored, others are not. Furthermore, the remaining windows/tabs are NOT in the Chrome history when trying to open previously closed tabs c) Chrome reports no issues and starts with no windows/tabs open. None of the tabs from the previous sessions are saved in the history and cannot be recovered/reopened from anywhere These three occur with equal probability, issuing a manual "killall -9 chrome" on the command line prior to logging out always works as per (a) above WHAT I'VE TRIED I've tried increasing the wait time in the sleep command to five seconds, this has not changed the probability of any of the three outcomes occurring. I've tried inserting a "kdialog" command after the sleep command to stop the logout/shutdown process until I click "ok" on the dialog box, this has not changed the probability of any of the three outcomes occurring EXPECTED RESULT Behaviour of logout scripts under wayland only should not be this random. Furthermore, this issue has been a bug for a long time. Is it not possible, particularly given how common Chrome use is, to put a fix into KDE such that Chrome is shutdown cleanly before logout, such that restarting in a future session will automatically open all previously opened windows/tabs SOFTWARE/OS VERSIONS Linux/KDE Plasma: Linux 6.12.58 KDE Plasma Version: 6.5.4 KDE Frameworks Version: 6.20.0 Qt Version: 6.10.1
Ultimately, this will be solved by the work being done on proper application content and state save and restore, tracked in bug 436318 Unfortunately, KDE has no control over whether Chrome properly restores it's tabs when it's killed. That's up to Chrome, and this bug should be reported to the Chrome developers. I do see a problem with Chrome not shutting down properly on Plasma built from git-master, using Wayland. I set it to "continue where you left off" at startup. After logging out and back in, Chrome popped up the error that it wasn't shut down properly and offered to restore my tabs, which was successful. The potentially actionable thing for KDE would be to figure out why Chrome is being shut down in a way that makes it think it crashed.
Thank you Tracey While ultimately this would be best, there are really two issues here. ======== ISSUE 1 The first one is why does the stop script that works 100% under KDE-X11 have three different outcomes occurring randomly under KDE_wayland? This part of the issue must surely be a KDE problem. How the shutdown script behave differently under wayland only. To repeat myself 1a) killall -9 chrome (at the Konsole terminal) 1b) logout/shutdown Results in Chrome complaining on startup, but at least allowing a restore of previously open tabs 2a) logout/shutdown 2b) auto-execution of logout script which executes (1a) above followed by a sleep Results in 33% chance Chrome complaining on startup but allowing a restore, 33% chance Chrome complaining on startup but allowing a partial restore, 33% Chrome NOT complaining on startup but not allowing any restore Like I mentioned previously, bug 436318 would be the ideal fix, but in the meantime there is something "strange" happening with the auto-execution of logout scripts, but only under wayland ======== ISSUE 2 Resolvable by bug 436318 I am not saying this just a KDE issue, there is obviously something with Chrome misbehaving as well. But surely one of the main software packages not closing down properly is a serious enough issue that it is worth looking at?