Skip to content

Restore workspace and open tabs between sessions #244

Description

@ZFordDev

Description

Add an opt-in session restoration setting that reopens the user's last workspace and saved-file tabs when SnapDock starts.

This replaces the earlier autosave proposal. SnapDock should restore navigation state only and always reload file content from disk.

Expected Behavior

When session restoration is enabled, SnapDock should remember:

  • The last open workspace/folder
  • The ordered list of open saved-file tabs
  • The active saved-file tab

On the next launch, SnapDock should:

  1. Reopen the saved workspace
  2. Reopen each saved-file tab in its previous order
  3. Restore the previously active tab
  4. Load the current content of every file from disk
  5. Skip missing, moved, or inaccessible files without blocking startup

Settings

  • Add an opt-in toggle in the Tools menu
  • Persist the enabled/disabled preference
  • Disabling the feature should clear stored session metadata
  • Close Project should clear the stored session

Out of Scope

This feature must not persist or restore:

  • Unsaved or dirty editor content
  • Untitled tabs
  • Undo/redo history
  • Cursor selections or scroll positions
  • Automatic writes to files on disk
  • Crash-recovery snapshots

Users remain responsible for saving document changes normally.

Suggested Session Data

Store metadata only, scoped to the restored workspace:

{
  "workspacePath": "...",
  "openFiles": ["...", "..."],
  "activeFile": "..."
}

Do not store document contents in localStorage.

Acceptance Criteria

  • Session restoration is disabled by default and can be enabled from Tools
  • The preference persists across app restarts
  • The last workspace is restored when enabled
  • Saved-file tabs reopen in their previous order
  • The active saved-file tab is restored
  • Files are reloaded from disk rather than localStorage
  • Untitled and dirty content is not persisted
  • Missing or inaccessible files are skipped safely
  • Disabling the option clears stored session metadata
  • Close Project clears stored session metadata
  • Automated tests cover restoration, workspace isolation, missing files, disabling, and project closure

Contributor Notes

The existing commented src/modules/file/autosave.js implementation is not suitable for this feature because it stores a single editor value. The implementation should integrate with the current workspace and tab models instead.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions