Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

URLs displayed in clipboard history were not opening in the system's default browser when clicked.

Changes

Main Process (src/main/main.ts)

  • Added IPC handler open-external-url using shell.openExternal()

Preload Bridge (src/main/preload.ts)

  • Exposed openExternalURL method via contextBridge

Renderer (src/renderer/components/ClipboardItem.tsx)

  • Added click handler to intercept URL navigation and invoke IPC
  • Introduced trimmedText memoization to avoid redundant operations

Types (src/renderer/types.d.ts)

  • Extended ElectronAPI interface with openExternalURL method

Example

// Before: <a> with target="_blank" opens in Electron window
<a href={url} target="_blank">...</a>

// After: Click intercepted and routed through IPC
<a href={url} onClick={(e) => {
  e.preventDefault();
  window.electronAPI.openExternalURL(url);
}}>...</a>

The href attribute is retained for accessibility (keyboard navigation, hover preview, right-click context menu).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/electron/node-gyp/tarball/06b29aa
    • Triggering command: /home/REDACTED/.bun/bin/bun bun install (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>URLs should open in default browser when clicked</issue_title>
<issue_description>## Description
When clicking on a URL in the clipboard history, it should open in the user's default browser instead of opening within the Electron app window.

Current Behavior

URLs are displayed as clickable links, but clicking them may open within the Electron window or not work as expected.

Expected Behavior

Clicking a URL should open it in the user's default system browser (Safari, Chrome, Firefox, etc.)

Technical Details

Need to add shell.openExternal() handling for URL clicks in src/renderer/components/ClipboardItem.tsx

Affected Code

src/renderer/components/ClipboardItem.tsx lines 172-179

Priority

Medium - URLs are detected and displayed, but clicking behavior needs improvement</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits December 9, 2025 19:08
Co-authored-by: mberrishdev <84536014+mberrishdev@users.noreply.github.com>
Co-authored-by: mberrishdev <84536014+mberrishdev@users.noreply.github.com>
Co-authored-by: mberrishdev <84536014+mberrishdev@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix URLs to open in default browser when clicked Open URLs in system browser via shell.openExternal Dec 9, 2025
Copilot AI requested a review from mberrishdev December 9, 2025 19:15
@mberrishdev mberrishdev marked this pull request as ready for review December 9, 2025 19:23
@mberrishdev
Copy link
Owner

hmm, i tested it, it worked well :)

@mberrishdev mberrishdev merged commit 619dedc into master Dec 9, 2025
1 check passed
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.

URLs should open in default browser when clicked

2 participants