Skip to content

Conversation

jeremypw
Copy link
Collaborator

@jeremypw jeremypw commented Jun 30, 2025

Fixes #721

When a second or subsequent window is closed its documents are just closed after saving if required.

Closing a second or subsequent window (with <Alt>F4 or otherwise) only closes the focused window.

<Ctrl>Q closes all windows. Only the docs in the last closed window will be restored.

NOTE: Restarting or closing down the system still causes unsaved data to be lost as in 'master'.

Some names are changed to make clearer their function.

@jeremypw jeremypw added this to the 8.1 milestone Jun 30, 2025
@jeremypw jeremypw modified the milestones: 8.1, 8.2 Jul 18, 2025
@jeremypw jeremypw marked this pull request as ready for review August 9, 2025 16:41
@jeremypw jeremypw requested a review from a team August 9, 2025 16:41
@kaixoo12
Copy link

I don't think moving unsaved files from window A to window B is expected behaviour at all. I don't like this behaviour. Window B should:

A) Autosave all files from the window that are unsaved.

B) Ask to save them (I think this is discouraged by elementary guidelines, but it might make sense in this specific context where the user closes the window with unsaved files?)

@danirabbit
Copy link
Member

Yeah I agree I don't think this is the expected behavior. If I'm closing a window with tabs, I would expect those tabs to close. If I wanted to keep the tabs, I'd move them to the other window.

There seems to be a couple of issues in #721:

  • Ctrl + Q should quit the app entirely, not just close the last window. I believe Ctrl + W is the shortcut for closing just a window
  • We should probably throw a warning when trying to close a window with unsaved documents since it's unclear what to do and we need a decision about if the files should be saved or deleted

@jeremypw
Copy link
Collaborator Author

jeremypw commented Aug 12, 2025

@danirabbit @kaixoo12 Thanks for the input - I'll rework this PR accordingly. Note that with the suggested behaviour, the documents will be saved but not restored.

@jeremypw jeremypw marked this pull request as draft August 12, 2025 11:43
@jeremypw
Copy link
Collaborator Author

@danirabbit I think <Ctrl>W usually just closes the current tab (or <Ctrl><Shift>W for Terminal). <Alt>F4 closes the current window in Code and Files. You are right that <Ctrl>Q should close all windows - as it does in Files. Code needs to be fixed in this respect.

@jeremypw jeremypw changed the title Move docs into another window when another one closes Handle closing second or subsequent window Aug 13, 2025
@jeremypw jeremypw marked this pull request as ready for review August 13, 2025 17:41
@jeremypw
Copy link
Collaborator Author

Note: The PR currently restores the doc in the last closed window, not the first opened window. Please confirm whether this is the correct behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ctrl+Q closes second windows with loss of unsaved changes
3 participants