Skip to content

Add Copy file path to Nautilus right-click context menu#5793

Open
pasmud wants to merge 122 commits into
basecamp:devfrom
pasmud:nautilus-copy-filepath
Open

Add Copy file path to Nautilus right-click context menu#5793
pasmud wants to merge 122 commits into
basecamp:devfrom
pasmud:nautilus-copy-filepath

Conversation

@pasmud
Copy link
Copy Markdown

@pasmud pasmud commented May 13, 2026

Summary

Adds a "Copy file path" / "Copy file paths" option to Nautilus' right-click context menu for files and directories.

  • Single file → shows "Copy file path"
  • Multiple selection → shows "Copy file paths" (newline-separated)
  • Copies absolute path(s) to clipboard via wl-copy

Changes

  • default/nautilus-python/extensions/copy-filepath.py — new nautilus-python extension
  • install/config/nautilus-python.sh — install script updated to copy the new extension

Testing

  • Right-click any file/folder → "Copy file path" appears
  • Select multiple → "Copy file paths" appears
  • Clicking copies the absolute path(s) to your clipboard
  • Works on both files and directories
  • Gracefully degrades if wl-copy is not installed

Copilot AI review requested due to automatic review settings May 13, 2026 02:20
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30bb098b1f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

mkdir -p "$EXTENSIONS_DIR"
cp "$OMARCHY_PATH/default/nautilus-python/extensions/localsend.py" "$EXTENSIONS_DIR/"
cp "$OMARCHY_PATH/default/nautilus-python/extensions/transcode.py" "$EXTENSIONS_DIR/"
cp "$OMARCHY_PATH/default/nautilus-python/extensions/copy-filepath.py" "$EXTENSIONS_DIR/"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add migration to deploy new Nautilus extension on updates

This commit only adds copy-filepath.py to the install-time copy script, but Omarchy updates apply user config changes through migrations (bin/omarchy-update-perform runs omarchy-migrate, and prior Nautilus extension additions were shipped via migrations such as migrations/1773017819.sh and migrations/1778099894.sh). Without a new migration sourcing install/config/nautilus-python.sh, existing installations that update will not receive the new context-menu action.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new nautilus-python extension that provides a “Copy file path(s)” context-menu action in Nautilus, copying absolute selected paths to the clipboard via wl-copy.

Changes:

  • Add a new Nautilus MenuProvider extension to copy selected file/directory paths to the clipboard.
  • Update the nautilus-python install/config script to install the new extension.
  • Update RetroArch install/remove scripts to replace libretro-vice-git with multiple libretro-vice-* packages (note: this is currently not reflected in the PR description).

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 1 comment.

File Description
install/config/nautilus-python.sh Installs the newly added Nautilus extension into the user extensions directory.
default/nautilus-python/extensions/copy-filepath.py Adds the “Copy file path(s)” Nautilus context-menu action and pipes selected absolute paths into wl-copy.
bin/omarchy-remove-gaming-retroarch Updates the RetroArch removal package list by expanding VICE core packages.
bin/omarchy-install-gaming-retroarch Updates the RetroArch install package list by expanding VICE core packages.
Comments suppressed due to low confidence (1)

default/nautilus-python/extensions/copy-filepath.py:54

  • Gio.Subprocess.new([...]) can raise GLib.Error (e.g., if wl-copy disappears from PATH, is not executable, or fails to spawn). Since the PR claims graceful degradation, it would be safer to resolve wl_copy = shutil.which("wl-copy") once and use that full path, and wrap subprocess creation/communication in try/except GLib.Error to avoid crashing the extension.
        proc = Gio.Subprocess.new(
            ["wl-copy", "--type", "text/plain"],
            Gio.SubprocessFlags.STDIN_PIPE
            | Gio.SubprocessFlags.STDOUT_SILENCE
            | Gio.SubprocessFlags.STDERR_SILENCE,
        )
        if proc:
            proc.communicate(GLib.Bytes.new(text.encode("utf-8")), cancellable=None)

    def get_file_items(self, *args):
        files = args[0] if len(args) == 1 else args[1]
        paths = self._selected_paths(files)

        if not paths or not shutil.which("wl-copy"):
            return []

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread default/nautilus-python/extensions/copy-filepath.py
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.

6 participants