feat(filetree): reveal selected file in OS file manager#318
Open
jongio wants to merge 1 commit into
Open
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an
Mkeybinding 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:explorer /select,<path>open -R <path>FileManager1.ShowItemswhendbus-sendis present, otherwisexdg-openon the parent directoryPaths go through the existing
ValidateEditorPathguard, 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 whereexplorerreturns non-zero even on success.Keybinding is registered in the file tree
KeyBindings(), mirrored ininternal/keybindings/keybindings.json, anddocs/keybindings.mdwas regenerated from that source.Tests
StartDetachedFnand asserting the builtexec.CmdCloses #313