Repository navigation
Discovery
Role. Find every browser installed on the machine, with its engine family, protocol and version, without launching any. It is the first thing a job does, and omnisnap browsers prints its result. Module discovery, package internal/discovery.
-
In: the machine: its file system, environment, and on Windows the registry. Everything is reached through
Options: a file system,Getenv, a registry query, a file-version reader, a Spotlight query and a Safari-enabled check. Tests replace each one with fixtures. The default file system isos.DirFS("/"), except on Windows: there every absolute path starts with a drive letter, whichos.DirFSrefuses, so the default isdriveFS, which readsC:/...names from that drive. Without it the PATH and install-cache sources found nothing on a real Windows machine (fixed inv0.2.0; the fixtures had hidden it). -
Out: a sorted list of
Browser:id(chrome,firefox-esr,webkitgtk,wpe,safari…), name, family, protocol (cdp,bidi,classic), executable, WebDriver binary for Classic, version (""when no file says), source, and notes the caller must respect.
Find runs the platform's sources in order, best first. Each source returns what it can and never fails the whole discovery. When two sources find the same id, the first wins.
| OS | Sources, in order |
|---|---|
| Linux |
.desktop files, PATH, Snap, Flatpak, WebKitGTK (MiniBrowser and WebKitWebDriver at the known paths for 6.0 and 4.1), WPE, the install cache |
| Windows |
the registry (App Paths for the executable, Uninstall for the version and Opera GX's name; HKLM, WOW6432Node and HKCU), PATH, the install cache |
| macOS |
app bundles in ~/Applications and /Applications (Info.plist), Spotlight (mdfind by bundle id), Safari, the install cache |
The catalog (catalog.go) lists what discovery recognizes and every name each browser goes by: Chrome, Chrome Beta, Chromium, Brave, Edge, Opera, Vivaldi (Blink, CDP); Firefox and Firefox ESR (Gecko, BiDi); WebKitGTK and WPE (WebKit, Classic); Safari on macOS.
The install cache source (cache.go) finds the Firefox builds omnisnap install firefox put in the user cache (source omnisnap-cache). It duplicates install's two path rules instead of importing install, which itself depends on discovery. On Windows it accepts the firefox.exe it finds without an execute bit, as the registry and PATH sources do: Go reports every Windows file as 0666 or 0444.
--version of a snap or flatpak takes seconds, and chrome.exe --version prints nothing on Windows, so versions come from files, cheapest first (version.go):
- a snap's
meta/snap.yaml; - for Gecko,
application.ininext to the executable; - the dpkg or pacman database, for the catalog's package names.
On Windows, the executable's VERSIONINFO resource; on macOS, CFBundleShortVersionString in Info.plist. When nothing says, the version is "" and a note explains why (rpm is not read).
-
Snap: private
/tmp, so profiles must be created where the snap can read them. Process management puts Snap Firefox's profile under~/snap/firefox/common/. - Flatpak: sandboxed file system, same consequence.
- WebKitGTK: needs a display; process management provides a private headless one.
-
Safari:
safaridriverneeds a one-timesafaridriver --enable(admin). Discovery reports the driver's path and never runs it: the only flag that would ask,--diagnose, starts the driver and never exits, which hung discovery on 2026-11-19. A driver that is not enabled is reported at launch time.
When both WebKitGTK and WPE are installed, OMNISNAP_WEBKIT=wpe keeps only WPE and OMNISNAP_WEBKIT=gtk only WebKitGTK; unset lists both (discovery.go).
A source that cannot read something returns fewer browsers, not an error. An executable that is not executable is ignored. Find fails only when its context is cancelled.
- Per-OS tests on fixtures:
linux_test.go(desktop files and dpkg,PATHand pacman, Snap, Flatpak, WebKitGTK, de-duplication, unknown versions),windows_test.goon recordedreg querydumps intestdata/discovery/windows(the registry pitfalls: Chromium's hashed key, Opera GX, IEXPLORE),darwin_test.goonInfo.plistfixtures. -
TestDiscoveryNeverLaunchesBrowsersandTestDarwinDefaultsNeverRunSafaridriver: nothing is started. -
TestDiscoveryTiming: median of 10 runs under 300 ms on Linux and Windows, under 1 s on macOS, on the CI runners. -
TestExpectedBrowserschecks, on each CI runner, that the browsers the runner image is known to have are found.
-
Windows sources. The spec lists
StartMenuInternet\*\shell\open\commandkeys and well-known install folders. The code readsApp PathsandUninstall(in HKLM, WOW6432Node and HKCU) andPATH, and no install folders.
-
internal/discovery/discovery.go:Find, the types and the sources it runs -
internal/discovery/catalog.go: the known browsers and every name they go by -
internal/discovery/version.go: version reading per install kind -
internal/discovery/cache.go: browsers installed byomnisnap install -
internal/discovery/linux.go: Linux sources: PATH and desktop files -
internal/discovery/darwin.go: macOS sources: app bundles and Spotlight -
internal/discovery/windows.go: Windows sources: the registry and PATH -
internal/discovery/winversion_windows.go:reg queryand file versions on Windows -
internal/discovery/plist.go: the Info.plist reader, binary and XML -
internal/discovery/plist_xml.go: the XML plist decoder -
internal/discovery/platform_linux.go: the Linux source list -
internal/discovery/platform_darwin.go: the macOS source list -
internal/discovery/platform_windows.go: the Windows source list -
internal/discovery/drivefs_windows.go: the default file system on Windows, which reads drive-letter paths -
internal/discovery/platform_other.go: other systems: no sources -
internal/discovery/timing_browsers_test_os.go: a helper for thebrowsers-tagged timing test
This wiki is published from docs/internals/ on main. Edits made here are overwritten on the next publish: change the pages there, in a pull request. The specs are normative; where a page and a spec disagree, the page says what the code does.
Start
Contracts
Capture side
Analysis side
Output
Quality