Bug 146769 - Reopen documents from previous session on start
Summary: Reopen documents from previous session on start
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
: 56132 150898 154962 157058 157899 158665 (view as bug list)
Depends on:
Blocks: Recent-Document-List AutoSave-AutoRecovery-Backup
  Show dependency treegraph
Reported: 2022-01-14 21:22 UTC by johndoetoe
Modified: 2024-05-09 12:07 UTC (History)
15 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description johndoetoe 2022-01-14 21:22:18 UTC
When I start LibreOffice, restore the last session: reopen all documents that were open when I quit.

Once the documents reopen on start, go on to restore the geometry of each window (size and position) as well as the position within the document.

Steps to Reproduce:
1.Quit LibreOffice
2.Open LibreOffice

Actual Results:
The previous session is not restored

Expected Results:
Desired results: when starting LibreOffice, all documents from the last session are restored. They are reopened with the same geometry (screen position, window size) in the same virtual workspace with the document scrolled to the same position, on the same tab, etc

Reproducible: Always

User Profile Reset: No

Additional Info:
cf Firefox, Chrome
Comment 1 V Stuart Foote 2022-01-15 00:09:22 UTC
Sounds like a recipe for ODF file corruption. Clean close when the last document has been closed, before that prompt to save or close w/o save any open documents.

Reopening previous document(s) from previous launch is of questionable utility.

Comment 2 Regina Henschel 2022-01-15 13:40:24 UTC
Recent documents are listed in the start center and in File > Recent documents. I'm against automatically open them.

The document starts already in the previous size and at the previous position. The only precondition is, that you have set user name.
Comment 3 Telesto 2022-01-15 13:46:18 UTC
Also -1 in the context given here.. 

The desire sounds more like some kind of session restore system. Restoring a session after shutdown did/does happen on macOS. I assume something similar being possible under Linux. No clue if there is some 'restore desktop' app for Windows.
Comment 4 johndoetoe 2022-01-15 16:14:14 UTC
Vis-a-vis comments about limited utility: between systems updates and such, my machine reboots has to reboot, generally, weekly. Re-opening what I was working on automatically is of immense value based on time-saved alone. The process to manually restore things --120-150 browser tabs, 6+ libreoffice docs, another 6-10 text documents, etc., etc-- takes an hour. Firefox and Chrome adding the option to restore last session saves an immense amount of time. 

Vis-a-vis those questioning doing it automatically, I can certain understand that concern. It would certainly be worth offering it as a configuration option.

The "Also -1 in the context given here..." is a bit bizarre. I'm not sure if that's the request as a feature enhancement (as opposed to a bug request?) or the idea that restoring the prior session at start up is the wrong time.
Comment 5 V Stuart Foote 2022-01-15 16:26:31 UTC
No bug involved, it is clearly an enhancement, and the -1 is for a use case that can not be justified (from development or maintenance or UX perspective).

Having that count of application frames enabled on launch is abusive of system resources.  Web browsers get away with-it bcz most sessions are static with minimal impact as system fires up. Trying to force other applications to do the same with documents and data connections is a recipe for instability and corruption.

Otherwise as noted, the MRU list is available from main menu or the StartCenter thumbnail views.

Out of scope for project, and IMHO a clear won't fix => WF.
Comment 6 johndoetoe 2022-01-15 16:44:23 UTC
Yes, Stuart, please stop describing my report as something it is not. It is NOT A BUG REPORT. I marked it "ENHANCEMENT" (under importance). It is still clearly marked "ENHANCEMENT".

Telesto: it sounds like a system restore because that's what it is on an application basis. Linux (at least the flavor of Ubuntu I run) does not currently offer such a feature. Individual apps have certainly rolled in some version of a restore. Browsers, Text Editors, Development environments all offer it. You point actually addresses Foote's obsession with abusing system resources and corruption. Mac's have offered system restore for years without problems with either.
Comment 7 Regina Henschel 2022-01-15 17:41:50 UTC
I think, that you can get such behavior using a macro. You can bind a macro to the event "Start application". A possible place for such macro could be the library 'Gimmicks' which if delivered with every installation. Or something for an extension?
Comment 8 johndoetoe 2022-01-15 18:17:47 UTC
Regina, thanks for the suggestion. My programming background doesn't include LibreOffice macros. From the online material, it doesn't look too complicated grammatically and I figured out where the events and such were. But, the API that's documented in help doesn't seem to have a mechanism for checking to see what docs are open. I didn't see an obvious reference to extensions or gimmicks. For someone who's already experienced in these thing it sounds like a  workable solution. 

Without that background, it would be far easier to craft a bash script that took ps waux | grep libreoffice and piped it through gawk/awk to update a file. Run that script with crond every five minutes-ish. Then add a startup script that would open those files in libre. 

But... I think all that's besides the point. The reason for a feature enhancement request is that this is a feature offered by a large number of applications (as well as OS X). Such feature consistancy across user applications is one of the basic application design principles that was introduced by the modern GUI.
Comment 9 Heiko Tietze 2022-01-17 10:34:14 UTC
Basically I agree with the request. It's annoying to always restore a session.

How about a function / button on the start center as a compromise that restores on click, alternatively to the extensions idea?

The restore function would run on exit / ctrl+Q before the close / ctrl+W or alt+F4 event is fired. What do you think, Samuel?
Comment 10 Samuel Mehrbrodt (allotropia) 2022-01-19 07:26:42 UTC
I think we definitely can improve in this area.

When the OS shuts down, we need to make sure all opened files are auto-saved (probably to the LO user profile) and then reopen all those files when LO is opened again. This somehow already works. When LO exits abnormally, it tries to restore the last auto-saved version of each document and suggests to restore the unsaved documents on the next start. This could be improved to integrate with the OS session management to do the auto-save before shutting down the OS (even before exiting LO), and just restoring all saved documents when opening LO again.
Of course this should be made configurable (as it is in Firefox e.g.). Users who always want to start with a clean session, should be able to do so. Manually restoring the last session (via menu or start center) should also be an option.
Comment 11 Heiko Tietze 2022-01-20 07:41:56 UTC
So we have different ideas for solution. To consider the hesitation in c1..3 I'd prefer a manual execution but developers may cover for eventualities.
Comment 12 Heiko Tietze 2022-01-20 07:42:43 UTC
*** Bug 56132 has been marked as a duplicate of this bug. ***
Comment 13 Heiko Tietze 2022-04-07 07:37:13 UTC
Duplicate of bug 141400 with the aspect of multiple documents.
Comment 14 V Stuart Foote 2022-09-11 03:40:04 UTC
*** Bug 150898 has been marked as a duplicate of this bug. ***
Comment 15 m_a_riosv 2023-04-23 01:08:17 UTC
*** Bug 154962 has been marked as a duplicate of this bug. ***
Comment 16 Justin L 2023-07-31 17:37:56 UTC Comment hidden (no-value, wrong)
Comment 17 Justin L 2023-08-15 17:11:08 UTC
A patch that re-purposes SID_LOGOUT to "Exit with session save" is at https://gerrit.libreoffice.org/c/core/+/155460. I'm not yet ready to propose it for submission though, since I took a lot of liberties.
Comment 18 Stéphane Guillou (stragu) 2023-09-02 21:26:24 UTC
*** Bug 157058 has been marked as a duplicate of this bug. ***
Comment 19 Stéphane Guillou (stragu) 2023-10-23 16:33:06 UTC
*** Bug 157899 has been marked as a duplicate of this bug. ***
Comment 20 Justin L 2023-12-05 14:03:09 UTC
(In reply to Justin L from comment #17)
> A patch that re-purposes SID_LOGOUT to "Exit with session save" is at
> https://gerrit.libreoffice.org/c/core/+/155460. 
Abandoned, as well as abandoning https://gerrit.libreoffice.org/c/core/+/155720
Comment 21 m_a_riosv 2023-12-12 21:08:40 UTC
*** Bug 158665 has been marked as a duplicate of this bug. ***