Bug 362671 - GTK applications are not restored in Plasma 5.6.x after relogin
Summary: GTK applications are not restored in Plasma 5.6.x after relogin
Status: RESOLVED FIXED
Alias: None
Product: ksmserver
Classification: Plasma
Component: general (show other bugs)
Version: 5.6.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Lubos Lunak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-04 18:03 UTC by Piotr Mierzwinski
Modified: 2016-12-06 23:17 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Mierzwinski 2016-05-04 18:03:12 UTC
None of gtk applications tested by me are not restored after relogin/restart Plasma 5.6.x.

I tested: Firefox, Thunderbird and new Opera. I think all of them are based on GTK2. All tested by me KF applications (konsole, kwrite, dolphin) are restored correctly (including virtual desktop #number).

I'm not sure if this is ksmserver problem or integration of Plasma in Antergos or KaOS. I noticed that in Mageia Cauldron (not stable, but based on the newest Qt and newest Plasma) only thunderbird is restored, but no KF applications). Here (in Antergos and KaOS) only KF applications are restored.

I made also some test to be sure this is no GTK problem. This test was relying on hardcoding in ksmserverrc file properly lines that forced running thunderbird. Result. After login (because changes I made in text terminal) thunderbird has been run. Unfortunately after relogin thunderbird has not been run, because during closing of the session my entry disappeared from ksmserverrc file.

I read that for someone using openSUSE Leap it's working :/. This is strange.
Check this https://bugs.kde.org/show_bug.cgi?id=343518

Reproducible: Always

Steps to Reproduce:
1. Login to plasma 5.6.x
2. run konsole, kwrite, thunderbird, firefox or opera
3. logout from session
4. login again

Actual Results:  
After relogin restored are only konsole and kwrite

Expected Results:  
Should be run all applications working before logout, so in this case: konsole, kwritem thunderbird or opera

Tested on Antergos distribution (this is rolling) with all update on a day of writing this bug report.
 Qt 5.6.0, Plasma 5.6.3 and KDE Frameworks 5.21.0, kernel 4.5.1
Tested also on KaOS with recent updates with the same result.
Comment 1 Piotr Mierzwinski 2016-05-19 19:39:04 UTC
I made next test.
Being in System Settings I switched from "Restore previous session" to "Restore manually saved session" (in Plasma eng. version options might be call a bit different, I translated from polish).
After that in K menu in "Leave" tab I found option "Save session". I clicked it and checked ksmserverrc file - last modification date was changed. Unfortunately turned out that neither Thunderbird nor Opera is not saved. After that I run Firefox and repeated procedure. And again in ksmserverrc file there wasn't nothing about Firefox, Thunderbird and Opera :(. Nothing about any GTK application has been saved.
Comment 2 Wolfgang Bauer 2016-05-26 18:14:11 UTC
I tested with some GTK2/3 applications I have installed here (gnucash, gnome-terminal and gedit in particular), and indeed none of them are saved/restored in Plasma5, while they are in KDE4.

KDE4 saves them to the "LegacySession" section in ksmserverrc, so apparently they (or GTK) does not support XSMP, only the older XSM, which has been removed from ksmserver in 5.6 with this commit: https://quickgit.kde.org/?p=plasma-workspace.git&a=commit&h=5f0ca1305db4a925dbdbf927f541497be334feff
And indeed, reverting this fixes the problem and makes those applications being restored properly.

CC'ing Andreas Hardmetz, who made this change.

Ideally, the GTK developers should add XSMP support to their applications/toolkit though, as not even GNOME restores them (if you enable the hidden "auto-save-session in dconf-editor), while it does restore KDE applications.

No idea whether this might also be the reason for your problem with Firefox and Thunderbird, Firefox does get restored correctly here in openSUSE so it does seem to support XSMP.
Opera doesn't seem to support session management at all though, it isn't restored by KDE4 either.
Comment 3 Wolfgang Bauer 2016-05-28 22:10:12 UTC
(In reply to Wolfgang Bauer from comment #2)
> No idea whether this might also be the reason for your problem with Firefox
> and Thunderbird, Firefox does get restored correctly here in openSUSE so it
> does seem to support XSMP.

I just noticed that KDE4 actually stores Firefox in the "LegacySession" section as well.
So I tried again with Plasma 5.6.4, and indeed it doesn't restore Firefox in openSUSE either.
Sorry for my mixup...
(openSUSE Leap 42.1 comes with Plasma 5.5.4 where XSM support wasn't removed yet, so that's why it works there)

And reverting above-mentioned commit (i.e. restore XSM support) makes Firefox being restored as well.

I'm quite sure it's the same for Thunderbird too then.

Btw, http://quickgit.kde.org/?p=kwin.git&a=commitdiff&h=2eac7634cc524bf5e425cf081a639a6b6407e380 in kwin needs to be reverted too, so that the window geometries and which virtual desktop the windows were on (and other window attributes) are stored/restored as well.
Comment 4 Andreas Hartmetz 2016-06-23 17:43:18 UTC
Git commit e4a76cd947759fd723935965ca30c00021601a45 by Andreas Hartmetz.
Committed on 23/06/2016 at 17:36.
Pushed by ahartmetz into branch 'Plasma/5.6'.

Revert "Remove legacy session management support."

This reverts commit 5f0ca1305db4a925dbdbf927f541497be334feff.

Firefox and some GTK+ 2 applications still seem to use the old way.
For shame.

M  +1    -0    ksmserver/CMakeLists.txt
A  +419  -0    ksmserver/legacy.cpp     [License: UNKNOWN]  *
M  +1    -0    ksmserver/server.cpp
M  +26   -2    ksmserver/server.h
M  +11   -1    ksmserver/shutdown.cpp
M  +2    -0    ksmserver/startup.cpp

The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


http://commits.kde.org/plasma-workspace/e4a76cd947759fd723935965ca30c00021601a45
Comment 5 Andreas Hartmetz 2016-06-23 17:43:35 UTC
Git commit 59740e7416bb2b3a9852212fa4b213e5ba76deb7 by Andreas Hartmetz.
Committed on 23/06/2016 at 17:40.
Pushed by ahartmetz into branch 'Plasma/5.6'.

Revert "Remove saving and loading (and client matching by) WM_COMMAND."

This reverts commit 2eac7634cc524bf5e425cf081a639a6b6407e380.

M  +1    -1    activities.cpp
M  +17   -4    sm.cpp
M  +1    -0    sm.h
M  +13   -0    toplevel.cpp
M  +1    -0    toplevel.h

http://commits.kde.org/kwin/59740e7416bb2b3a9852212fa4b213e5ba76deb7
Comment 6 Andreas Hartmetz 2016-06-23 19:04:38 UTC
Git commit aee734e126b16db3be510a46ead9134c987fc97b by Andreas Hartmetz.
Committed on 23/06/2016 at 19:00.
Pushed by ahartmetz into branch 'Plasma/5.7'.

Revert "Remove legacy session management support."

This reverts commit 5f0ca1305db4a925dbdbf927f541497be334feff.

Firefox and some GTK+ 2 applications still seem to use the old way.
For shame.

Cherry-picked from 5.6.

M  +1    -0    ksmserver/CMakeLists.txt
A  +419  -0    ksmserver/legacy.cpp     [License: UNKNOWN]  *
M  +1    -0    ksmserver/server.cpp
M  +26   -2    ksmserver/server.h
M  +11   -1    ksmserver/shutdown.cpp
M  +2    -0    ksmserver/startup.cpp

The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


http://commits.kde.org/plasma-workspace/aee734e126b16db3be510a46ead9134c987fc97b
Comment 7 Andreas Hartmetz 2016-06-23 19:04:59 UTC
Git commit bdf555bbcb277566d5901de9902990024f680dfe by Andreas Hartmetz.
Committed on 23/06/2016 at 18:59.
Pushed by ahartmetz into branch 'Plasma/5.7'.

Revert "Remove saving and loading (and client matching by) WM_COMMAND."

This reverts commit 2eac7634cc524bf5e425cf081a639a6b6407e380.

Cherry-picked from 5.6.

M  +1    -1    activities.cpp
M  +17   -4    sm.cpp
M  +1    -0    sm.h
M  +13   -0    toplevel.cpp
M  +1    -0    toplevel.h

http://commits.kde.org/kwin/bdf555bbcb277566d5901de9902990024f680dfe
Comment 8 Andreas Hartmetz 2016-06-23 19:09:35 UTC
Git commit 2946faa9a4e1fa2eb85d67f0bb11bd3f62f331aa by Andreas Hartmetz.
Committed on 23/06/2016 at 19:06.
Pushed by ahartmetz into branch 'master'.

Revert "Remove legacy session management support."

This reverts commit 5f0ca1305db4a925dbdbf927f541497be334feff.

Firefox and some GTK+ 2 applications still seem to use the old way.
For shame.

Cherry-picked from 5.6.

M  +1    -0    ksmserver/CMakeLists.txt
A  +419  -0    ksmserver/legacy.cpp     [License: UNKNOWN]  *
M  +1    -0    ksmserver/server.cpp
M  +26   -2    ksmserver/server.h
M  +11   -1    ksmserver/shutdown.cpp
M  +2    -0    ksmserver/startup.cpp

The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


http://commits.kde.org/plasma-workspace/2946faa9a4e1fa2eb85d67f0bb11bd3f62f331aa
Comment 9 Andreas Hartmetz 2016-06-23 19:09:40 UTC
Git commit 03f0dc51d72ba0ad55fe077a519e1041c937ac6d by Andreas Hartmetz.
Committed on 23/06/2016 at 19:07.
Pushed by ahartmetz into branch 'master'.

Revert "Remove saving and loading (and client matching by) WM_COMMAND."

This reverts commit 2eac7634cc524bf5e425cf081a639a6b6407e380.

Cherry-picked from 5.6.

M  +1    -1    activities.cpp
M  +17   -4    sm.cpp
M  +1    -0    sm.h
M  +13   -0    toplevel.cpp
M  +1    -0    toplevel.h

http://commits.kde.org/kwin/03f0dc51d72ba0ad55fe077a519e1041c937ac6d
Comment 10 Oliver Henshaw 2016-12-05 17:02:00 UTC
For future reference: firefox 50 now supports xsmp again - support needed to be re-added after it moved to gtk3 - see https://bugzilla.mozilla.org/show_bug.cgi?id=694570 (and presumably equivalently new version of thunderbird will too); gtk2 applications need libgnome and libgnomeui installed to register with xsmp; I don't know what the status of opera or chrome is.
Comment 11 Piotr Mierzwinski 2016-12-05 20:11:18 UTC
About Opera.
Seems that recently stable Opera (41.0.2353.69) is still linked with gtk2 (checked on latest Antergos with updates on this day).
$ ldd /usr/lib/opera/opera | grep gtk
        libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0x00007fbe18982000)
$ ldd /usr/lib/opera/opera | grep gdk
        libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0x00007f11d0a7b000)
        libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0x00007f11d0186000)

I'm not sure if there is any bug (reported in Opera bugs tracker) related with lack of support xsmp.
Comment 12 Oliver Henshaw 2016-12-06 13:47:18 UTC
(In reply to Piotr Mierzwinski from comment #11)
> About Opera.
> Seems that recently stable Opera (41.0.2353.69) is still linked with gtk2
> (checked on latest Antergos with updates on this day).
> $ ldd /usr/lib/opera/opera | grep gtk
>         libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0
> (0x00007fbe18982000)
> $ ldd /usr/lib/opera/opera | grep gdk
>         libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0
> (0x00007f11d0a7b000)
>         libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0
> (0x00007f11d0186000)
> 
> I'm not sure if there is any bug (reported in Opera bugs tracker) related
> with lack of support xsmp.

Somehow, on my fist attempt to get opera, I managed to download opera 12 (the last presto version) from opera.com and that did support xsmp session restore:
# ldd /usr/lib64/opera/opera | egrep "ICE|SM"
        libSM.so.6 => /lib64/libSM.so.6 (0x00007f2d5cd57000)
        libICE.so.6 => /lib64/libICE.so.6 (0x00007f2d5cb3b000)

so it seems that support has been lost when it started using the blink engine.
Comment 13 Wolfgang Bauer 2016-12-06 19:13:20 UTC
(In reply to Oliver Henshaw from comment #10)
> gtk2 applications need
> libgnome and libgnomeui installed to register with xsmp;

Well, I do have libgnome and libgnomeui installed (and also did when I wrote comment#2). But I just tried again, and gnucash and gvim (GTK2 applications) are still stored in the "LegacySession" section, same as gedit and gnome-chess btw (which are GTK3 applications).

But I can confirm that Firefox 50 is now in the standard section indeed, thank you.

Opera 12 still used Qt(3) for its GUI which may explain why this version did support XSMP.
Comment 14 Oliver Henshaw 2016-12-06 23:17:16 UTC
Just a note that IIRC xsmp first came about in the early 1990s - so it probably predates gtk. But I think the legacy session management is just what you get if you don't take advantage of the libraries in your toolkit that support xsmp. I think the main difference with Qt is that you would have to make an effort to opt out to avoid xsmp and fall back to the "legacy session management".