Skip to content

Commit

Permalink
fix: windows browser detection
Browse files Browse the repository at this point in the history
Was borked due to a wrong refactor.

Signed-off-by: Lionel H <me@nullbyte.be>
  • Loading branch information
lion24 committed Apr 19, 2024
1 parent fa29450 commit da473bc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/speed_sleuth/browser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,21 @@ def detect_default_browser() -> tuple[str, str]:
HKEY_CLASSES_ROOT,
HKEY_CURRENT_USER,
OpenKey,
QueryValueEx,
)

reg_key = OpenKey(
HKEY_CURRENT_USER,
r"SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice", # noqa: E501
)
browser = reg_key.QueryValueEx(reg_key, "ProgId")[0]
reg_key.close()
browser = QueryValueEx(reg_key, "ProgId")[0]

reg_key = OpenKey(
HKEY_CLASSES_ROOT,
r"{}\shell\open\command".format(browser),
)
browser_path_tuple = reg_key.QueryValueEx(reg_key, None)
browser_path_tuple = QueryValueEx(reg_key, None)
path = browser_path_tuple[0].split('"')[1]
reg_key.close()

return browser, path
except ImportError:
Expand Down

0 comments on commit da473bc

Please sign in to comment.