Skip to content

Commit

Permalink
restore the last closed note on open
Browse files Browse the repository at this point in the history
  • Loading branch information
vixalien committed Mar 23, 2023
1 parent f62dd31 commit 3fff411
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,13 @@ export class Application extends Adw.Application {
window.add_controller(this.new_controller());

window.connect("close-request", () => {
note.open = false;
// if this is the last window, it means that the app will be closed
// immediately after, so keep this as "open" when the all notes window
// is open (so that it's restored when the app is opened again)
if (!(this.note_windows.length === 1 && !this.window)) {
note.open = false;
}

this.note_windows = this.note_windows.filter((win) => win !== window);
this.window?.set_note_visible(note!.uuid, false);
return false;
Expand Down

0 comments on commit 3fff411

Please sign in to comment.