Stronger patching of darkdetect is needed
This commit is contained in:
parent
4012051f93
commit
3dc716c8a7
@ -7,12 +7,12 @@ def theme():
|
|||||||
# In HKEY_CURRENT_USER, get the Personalisation Key.
|
# In HKEY_CURRENT_USER, get the Personalisation Key.
|
||||||
try:
|
try:
|
||||||
key = getKey(hkey, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize")
|
key = getKey(hkey, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize")
|
||||||
|
# In the Personalisation Key, get the AppsUseLightTheme subkey. This returns a tuple.
|
||||||
|
# The first item in the tuple is the result we want (0 or 1 indicating Dark Mode or Light Mode); the other value is the type of subkey e.g. DWORD, QWORD, String, etc.
|
||||||
|
subkey = getSubkeyValue(key, "AppsUseLightTheme")[0]
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
# some headless Windows instances (e.g. GitHub Actions or Docker images) do not have this key
|
# some headless Windows instances (e.g. GitHub Actions or Docker images) do not have this key
|
||||||
return None
|
return None
|
||||||
# In the Personalisation Key, get the AppsUseLightTheme subkey. This returns a tuple.
|
|
||||||
# The first item in the tuple is the result we want (0 or 1 indicating Dark Mode or Light Mode); the other value is the type of subkey e.g. DWORD, QWORD, String, etc.
|
|
||||||
subkey = getSubkeyValue(key, "AppsUseLightTheme")[0]
|
|
||||||
return valueMeaning[subkey]
|
return valueMeaning[subkey]
|
||||||
|
|
||||||
def isDark():
|
def isDark():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user