diff --git a/darkdetect/_linux_detect.py b/darkdetect/_linux_detect.py index e55ee2e..42df96d 100644 --- a/darkdetect/_linux_detect.py +++ b/darkdetect/_linux_detect.py @@ -8,12 +8,18 @@ import typing def theme(): - # Here we just triage to GTK settings for now try: + #Using the freedesktop specifications for checking dark mode out = subprocess.run( - ['gsettings', 'get', 'org.gnome.desktop.interface', 'gtk-theme'], + ['gsettings', 'get', 'org.gnome.desktop.interface', 'color-scheme'], capture_output=True) stdout = out.stdout.decode() + #If not found then trying older gtk-theme method + if len(stdout)<1: + out = subprocess.run( + ['gsettings', 'get', 'org.gnome.desktop.interface', 'gtk-theme'], + capture_output=True) + stdout = out.stdout.decode() except Exception: return 'Light' # we have a string, now remove start and end quote