Skip to content

Add my-browser extension#27115

Open
ElFitaFlores wants to merge 2 commits intoraycast:mainfrom
ElFitaFlores:ext/my-browser
Open

Add my-browser extension#27115
ElFitaFlores wants to merge 2 commits intoraycast:mainfrom
ElFitaFlores:ext/my-browser

Conversation

@ElFitaFlores
Copy link
Copy Markdown
Contributor

@ElFitaFlores ElFitaFlores commented Apr 12, 2026

Description

Adding the My Browser extension - Commands and utilities that automatically adapt to your default browser, so you never have to reconfigure when you switch.

This extension centralizes Raycast configurations (e.g. hotkeys) based on the system's currently active default browser. It was born out of the frustration of having to unset and re-set a hotkey every time the default browser changed.

Screencast

Checklist

- Add screenshot image
- Fix linting
- Add command to set My Browser
- Update changelog, error handling and category
- Change icon
- Initial commit
@raycastbot raycastbot added new extension Label for PRs with new extensions platform: macOS labels Apr 12, 2026
@raycastbot
Copy link
Copy Markdown
Collaborator

Congratulations on your new Raycast extension! 🚀

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days.

Once the PR is approved and merged, the extension will be available on our Store.

@ElFitaFlores ElFitaFlores marked this pull request as ready for review April 12, 2026 16:48
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 12, 2026

Greptile Summary

This PR introduces the My Browser extension with two commands: open-my-browser (a no-view command that focuses/launches the system default browser) and set-my-browser (a list view that discovers registered browsers via a compiled Swift script and sets a new default). The extension is well-structured with correct Prettier config, ESLint setup, and dependency usage.

Confidence Score: 5/5

Safe to merge; all findings are P2 style/best-practice suggestions that do not block functionality.

No P0 or P1 issues found. The three comments are improvements: replacing execSync with Raycast's open() API, avoiding bundle ID interpolation into Swift source, and consolidating the changelog into a single initial-release entry. None affect correctness or user-facing reliability.

extensions/my-browser/src/set-my-browser.tsx and extensions/my-browser/src/open-my-browser.ts for the style suggestions.

Important Files Changed

Filename Overview
extensions/my-browser/src/open-my-browser.ts No-view command that opens the default browser via execSync('open -a ...') — should use Raycast's open() API instead.
extensions/my-browser/src/set-my-browser.tsx View command that discovers browsers via a compiled Swift script using deprecated CoreServices APIs; bundle ID is directly interpolated into Swift source which is a code-quality concern.
extensions/my-browser/package.json Standard extension manifest; category Applications is appropriate; all listed dependencies are imported in source files.
extensions/my-browser/CHANGELOG.md Two changelog entries both use {PR_MERGE_DATE} for what is an initial release PR — should be consolidated into a single initial-version entry.
extensions/my-browser/.prettierrc Correctly uses printWidth: 120 and singleQuote: false per the standard Raycast Prettier configuration.
extensions/my-browser/eslint.config.js Correctly imports defineConfig from eslint/config and spreads the Raycast ESLint config.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/my-browser/src/open-my-browser.ts
Line: 7

Comment:
**Prefer Raycast's `open()` API over `execSync`**

`execSync` blocks the entire Node.js event loop and bypasses Raycast's built-in mechanisms. Raycast's `open()` function (from `@raycast/api`) is the idiomatic replacement — it handles app launching/focusing without shell execution and is non-blocking.

```suggestion
    await open(browser.path);
```

You'll also need to add `open` to the import from `@raycast/api` and remove the `execSync` import.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/my-browser/src/set-my-browser.tsx
Line: 43-47

Comment:
**Bundle ID interpolated directly into executable Swift source**

`bundleId` is embedded verbatim into the Swift script with a template literal. While bundle IDs sourced from `getApplications()` are controlled by the local system, it's a risky pattern — a bundle ID containing `"` or a newline would corrupt the generated Swift source. Consider passing the value as a command-line argument instead:

```typescript
function setDefaultBrowser(bundleId: string): void {
  const tmpFile = join(tmpdir(), `raycast-my-browser-${Date.now()}.swift`);
  const script = `
import Foundation
import CoreServices
let id = CommandLine.arguments[1] as CFString
LSSetDefaultHandlerForURLScheme("https" as CFString, id)
LSSetDefaultHandlerForURLScheme("http" as CFString, id)
`;
  try {
    writeFileSync(tmpFile, script);
    execSync(`swift ${tmpFile} ${JSON.stringify(bundleId)}`, { timeout: 20000 });
  } finally {
    try { unlinkSync(tmpFile); } catch { /* ignore */ }
  }
}
```

This also avoids the fixed temp filename collision if `getHttpsHandlerBundleIds` and `setDefaultBrowser` were ever called concurrently.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/my-browser/CHANGELOG.md
Line: 3-11

Comment:
**Two entries share the same `{PR_MERGE_DATE}` placeholder in an initial release**

Both commands are shipped in the same PR, so they share the same merge date. Having a separate "update" entry (`[Set My Browser]`) above the initial entry (`[Initial Version]`) implies a version history that doesn't exist yet. The standard convention for a first PR is a single initial-release entry that lists all shipped features:

```suggestion
## [Initial Version] - {PR_MERGE_DATE}

### Added
- Open My Browser command: focus or launch your default browser with a single hotkey
- Set My Browser command: list all browsers registered on your Mac and set one as the system's default
```

**Rule Used:** What: Changelog entries must use `{PR_MERGE_DATE}`... ([source](https://app.greptile.com/review/custom-context?memory=c2214c11-df56-490a-b1c0-09a385df481a))

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "Add my-browser extension" | Re-trigger Greptile

Comment thread extensions/my-browser/src/open-my-browser.ts Outdated
Comment thread extensions/my-browser/src/set-my-browser.tsx Outdated
Comment thread extensions/my-browser/CHANGELOG.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new extension Label for PRs with new extensions platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants