Skip to content

Add a Reveal in Finder button to the file viewer toolbar - #105

Open
vivi7 wants to merge 1 commit into
doctly:mainfrom
vivi7:feat/viewer-reveal-in-finder
Open

vivi7 wants to merge 1 commit into
doctly:mainfrom
vivi7:feat/viewer-reveal-in-finder

Conversation

@vivi7

@vivi7 vivi7 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a Reveal in Finder button to the viewer toolbar, just before Close. It shows the open file selected in its folder, in Finder on macOS, Explorer on Windows and the file manager on Linux.

Why

When a session points at a file, it opens in the panel beside the terminal. From there, the only way to reach that file in Finder (to attach it somewhere, move it, open it in another app) is to copy the path and navigate to it by hand. That is slowest exactly for the files that live outside the project, such as plans in ~/.claude/plans or memory files, which the Files tab cannot reach. The project file browser already has Reveal in Finder in its context menu; this brings the same action to the open file.

What it does

  • A folder icon button in the viewer toolbar, placed right before the close button. Its tooltip and aria-label name the platform's file manager (Reveal in Finder / Explorer / File Manager), the same wording as the file browser's context menu.
  • It appears in every ViewerPanel: the file panel beside a session, and the plan and memory viewers. It works for text, markdown, JSON, HTML and the image/PDF/PowerPoint previews alike.
  • It is hidden when the viewer has no file open, and a click after the panel is cleared does nothing.
  • Clicking it selects the file in a file manager window. It never opens or runs the file.

Implementation notes

  • file-management.js: new revealFile(filePath, { shell }), next to manageProjectEntry. It takes an absolute path, because these viewers open files outside any attached project, so the project-relative manage-project-entry channel cannot serve them. It rejects non-strings, relative paths and missing files, and only calls shell.showItemInFolder.
  • main.js: new reveal-file IPC handler returning { ok, filePath } or { ok: false, error }.
  • preload.js: window.api.revealFile(filePath).
  • public/viewer-toolbar.js: reveal option, revealBtn in the toolbar API, and a FOLDER_ICON with the same path as PICONS.folder.
  • public/viewer-panel.js: turns the button on, shows/hides it in open(), and reveals this.filePath on click.
  • No CSS changes: the button uses the existing fp-toolbar-btn fp-icon-btn classes.

Testing

  • test/file-management.test.js: revealFile reveals an existing file outside any project, normalizes .. segments, and rejects relative paths, missing files and non-string input without touching the shell.
  • test/viewer-panel.test.js: the button reveals the currently open file, including a media preview, does nothing once the panel is destroyed, and is hidden with no file.
  • New test/viewer-toolbar.test.js: loads the real viewer-toolbar.js in a vm context and checks the button sits right before Close, its per-platform label, and that it is absent unless requested.
  • npm test: 444 of 446 pass. The two failures (incremental columns upgrade a version-4/12 database… in db-schema-reconcile.test.js) fail the same way on current main on my machine and are unrelated.
  • Manual check on macOS in the running app (electron . with an isolated SWITCHBOARD_DATA_DIR): opened a markdown file outside the project in the file panel. The toolbar showed Preview, Wrap, Go to line, Save, Reveal in Finder, Close. Clicking it went through reveal-file to shell.showItemInFolder for that file, and the IPC returned ok for a real file and an error for a missing file and for a relative path.

The viewer panels (the file panel beside a session, plans and memory) get a
folder button just before Close that shows the open file selected in
Finder, Explorer or the file manager. A new reveal-file IPC takes an
absolute path, since these panels open files outside any project, and
only calls shell.showItemInFolder on a file that exists.
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.

1 participant