Bug 477146 - On X11, the last opened window is not restored by session restore
Summary: On X11, the last opened window is not restored by session restore
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Session Management (show other bugs)
Version: 5.27.80
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2023-11-17 15:56 UTC by Kishore Gopalakrishnan
Modified: 2024-02-20 21:26 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kishore Gopalakrishnan 2023-11-17 15:56:01 UTC
SUMMARY
In the Plasma 6 alpha, while using the X11 session, session restore does not restore the last window that the user opened, but all other windows seem to be restored correctly.

STEPS TO REPRODUCE
1. Log in to the X11 session
2. In System Settings > Session > Desktop Session, set 'on login launch apps that were open:' to 'on last logout'
3. Close all open windows
4. Use krunner to open a Konsole window
5. Use krunner to open another Konsole window
6. Reboot by invoking krunner and typing 'restart'
7. Login to X11 session after reboot

OBSERVED RESULTS
The window opened in step 5 is not restored.

EXPECTED RESULTS
Windows of all applications that support session restore should be restored.

ADDITIONAL INFORMATION
A. If the window in step 5 is opened by using Konsole's Ctrl+Shift+N (new window) shortcut in the existing Konsole window, session restore restores both the Konsole windows (i.e. the bug does not occur).
B. The same bug is reproducible for other applications like Dolphin and System Settings.
C. The bug also occurs if the window in step 5 was opened through the application launcher menu (the one that is on the left side of the panel by default).
D. Also reproducible in a fresh user account (ran `rm -rf .config .local .cache .bash*` in a tty to clear all settings).

SOFTWARE VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.27.80
KDE Frameworks Version: 5.245.0
Qt Version: 6.6.0
Kernel Version: 6.1.62-1-lts (64-bit)
Graphics Platform: X11
Konsole 24.01.75
Dolphin 24.01.75
Comment 1 Bug Janitor Service 2024-02-11 16:23:34 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3889
Comment 2 David Edmundson 2024-02-20 11:08:53 UTC
Git commit 5344b9097f5772cd819ca839e86fb27b62d34092 by David Edmundson, on behalf of Kishore Gopalakrishnan.
Committed on 20/02/2024 at 10:52.
Pushed by davidedmundson into branch 'master'.

KSMServer::tryRestore: fix indexing of entries

Inspection of entries in .config/ksmserverrc suggests that the session
application entries are indexed starting from 1, while the code seems to
assume that it starts from 0. This wrong assumption leads to restoring
only N-1 windows, when N windows were supposed to be restored.

M  +1    -1    ksmserver/server.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/5344b9097f5772cd819ca839e86fb27b62d34092
Comment 3 Fushan Wen 2024-02-20 13:20:23 UTC
Git commit 0b70f5362d79c50ccbc32e9c39d67e8b5ba780e3 by Fushan Wen, on behalf of Kishore Gopalakrishnan.
Committed on 20/02/2024 at 13:18.
Pushed by fusionfuture into branch 'Plasma/6.0'.

KSMServer::tryRestore: fix indexing of entries

Inspection of entries in .config/ksmserverrc suggests that the session
application entries are indexed starting from 1, while the code seems to
assume that it starts from 0. This wrong assumption leads to restoring
only N-1 windows, when N windows were supposed to be restored.


(cherry picked from commit 5344b9097f5772cd819ca839e86fb27b62d34092)

M  +1    -1    ksmserver/server.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/0b70f5362d79c50ccbc32e9c39d67e8b5ba780e3