browsera is a macOS menu bar application that allows users to quickly view and change their default web browser. It provides a simple interface to select from installed browsers and set one as the system default.
- Displays a list of installed web browsers in the menu bar
- Allows setting any listed browser as the system default with a single click
- Uses monochrome icons for a clean, consistent look
- Includes an About dialog with developer information
browsera is built using Swift and AppKit, with a SwiftUI wrapper for the app structure. Here's a high-level overview of its components and functionality:
-
App Structure: The app uses the
@NSApplicationDelegateAdaptorproperty wrapper to bridge SwiftUI with the traditional AppKit-based menu bar app structure. -
Menu Bar Integration: The app creates a status item in the menu bar using
NSStatusBar, displaying a monochrome browser icon. -
Browser Detection: On launch and each time the menu is opened, the app checks for installed browsers using a predefined list of bundle identifiers.
-
Menu Creation: For each detected browser, a menu item is created with the browser's name and a monochrome version of its icon.
-
Default Browser Setting: When a browser is selected from the menu, the app uses the
LSSetDefaultHandlerForURLSchemefunction to set it as the default for HTTP and HTTPS protocols. -
Monochrome Icons: The app converts all browser icons to monochrome using Core Image filters for a consistent appearance.
-
About Dialog: An "About" menu item opens a dialog with the developer's information and a clickable website link.
AppDelegate: Manages the app's lifecycle, creates the menu, and handles user interactions.convertToMonochrome(_:): A function that converts color images to monochrome using Core Image filters.setBrowserAsDefault(_:): Sets the selected browser as the system default.showAbout(): Displays the About dialog with developer information.
- Clone the repository
- Open the project in Xcode
- Build and run the application
Note: Ensure that your app's target settings include the "Application is agent (UIElement)" key set to "YES" in the Info.plist to make it a true menu bar app without a dock icon.
- macOS 11.0 or later
- Xcode 12.0 or later
Marat Galiev https://maratgaliev.com