Closed J3RN closed 1 year ago
@seagle0128 , since you were the first to implement something for Linux, I would appreciate some feedback on this take by @J3RN.
There was some discussion on Reddit and here on #19 about d-bus being a better way to check the theme state then relying on the current method that some said only worked with a specific theme.
@J3RN also, if you could provide us with some demo gif of auto-dark
working under Linux with d-bus, it would be great for docs, something like what we have here: https://github.com/LionyxML/auto-dark-emacs/tree/master/images (could be another PR at another time though, your call).
Basically dbus is a more common approach, but I didn't test with many Linux distributions. I agree with the changes, but please format the codes before check-in.
I rewrote the doc strings such that checkdoc
no longer complains and I converted all indentation to spaces except where it was tabs before (i.e. the Applescript) as the tabs seemed rather arbitrarily placed.
This byte-compiles cleanly on my machine except for a gripe about ns-do-applescript
, which is present in Emacs for Mac OS X and Emacs Plus but not in my Linux build. IMO probably nothing to worry about.
Thanks you all!
It looks like we did it. A 31th Dec merge :)
Thank you very much for this PR, @J3RN, it's lovely!
The thrust of this change is to use D-Bus' notion of "color-scheme" instead of Dconf's notion of GTK theme, as detailed in #19.
Feature changes:
auto-dark--is-dark-mode-dconf
has becomeauto-dark--is-dark-mode-dbus
. The new one (D-Bus) uses Emacs' built-in D-Bus integration.auto-dark--register-dbus-listener
andauto-dark--unregister-dbus-listener
). This necessitated the creation of theauto-dark--dbus-listener-object
variable as a side-effect of how Emacs' D-Bus integration functions.Other changes:
auto-dark--check-and-set-dark-mode
to callauto-dark--set-theme
instead of duplicating the setting logic.auto-dark--[un]register-change-listener
functions that semi-intelligently dispatch to eitherns-*
functions for macOS ordbus-*
functions for Linux.I have some more ideas for cleaning up the macOS stuff, but I'll save those for another PR :grin: