Skip to content

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

BrowserSwitcher

A lightweight macOS menu bar utility to switch your default browser with a global keyboard shortcut.

macOS 14+ Swift 5.9 License: MIT

Features

  • Lives in the menu bar -- no Dock icon, no Cmd+Tab clutter
  • Global keyboard shortcut to open the browser picker from anywhere
  • Shows all installed browsers with their icons
  • Highlights the current default browser
  • Customizable shortcut via Settings
  • Built with SwiftUI and AppKit

Screenshot

BrowserSwitcher popup showing installed browsers

Installation

From source

git clone https://github.com/gabrielMalonso/BrowserSwitcher.git
cd BrowserSwitcher
./scripts/build-app.sh
open -R build/BrowserSwitcher.app

Quit any running copy, then drag build/BrowserSwitcher.app into Applications in Finder, choosing Replace if an older copy exists. Open the installed app. Replace the whole app bundle so obsolete files from older builds are not merged into the signed app.

The build script packages the executable, app icon, and all SwiftPM resource bundles, then signs and verifies the app locally. The installed app does not need the source checkout or .build directory to run.

Use the app bundle for installation: copying only the executable leaves its resource bundles behind and can make startup or Settings crash.

From Xcode

  1. Clone the repository
  2. Open Package.swift in Xcode
  3. Build and run (Cmd+R)

Usage

Action How
Open browser picker Cmd + Shift + Option + B (default)
Close picker ESC or click outside
Switch browser Click on the desired browser
Change shortcut Menu bar icon > Settings
Quit Menu bar icon > Quit

The default shortcut applies only until you choose another one in Settings. If the menu bar icon is hidden, use your saved shortcut or reopen BrowserSwitcher from Spotlight to access the picker and Settings.

Note: macOS shows a native confirmation dialog when changing the default browser. This is a system-level protection and cannot be bypassed.

Requirements

  • macOS 14 (Sonoma) or later
  • Xcode selected as the active developer directory when building from source
  • The app must run outside the sandbox (it cannot be distributed via the Mac App Store)

How it works

  • Uses NSWorkspace.urlsForApplications(toOpen:) to discover installed browsers by intersecting apps that handle both https: URLs and .html content types
  • Uses NSWorkspace.setDefaultApplication(at:toOpenURLsWithScheme:completion:) to change the default browser (setting http is enough -- macOS links http, https, and public.html together)
  • Uses KeyboardShortcuts by @sindresorhus for global hotkey registration without requiring Accessibility permissions
  • Uses a floating NSPanel for the picker popup

Contributing

Contributions are welcome! Please read CONTRIBUTING.md before submitting a pull request.

License

This project is licensed under the MIT License. See LICENSE for details.

About

A lightweight macOS menu bar utility to switch your default browser with a global keyboard shortcut

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages