Add Copy Path context menu action to Nautilus#4929
Open
nt1998 wants to merge 4 commits intobasecamp:devfrom
Open
Add Copy Path context menu action to Nautilus#4929nt1998 wants to merge 4 commits intobasecamp:devfrom
nt1998 wants to merge 4 commits intobasecamp:devfrom
Conversation
Adds a nautilus-python extension that provides a "Copy Path" right-click menu item in Nautilus, copying the full file path(s) to clipboard via wl-copy. Both nautilus-python and wl-clipboard are already in base packages.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a "Copy Path" right-click context menu action to the Nautilus file manager. It introduces a nautilus-python extension that copies the full path(s) of selected files to the Wayland clipboard via wl-copy, and registers its installation into the existing config setup flow.
Changes:
config/nautilus/copy-path.py— Newnautilus-pythonMenuProvider extension implementing the Copy Path menu iteminstall/config/nautilus-copy-path.sh— New install script that deploys the extension to the appropriate directoryinstall/config/all.sh— Registers the new install script in the config installation sequence
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
config/nautilus/copy-path.py |
Core extension: registers the menu item and invokes wl-copy with the selected file path(s) |
install/config/nautilus-copy-path.sh |
Creates the extensions directory and copies the Python file into it |
install/config/all.sh |
Adds a run_logged call to execute the new install script during setup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
get_path() returns None for files that do not have a local filesystem path (e.g., files in the Trash, on remote shares, or accessed via virtual URIs). Calling "\n".join(...) on a generator that yields None will produce the literal string "None" in the clipboard, or could cause a TypeError depending on the Python version. You should filter out or handle None values before joining, e.g. by skipping files where get_path() returns None, or by using get_uri() as a fallback. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Using subprocess.Popen spawns the process without waiting for it to finish or checking its exit code. While wl-copy typically exits quickly, using subprocess.run instead is more appropriate here: it blocks until the command completes and raises an exception on failure, allowing errors (e.g., wl-copy not found or failing) to surface rather than being silently swallowed. With Popen, there is also a potential for a zombie process since the return code is never collected. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
wl-copynautilus-pythonandwl-clipboardare already inomarchy-base.packagesChanges
config/nautilus/copy-path.py— the nautilus-python MenuProvider extensioninstall/config/nautilus-copy-path.sh— installs the extension to~/.local/share/nautilus-python/extensions/install/config/all.sh— registers the install script