Skip to content

Stuzanna/browsar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Browsar

A macOS menu bar utility for quickly switching the system default browser.

After spending too long looking for a replacement to Objektiv, I decided it would be quicker (and more fun) to vibe code my own.

Browsar sits in your menu bar and lets you change which browser handles links.

Browsar browser list

Requirements

  • macOS 13 (Ventura) or later
  • Swift 5.9+

Install

git clone https://github.com/Stuzanna/browsar.git
cd browsar
make install

This builds the app, ad-hoc signs it, copies it to /Applications, registers it with Launch Services, and opens it. Browsar will launch automatically on login.

Uninstall

make uninstall

Usage

  1. Click the network icon in the menu bar
  2. See all installed browsers with a checkmark next to the current default
  3. Click a browser to make it the new system default
  4. Any links opened system-wide now go to your chosen browser

When Browsar is registered as a URL handler, it forwards incoming URLs to whichever browser you've selected.

Development

make build    # build to build/Browsar.app
make run      # build and launch from build directory
make clean    # remove build artifacts

Custom App Icon

Optionally, place a 1024x1024 PNG at Resources/AppIcon.png. The build will generate all required sizes and bundle the icon automatically.

Architecture

Built with Swift Package Manager and SwiftUI MenuBarExtra (no Xcode project required).

Sources/Browsar/
├── BrowsarApp.swift       # @main, MenuBarExtra scene, login item registration
├── AppDelegate.swift      # Apple Event handler for URL forwarding
├── Browser.swift          # Browser data model
└── BrowserManager.swift   # Detection, default get/set, URL forwarding
  • Browser detectionLSCopyApplicationURLsForURL discovers all apps that handle https:// URLs
  • Default managementLSSetDefaultHandlerForURLScheme sets the default for both http and https
  • URL forwarding — Apple Event handler receives URLs and opens them with NSWorkspace in the selected browser
  • Login itemSMAppService registers Browsar to launch at login
  • Menu bar onlyLSUIElement = true keeps the app out of the Dock

Notes

  • LSSetDefaultHandlerForURLScheme is deprecated but remains the only practical API for this task. Apple has not provided a replacement that works without user interaction.
  • Switching the default browser may trigger a one-time macOS confirmation dialog. This is OS-level behavior and cannot be bypassed.
  • The app filters itself out of the browser list using bundle ID com.browsar.app.

About

Default browser switcher.

Resources

License

Stars

Watchers

Forks

Contributors