Conditions | 5 |
Total Lines | 12 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import plistlib |
||
24 | def detect(data: dict | None = None) -> str: |
||
25 | if data is None: |
||
26 | with PREFERENCES.open("rb") as fp: |
||
27 | data = plistlib.load(fp) |
||
28 | |||
29 | for handler in data.get("LSHandlers", []): |
||
30 | if handler.get("LSHandlerURLScheme") == "http": |
||
31 | role = handler["LSHandlerRoleAll"] |
||
32 | return NAMES[role] |
||
33 | |||
34 | log.warn("Unable to determine the default browser") |
||
35 | return DEFAULT |
||
36 | |||
41 |