Skip to content

[Feature Request] Open a transcript file reference with the system's default application #1344

Done

Description

@zxbdzh

What problem does this solve

Right-clicking a file reference in the transcript — a file:// badge in a user message, or a linked path in an assistant reply — offers "Open in Explorer/Finder", "Copy relative path", "Copy absolute path" and, for a remote workspace, "Download file". There is no way to open the file itself with the application the OS has registered for it (a PDF viewer, an image viewer, the system editor), so the only route is to reveal it in the file manager and double-click it there.

Proposed behaviour

In a local desktop window, add an "Open with default app" row above the existing file manager row.

  • A left click on the badge is unchanged: it still opens the file in the workspace panel.
  • The row resolves its path the same way the file manager row does, so file:// URIs, line suffixes (#L10-25, :12) and ~-rooted paths all name the same file for both rows.
  • Web and remote-workspace windows keep the row hidden: those paths belong to another machine, where the download row is the only meaningful one.
  • A failure (no application registered for the type, file removed since) reports a toast instead of doing nothing.

Notes

This is deliberately not done by widening opener:allow-open-path: it is scoped to $HOME/**, and raising it to ** would let any renderer path launch any existing file with an arbitrary with program. A small purpose-built backend command keeps the errand to one validated local path.

Activity

  1. xintaofei commented on Nov 28, 2026

    @xintaofei
    Collaborator

    Verdict: the request holds. The transcript file-reference menu only offers reveal, copy relative/absolute and download (src/components/message/file-reference-actions.tsx). The webview's existing openPath goes through opener:allow-open-path, which is limited to $HOME/** and also refuses dot-directories (src-tauri/capabilities/default.json:42). So there was no way to open a referenced file with its registered application, and the issue is right that widening the scope is the wrong fix.

    Change

    • New row: "Open with default app" sits above the file-manager row, in local desktop windows only. Web and remote-workspace windows keep it hidden. It resolves the path exactly like the reveal row, so file://, #L10-25 / :12 and ~/ name the same file (src/components/message/file-reference-actions.tsx:124, :186). Left click on the badge is unchanged. A failure shows a toast with the reason.
    • New desktop-only command open_with_default_app (src-tauri/src/commands/open_in.rs:67): accepts one absolute path to an existing regular file and no with program (:232). The opener scope is untouched.
      • Windows: ShellExecuteEx, through the opener plugin.
      • macOS: open. Linux: xdg-open, falling back to gio open when xdg-open is missing (:93).
    • Why codeg runs the launcher itself on macOS/Linux: the plugin spawns it detached and drops its exit status, so an unassociated type would silently do nothing. Its xdg-open would also inherit an AppImage's bundled environment. Failures are now reported, and the host environment is restored (:170).
    • Translations added for all 10 locales.

    Verification

    • Unit tests for the menu row (position, path resolution, ~ expansion, toast, hidden in web/remote) and for the backend (path checks, launcher failure with stderr, xdg-open exit codes, a still-running launcher).
    • Frontend lint, type check and full Vitest suite pass.
    • Desktop and server clippy (-D warnings) pass, as does the full desktop cargo test.
    • Not yet done: the Windows and Linux branches were reviewed but not compiled on those platforms, and the row hasn't been tried in the running app.

    The work was merged locally into main as 917db9d and has not been pushed yet (15 files, +438/-9).


    🤖 Generated with Codeg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions