Forum moved here!

Home / “Remember opened files” not working with Alt-F4 or hitting close button to exit

min

Hullo! :woman_facepalming:

I’m running the 64-bit version of SumatraPDF as a non-administrator on a Windows 10 (v10.0.17763) laptop and can reproduce 100% the following problem:

The “Remember opened files” option always works when exiting the program via the menu (using mouse or Alt-F → X), and never works when exiting the program using the Alt-F4 hotkey or clicking the top-right X close button.

I can kludge it with an AutoHotkey script, but it seems nobody else is experiencing this? :neutral_face: Thanks for the brilliant work on such a lightweight and powerful mobile reader!

GitHubRulesOK

Alt+F & X and Alt F4 are not listed SumatraPDF command however I confirm in both cases the window is closed by Windows System the same as hitting the top right X or using Alt+F & Q

However, contrary to your experience on 10x64 my tabs DO restore on opening a file so it may be a key mapping function difference between our systems.

Have you checked that in Options > Remember opened files is still active ?
Also note that if only one tab is active SumatraPDF will not open that tab next time (that is a design feature) there must be at least 2 tabs active on closure for SumatraPDF to reopen tabS next time

min

Hi GHROK, thanks for the speedy reply.

I use UltraEdit/-Compare to deal with text, which keeps track of file data and modification times on the fly. The “…\AppData\Roaming\SumatraPDF\SumatraPDF-settings.txt” file is recreated but unaltered when exiting SumatraPDF using the menu via mouse, Alt-F → X, or the default Ctrl-Q hotkey. If SumatraPDF is exited using Alt-F4 or clicking the top-right X close button, the settings file is not recreated.

The RememberOpenedFiles property holds a “true” value at all times, as does the RestoreSession property (dunno if that’s involved). I rebooted and shut down my AutoHotkey scripts/everything else that might interfere with the exit/startup process, but the behaviour persists.

Uninstalling and renaming the “…\AppData\Roaming\SumatraPDF” directory to “…\AppData\Roaming\SumatraPDF_OLD”, I compared the settings files of the old and new installs. RememberOpenedFiles and RestoreSession’s value is “true” in both. Other than the FileStates section, the only differences were the values of the DefaultDisplayMode, DefaultZoom, WindowState, WindowPos, and SidebarDx properties—just cosmetics, I think?

The settings file not being recreated when exiting via Alt-F4/close button might have something to do with it, but since the seemingly relevant properties’ value remains “true”, I can’t think of how. To rule out SumatraPDF somehow ignoring the settings file if it was last exited using Alt-F4/close button, I changed the main background colour to black. Using Alt-F4 to exit the program, it indeed now always restarts with the black background—but still not with my previously loaded tab!?

This thread may indicate the same issue, i.e. the user possibly exiting SumatraPDF in different ways without realising it?

I’ll use AutoHotkey to remap Alt-F4 and the close button to Ctrl-Q if SumatraPDF is the active application for now.


LATER: The plot thickens… if two or more tabs are open at the time of exiting SumatraPDF, they’re reloaded successfully when restarting it regardless of the exit method. The settings file still isn’t recreated when exiting via Alt-F4/close button, so that’s not linked to the problem, but it’s comforting. (i.e. no file’s ghost haunting the user if they exit the program in a way which reminds it of its gruesome and untimely death. :wink:)

EDIT: The user in the thread above possibly had 1 tab open when exiting sometimes, but 2 or more when exiting at other times?

tl;dr: If the user has A) only one tab open and B) closes SumatraPDF using the Alt-F4 keyboard shortcut or clicking the top-right X close button, this tab will not be reloaded when restarting the program.

kjk

Sumatra only re-opens the files if at close time there were 2 or more files opened.

This is confusing, I admit. The idea was that since sumatra opens with a “home” page that lists recently opened files, the last file is at the top so it’s just 1 click away.

It doesn’t matter how sumatra is closed.

min

Thanks for the insight, but SumatraPDF will reload a single-tab state if it’s exited using the menu in any way (mouse, Alt-F → X, or Ctrl-Q). I can record a video of it if you like.