Skip to content

nadvotsky/browser-picker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

browser-picker

This repository is dedicated place for BrowserPicker, a browser launcher for Windows.

Screenshot

Screenshot

Description

BrowserPicker is a lightweight application that acts as an intermediary between URLs and preferred browsers. It allows to easily choose which browser to open a link with, eliminating the limitations of a single default browser.

Features

  • Highly configurable: Customize browser setups, hotkeys, default/alternative argument sets, and more in a simple JSON file.
  • Lightweight: Designed for quick startup and minimal resource usage.
  • Portable: No installation required, can be run directly from any directory.
  • Overhead absence: Does not require autostart nor stays as the background process after startup.

Motivation

A few years ago, only few browser launchers were worth mentioning:

However, they suffer from many limitations:

  • Oudated: Relic of the past Windows XP era.
  • Cumbersome: Unnecessarily complicated with configuration via the user interface, including the use of wildcards.
  • Limited browsers: Only support installed browsers.
  • Slow experience: Lack of hotkeys for immediate browser confirmation.
  • Inflexible: Use absolute paths with no option to export settings.
  • Background processes: Remain running in the background.

Initially, the idea was to stick with C# and WinForms to avoid delving into low-level languages or manual window drawing, while also aiming for the best possible startup time. This idea was reinforced by the fact that in the early .NET 5 era, there was an experimental lab project, NativeAOT-LLVM. Unfortunately, basic tests immediately revealed that Ahead-of-time (AOT) compilation is not going to help with the bottleneck, which is WinForms.

Nowadays, .NET has its own built-in NativeAOT and Self-containing publishing. Contrary to NativeAOT-LLVM, which cannot be used with newer .NET version, NativeAOT does not support WinForms at all due to Trimmed Deployments. Please refer to the issue #4649 for more information.

However, even without Native AOT, thanks to ReadyToRun Compilation and other enhancements in the CLR and .NET ecosystem, BrowserPicker startup time is quick enough.

It is also worth mentioning Browser Tray as a more powerful alternative.

Requirements

Optionally, use any of the methods below to change the default browser:

Usage

  • Set up the configuration file as stated in the Configuration.
  • Either:
    • Pass a URL as an argument (BrowserPicker.exe https://example.com).
    • Set it as your default browser and click on a link.
  • Press Esc to cancel opening the link.
  • Optionally, hold Shift or Alt to switch to alternative browser configurations.
  • Choose your desired browser from the popup window with mouse or assigned hotkeys.

Configuration

The configuration file must be named config.json and exist in the current working directory from which BrowserPicker is run.

It must be an array of Browser Objects, where each field documented here is mandatory. In addition to the JSON Specificaiton, a trailling comma is supported.

Please refer to the share/examples for a complete example. Included icons are released under Apache or Creative Commons licensing by Vectopus FZ-LLC and Pixel Bazaar and can be found at https://www.iconfinder.com and https://icon-icons.com.

Browser Object

Field Description
name Name of the browser setup.
bin [*] Path to the binary.
args An array of set of arguments.
args.def [*] A set of default arguments that be will prepended to the URL.
args.alt [*] A set of alternative arguments that be will prepended to the URL.
icon A path to the icon.
keys An array of hotkeys.

* - Supports Environmental Variables.

Example:

{
  "name": "Alex's Chromium",
  "bin": "%LOCALAPPDATA%\\Chromium\\Application\\chrome.exe",
  "args": {
    "def": [],
    "alt": [ "--incognito" ]
  },
  "icon": "icon.png",
  "keys": [ "x" ]
}

Bulding

BrowserPicker is a standard .NET project. Please refer to the official Deploying documentation for a comprehensive guidance.

The target framework version can be changed to any version that supports C# 10, which includes .NET 6 and higher. Visit the Framework targeting overview for detailed explanations.

Building a Single-file deployment is not recommended due to the large size of the resulting binary, mainly because it cannot utilize use [https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options](Trimmed Deployments).

Examples:

To build a framework-dependent executable for a specific platform:

dotnet publish -r win-x64 -c Release

To build a self-contained executable:

dotnet publish -r win-x64 -c Release --self-contained

License

This project is licensed under the MIT License. You are free to use, modify, and distribute this software, but please provide attribution.

About

A lightweight, stateless browser launcher/picker for Windows.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages