Repository navigation
fix(desktop): open the dashboard in the Windows default browser - #109
crazy-daddy wants to merge 3 commits into
Conversation
On Windows the launcher probed a fixed list (Chrome, then Edge, then Brave) for app mode and never looked at the user's default browser, so Edge opened even when another browser was the default. Read the default http handler from the registry instead. If it is Chromium-based (detected by the *_elf.dll every Chromium build ships), open it in app mode; otherwise return None so open_window falls back to webbrowser.open, a plain tab in the default browser.
JayantDevkar
left a comment
There was a problem hiding this comment.
Inline context for reviewers, one note per change area.
|
Agreed the hard-coded Edge/Chrome/Brave list is wrong, and the The part I'd like changed is the registry walk. Reading only Simplest fix I can see: ask Windows for the handler with I'll approve the CI run so the Windows job executes your tests. |
…omium list as fallback
|
Thanks for the detailed review, learned something new again. I went with AssocQueryStringW plus the old list as a fallback, as you suggested; details are on the threads. |
Summary
On Windows, the desktop launcher opens the dashboard in Edge (or Chrome/Brave, whichever it finds first) even when the user's default browser is something else. This PR makes it respect the Windows default browser.
Changes
_chrome_command()on Windows now asks the shell for the defaulthttphandler viaAssocQueryStringW(ASSOCF_IS_PROTOCOL, ASSOCSTR_EXECUTABLE, "http", "open")(ctypes). This resolvesUserChoice, the HKCR fallback, quoting and%ProgramFiles%-style paths the way Explorer does, instead of probing a fixed Chrome/Edge/Brave list.--app=window. Detection: every Chromium build ships a*_elf.dll(chrome_elf.dll,msedge_elf.dll, …) in the versioned folder next to the exe, whatever the brand. That covers Chrome, Edge, Brave, Vivaldi, Comet, etc. without a name list._chrome_command()returnsNoneandopen_window()falls back towebbrowser.open, a plain tab in the default browser. Previously, the dashboard opened in Edge for these users.LaunchWinApp.exebroker gets a plain tab in that browser rather than a guess.Component
scripts/karma_desktop)Type
Testing
scripts/testspass on Windows (53 passed, 13 skipped as other-OS). The new Windows tests stub only the thin ctypes call and run real-looking answers through the resolution logic: Chromium default → app mode, Firefox default → plain tab,%VAR%path, unquoted path with spaces, lookup failure / empty /LaunchWinApp.exe/ missing file → fallback list. One test calls the realAssocQueryStringWon the runner.ruff check/ruff format --checkcleanRelated Issues
None filed. Companion PR:
--silentfor windowless server start on Windows.