mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
fix: try catch excepton in get_windows_dark_mode and global cache the check (#1587)
* fix: try catch excepton on get_windows_dark_mode and global cache that check * add commitor email to CONTRIBUTORS * remove is_windows_dark_mode cache * avoid logging the missing key (dae) The check happens frequently, so this will fill up the user's console if we print it each time.
This commit is contained in:
parent
77b1546583
commit
492f0a5e32
2 changed files with 6 additions and 1 deletions
|
@ -89,6 +89,7 @@ lolilolicon <lolilolicon@gmail.com>
|
|||
Gesa Stupperich <gesa.stupperich@gmail.com>
|
||||
git9527 <github.com/git9527>
|
||||
Vova Selin <vselin12@gmail.com>
|
||||
qxo <49526356@qq.com>
|
||||
|
||||
********************
|
||||
|
||||
|
|
|
@ -327,7 +327,11 @@ def get_windows_dark_mode() -> bool:
|
|||
HKEY_CURRENT_USER,
|
||||
r"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
|
||||
)
|
||||
return not QueryValueEx(key, "AppsUseLightTheme")[0]
|
||||
try:
|
||||
return not QueryValueEx(key, "AppsUseLightTheme")[0]
|
||||
except Exception as err:
|
||||
# key reportedly missing or set to wrong type on some systems
|
||||
return False
|
||||
|
||||
|
||||
def set_macos_dark_mode(enabled: bool) -> bool:
|
||||
|
|
Loading…
Reference in a new issue