Skip to content

feat(filetree): reveal selected file in OS file manager#318

Open
jongio wants to merge 1 commit into
mainfrom
idea/reveal-in-file-manager
Open

feat(filetree): reveal selected file in OS file manager#318
jongio wants to merge 1 commit into
mainfrom
idea/reveal-in-file-manager

Conversation

@jongio

@jongio jongio commented Jul 12, 2026

Copy link
Copy Markdown
Owner

What

Adds an M keybinding in the file tree that reveals the item under the cursor in the OS file manager, highlighting it inside its parent directory. Works for both files and directories.

Why

Jumping from the tree to the real folder is a common need: dropping a file into another app, checking siblings that grut does not show, or attaching something to a message. Today that means leaving grut and navigating there by hand.

How

Platform launchers live in internal/panels/open.go:

  • Windows: explorer /select,<path>
  • macOS: open -R <path>
  • Linux: freedesktop D-Bus FileManager1.ShowItems when dbus-send is present, otherwise xdg-open on the parent directory

Paths go through the existing ValidateEditorPath guard, so shell metacharacters and null bytes are rejected before any launcher runs. The command is started detached and its exit status is ignored, which matters on Windows where explorer returns non-zero even on success.

Keybinding is registered in the file tree KeyBindings(), mirrored in internal/keybindings/keybindings.json, and docs/keybindings.md was regenerated from that source.

Tests

  • Rejection paths (empty, null byte, shell metacharacters)
  • Per-platform command construction, verified by stubbing StartDetachedFn and asserting the built exec.Cmd

Closes #313

Add an M keybinding in the file tree that opens the OS file manager with
the item under the cursor highlighted inside its parent directory. Works
for both files and directories.

Platform launchers live in internal/panels/open.go:
- Windows: explorer /select,<path>
- macOS: open -R <path>
- Linux: freedesktop D-Bus FileManager1.ShowItems when dbus-send is
  present, otherwise xdg-open on the parent directory

Paths pass through ValidateEditorPath, so shell metacharacters and null
bytes are rejected before any launcher runs.

Closes #313

Co-authored-by: Copilot App <[email protected]>
@jongio jongio added the idea Feature idea from the idea pipeline label Jul 12, 2026
@jongio jongio self-assigned this Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reveal the selected file in the OS file manager

1 participant