sindresorhus / default-browser

Get the default browser
MIT License
54 stars 9 forks source link

Support for windows #5

Closed connor4312 closed 3 years ago

connor4312 commented 4 years ago

It seems like we could get the default browser on Windows by running a command like

reg QUERY HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice /v ProgId

Which prints output like

HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice
    ProgId    REG_SZ    ChromeHTML

Or

HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice
    ProgId    REG_SZ    MSEdgeDHTML

We wouldn't be able to get a similarly compatible id, as far as I can see, but we could categorize and retrieve the name. E.g: https://github.com/microsoft/vscode-js-debug/blob/master/src/common/defaultBrowserProvider.ts

Would you be open to a PR to add support for this?

sindresorhus commented 4 years ago

Sure, PR welcome :)