Skip to content

fix: restore main library window when going to library from reader#3973

Merged
chrox merged 1 commit into
mainfrom
fix/library-button-recreate-main-3969
Apr 27, 2026
Merged

fix: restore main library window when going to library from reader#3973
chrox merged 1 commit into
mainfrom
fix/library-button-recreate-main-3969

Conversation

@chrox
Copy link
Copy Markdown
Collaborator

@chrox chrox commented Apr 27, 2026

Summary

  • Closes Library Button in the novel window is not working #3969 — on Windows/Linux desktop, clicking the Library button in a reader window after the main window had been closed only closed the reader, leaving no library visible.
  • Root cause: handleCloseBooksToLibrary in ReaderContent.tsx called currentWindow.close() without ensuring a library window existed. The Rust setup hides the main window on close only on macOS; on Windows/Linux it's destroyed.
  • Fix: add ensureMainLibraryWindow(appService) in src/utils/nav.ts. If a 'main'-labelled window exists, it's shown / unminimized / focused; if it was destroyed, a new window with the 'main' label is created at /library (mirroring createReaderWindow options) so the existing emitTo('main', 'close-reader-window', ...) wiring keeps working.
  • Capability: grant core:window:allow-show and core:window:allow-unminimize so the reader window can call these on the main window.

Test plan

  • pnpm test — 3280 passed (added 2 unit tests for ensureMainLibraryWindow)
  • pnpm lint — clean
  • Windows: open a book in a reader window, close the main library window, click the Library button in the reader header → main library window reopens, reader window closes.
  • Linux: same flow as above.
  • macOS: closing the main window hides it; clicking Library from a reader still re-shows it.

🤖 Generated with Claude Code

…loses #3969

When the main window has been destroyed (Windows/Linux default close), the
reader's "go to library" button only closed the reader, leaving no library
visible. Add ensureMainLibraryWindow() that shows an existing main window
or recreates one with the 'main' label so the existing close-reader-window
wiring keeps working. Also grant the cross-window show/unminimize permissions
the call now needs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@chrox chrox merged commit 6d79854 into main Apr 27, 2026
7 checks passed
@chrox chrox deleted the fix/library-button-recreate-main-3969 branch April 27, 2026 12:22
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.

Library Button in the novel window is not working

1 participant