Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
XFCE does not use
gsettings
and was always returning 'Light'. Addedxfconf-query
which is supported by XFCE. (You can setgsettings
from the command line to force the GTK theme to update, and then darkdetect works as expected, but that is not the default in the XFCE settings app and most users probably don't do it.)Added a desktop detection function, and added XFCE support to
theme()
andlistener()
.Since 'Light' was confusing when detection fails for non-GTK desktops (internal errors are swallowed), an 'Unknown' theme type is added so that application knows detection was unsuccessful and can choose an appropriate response.
Added a 'watch' option to
__main__.py
to demonstrate the listener.This commit also provides a framework to support other desktop environments, like KDE. Those are left as an exercise to someone who knows what to do and is able to test it. The dbus PR looked promising but the dbus method is not working for me (I commented in that PR) and I don't know enough about dbus to debug it, so you still need the gsettings / xfconf-query fallback.
Tested on Manjaro Linux running XFCE 4.18.1