Bug 397463 - Session management (named sessions, save/load sessions, auto-session-restore, etc) like in Kate
Summary: Session management (named sessions, save/load sessions, auto-session-restore,...
Status: CONFIRMED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
: 341734 429015 433121 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-08-14 22:01 UTC by avlas
Modified: 2024-03-23 08:48 UTC (History)
19 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description avlas 2018-08-14 22:01:15 UTC
It's a pain when you have an okular session of many pdfs you want to continue working after a reboot. It would be great to have the same session functionality of Kate in Okular...

I know there is the possibility of saving the KDE session for next login, but see https://bugs.kde.org/show_bug.cgi?id=387490. 

Besides, one may not want to use the KDE session restore because issues elsewhere, or because one prefers to start clean (in general beyond okular).
Comment 1 Nate Graham 2018-08-21 19:58:11 UTC
Seems kind of like if we fix Bug 387490, you won't need Okular to have its own session manager, right?
Comment 2 avlas 2018-08-21 20:15:13 UTC
(In reply to Nate Graham from comment #1)

I would actually love to have okular sessions (regardless of Bug 387490) as they are a very nice way to organize pdf 'workflows'. I am a researcher, and for me okular sessions would be as important as kate sessions when I put the coding 'hat' on. And I bet this may be similar for other users.

> Seems kind of like if we fix Bug 387490, you won't need Okular to have its
> own session manager, right?

Said that, fixing Bug 387490, would be a nice starting point. However, my experience tells me (I may be wrong though) that these errors happen because okular tries to load a pdf file from an URL before the network is connected.

See also Bug 397638 that also refers to a bug that emerges because applications are restored to early, in this case before the appmenu kded module is set.

I think these two issues (Bug 387490 and Bug 397638) could be ideally fixed in ksmserver, although not I'm not sure about the technicalities or how difficult this could be.
Comment 3 Nate Graham 2018-08-21 20:18:52 UTC
Thanks for the info. I see your point, and I have a researcher friend who also uses Okular in this way and has told me he'd like this feature. Seems like it could be a nice addition.
Comment 4 avlas 2018-08-21 20:23:09 UTC
(In reply to Nate Graham from comment #3)
> Thanks for the info. I see your point, and I have a researcher friend who
> also uses Okular in this way and has told me he'd like this feature. Seems
> like it could be a nice addition.

Thank you!
Comment 5 Viktor 2018-11-02 21:56:44 UTC
Here's another researcher chiming in for such a feature!
Comment 6 Christoph Feck 2018-11-20 21:48:12 UTC
Duplicate of bug 364680?
Comment 7 Nate Graham 2018-11-20 21:57:07 UTC
Yep, looks like it!

*** This bug has been marked as a duplicate of bug 364680 ***
Comment 8 avlas 2018-11-20 22:05:12 UTC
(In reply to Nate Graham from comment #7)
> Yep, looks like it!
> 
> *** This bug has been marked as a duplicate of bug 364680 ***

I disagree. Bug 364680 is only about restoring last session. This bug has become about session management as in Kate. See comment below:

> I would actually love to have okular sessions (regardless of Bug 387490) as they are a very nice way to organize pdf 'workflows'. I am a researcher, and or me okular sessions would be as important as kate sessions when I put the coding 'hat' on. And I bet this may be similar for other users.

If this is closed as duplicate I will need to create a new one with the name: "okular session management", which is exactly the same title as this current one.
Comment 9 Nate Graham 2019-05-21 19:57:49 UTC
*** Bug 341734 has been marked as a duplicate of this bug. ***
Comment 10 Nate Graham 2019-05-21 19:57:59 UTC
*** Bug 407548 has been marked as a duplicate of this bug. ***
Comment 11 Nate Graham 2019-05-21 19:58:25 UTC
*** Bug 364680 has been marked as a duplicate of this bug. ***
Comment 12 Gabriel 2019-05-21 20:50:29 UTC
Researcher here. I use Okular outside of KDE so having its own session management would be ideal.
Comment 13 Nate Graham 2019-06-13 20:53:47 UTC
*** Bug 408588 has been marked as a duplicate of this bug. ***
Comment 14 ilkerk 2019-09-04 08:01:30 UTC
Hello,
Any development about this issue? I would also love to see this solved. 

Thank you & keep up the great work on KDE.
Comment 15 Pankaj Bhanu 2019-10-22 01:29:52 UTC
I read a lot of pdfs and like to annotate the documents I read. In linux, okular is the best app which provides these functionalities. The ability to restore sessions in Okular itself (not as part of KDE session restore) is the only missing feature which would make this app ideal for a lot of students and researchers.
Comment 16 Nate Graham 2019-11-01 21:19:12 UTC
Git commit 988be90c4853edb3b8b9e53aac4e3d258b2e9f95 by Nate Graham.
Committed on 01/11/2019 at 21:16.
Pushed by ngraham into branch 'session-restoration'.

Restore previously-open documents on launch by default
FIXED-IN: 1.9.0

M  +1    -0    conf/dlggeneral.cpp
M  +7    -0    conf/dlggeneralbase.ui
M  +3    -0    conf/okular_core.kcfg
M  +1    -1    shell/CMakeLists.txt
M  +15   -6    shell/main.cpp
M  +14   -0    shell/shell.cpp

https://invent.kde.org/kde/okular/commit/988be90c4853edb3b8b9e53aac4e3d258b2e9f95
Comment 17 Nate Graham 2019-11-01 21:33:41 UTC
Nope not actually fixed yet, just submitted: https://invent.kde.org/kde/okular/merge_requests/58/diffs.
Comment 18 avlas 2019-11-01 22:28:41 UTC
Thank you Nathan for the great work!

This is very much wanted and needed. However, this seems to be a fix "only" for session restoration, but not for session management (as in Kate), which is what the issue ultimately is about, and all Okular users here are so excited about. Am I wrong?

Please don't get me wrong, I am very happy about your fix. But IMO, the session manager would really make a difference.
Comment 19 avlas 2019-11-01 22:35:12 UTC
> Please don't get me wrong, I am very happy about your fix. But IMO, the session manager would really make a difference.

In other words, your fix seems to me like "solving a bug" because session restoration should in principle be expected, whereas accounting for session management is not really fixing any bug (as it is not necessarily expected) but would be an extremely cool feature and a remarkable difference with respect to all other PDF viewers, with great benefit to all users that heavily go through PDF documents.
Comment 20 Nate Graham 2019-11-01 22:47:03 UTC
Ah I see what you mean.

I guess what I implemented is a precursor to it then. :)
Comment 21 avlas 2019-11-02 00:08:19 UTC
(In reply to Nate Graham from comment #20)
> Ah I see what you mean.
> 
> I guess what I implemented is a precursor to it then. :)

and very much appreciated!
Comment 22 ilkerk 2019-11-02 10:45:31 UTC
Thank you Nate, appreciate the good work. 
Looking forward to seeing it in Ubuntu repository.
Comment 23 Nate Graham 2019-11-20 14:26:27 UTC
Git commit 46e5b32ed9293749661eb5a5a8c32e77b1853f1e by Nate Graham.
Committed on 20/11/2019 at 14:26.
Pushed by ngraham into branch 'master'.

Also allow invoking session restoration logic when apps are manually launched

Summary:
Right now session restoration logic only ever gets invoked when apps are started
automatically after rebooting, because of the check for `qApp->isSessionRestored()`.
This limits the feature to only working for that use case, since `qApp->isSessionRestored()`
is set by Qt and we can't override it in the app itself to signal that we want the session
restoration behavior for other reasons. As a result, we can't use it to implement the
behavior of restoring the condition of app when it's manually launched, which has been
requested for several of our apps.

This patch removes the check for `qApp->isSessionRestored()`, which opens the door to
implementing the requested features in our apps.
Related: bug 413564

Test Plan:
D11382 now works

Normal session restoration behavior after a reboot is unchanged

Apps with session restoration behavior but without a user-facing option to invoke it
don't restore session at inappropriate times.

Reviewers: davidedmundson, #frameworks

Reviewed By: davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D25106

M  +0    -6    src/kmainwindow.cpp

https://commits.kde.org/kxmlgui/46e5b32ed9293749661eb5a5a8c32e77b1853f1e
Comment 24 Albert Astals Cid 2020-02-10 21:34:32 UTC
Git commit a5a8d82fb3a25670bc241d9b5f3f15e98ec7d475 by Albert Astals Cid, on behalf of Nate Graham.
Committed on 10/02/2020 at 21:32.
Pushed by aacid into branch 'session-restoration'.

Restore previously-open documents on launch by default
FIXED-IN: 1.9.0

M  +1    -0    conf/dlggeneral.cpp
M  +7    -0    conf/dlggeneralbase.ui
M  +3    -0    conf/okular_core.kcfg
M  +1    -1    shell/CMakeLists.txt
M  +15   -6    shell/main.cpp
M  +14   -0    shell/shell.cpp

https://invent.kde.org/kde/okular/commit/a5a8d82fb3a25670bc241d9b5f3f15e98ec7d475
Comment 25 Albert Astals Cid 2020-02-10 21:35:33 UTC
Yeah this is not in, i jsut made the same mistake Nate made
Comment 26 avlas 2020-05-09 20:14:53 UTC
I know session management is not in, but the okular session should be restored automatically in Okular since 19.12, right? 

I forgot about it until recently thinking it was supposed to land in 20.04. Unfortunately I can't get this to work, neither before in 19.12 nor now in 20.04.

I checked settings and didn't see anything to this respect. I wonder, are there config files or anything that I need to edit/delete to make this work?

Any guidance is highly appreciated!
Comment 27 Bug Janitor Service 2020-08-20 20:39:41 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/247
Comment 28 Laura David Hurka 2020-09-10 18:43:07 UTC
*** Bug 426380 has been marked as a duplicate of this bug. ***
Comment 29 Nate Graham 2020-11-13 05:07:29 UTC
*** Bug 429015 has been marked as a duplicate of this bug. ***
Comment 30 Luke Midworth 2021-05-21 04:28:55 UTC
Hi, just chiming in to say I am a student writing my thesis this year, and Okular (combined with Zotero and Zotfile) has been a lifesaver for reading and annotating sources. The only thing I miss from using other PDF software is the ability to save a current 'session' (set of open tabs/PDFs) and then be able to restore it after e.g. the reboot required when updating my laptop. I am currently using a very inelegant solution based around running `ls -l /proc/$(ps -C okular -o pid= | sed -e 's/\s//g')/fd | grep '.pdf'` while Okular is open and then re-opening the resulting file list after the reboot, but a true session management function would be much easier and extremely helpful in keeping my sources organised. Thanks for the great work on Okular, all!
Comment 31 Nate Graham 2021-09-30 15:17:00 UTC
*** Bug 433121 has been marked as a duplicate of this bug. ***
Comment 32 Bug Janitor Service 2022-03-06 18:29:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/581
Comment 33 Alex A.D. 2023-05-02 11:59:59 UTC
Any progress on this? I would like to  have this feature implemented? Thanks!
Comment 34 Alex A.D. 2023-05-23 07:53:57 UTC
I've created a similar bug for Dolphin, checkout BUG 470154