-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add recipe for darkman.el #8423
Conversation
Some notes: (defcustom darkman-switch-themes-silently t
"Do not print the new mode and theme to the echo area." This docstring should mention the general condition under which the behavior applies. (defcustom darkman-switch-themes-silently t
"When non-nil, suppress theme loading messages." Consider a better name/docstring for (defun darkman-current-mode (&optional message)
"Return the Darkman service's mode.
When MESSAGE is non-nil, etc..."
(interactive (list t))
;;etc The same naming advice applies to (defun darkman-set-mode (mode)
"Set the mode of the Darkman service to MODE.
MODE can be ‘light’ or ‘dark’."
(dbus-set-property :session
darkman--dbus-service
darkman--dbus-path
darkman--dbus-interface
"Mode" (if (member mode '(dark light))
(symbol-name mode)
(darkman--invalid-mode-error mode)))) Instead of writing a custom lookup function ( Instead of autoloading the code which adds to |
as proposed by @progfolio in melpa/melpa#8423.
It may be considered impolite [1] to create a hook on behalf of the user (the hook is only useful if one is using Doom). Wrapping this in a function seems like a useless indirection so we should add it to the documentation instead. 1. See the suggestions of @progfolio in melpa/melpa#8423
Hi @progfolio! Thanks for the suggestions and code examples. I've implemented every one of them except for changing the current data structure as that will break compatibility and cause more trouble than it's worth. |
It may be considered impolite [1] to create a hook on behalf of the user (the hook is only useful if one is using Doom). Wrapping this in a function seems like a useless indirection so we should add it to the documentation instead. 1. See the suggestions of @progfolio in melpa/melpa#8423
How about using plist-get directly? e.g. (defun darkman--event-handler (interface property value)
"Callback function for handling a change in mode.
INTERFACE is the name of the interface that is the target of the event.
PROPERTY is the property that is modified by the event.
VALUE is the new value of PROPERTY."
(when-let (((string-equal interface darkman--dbus-service))
((string-equal property "Mode"))
(mode (car value))
(theme (plist-get (intern (concat ":" mode)) darkman-themes)))
(unless darkman-switch-themes-silently
(message (format "Darkman switched to %s mode, switching to %s theme."
mode theme)))
(load-theme theme))) |
as proposed by @progfolio in melpa/melpa#8423.
It may be considered impolite [1] to create a hook on behalf of the user (the hook is only useful if one is using Doom). Wrapping this in a function seems like a useless indirection so we should add it to the documentation instead. 1. See the suggestions of @progfolio in melpa/melpa#8423
Thanks both. This is looking solid and I'm not seeing any blockers. The below are just for your reference:
|
As @riscy indicates in melpa/melpa#8423.
Thank you @riscy! I wasn't aware of those warnings (neither the byte compiler nor And thank you @progfolio for the detailed and helpful review. |
Brief summary of what the package does
darkman.el
is a package that provides seamless integration between Darkman and Emacs. Darkman is usually configured manually, via shell scripts, to do specific things (mostly theme changes) according to the time of day. This package on the other hand directly interacts with the Darkman D-Bus service to automate this process.Direct link to the package repository
https://github.com/grtcdr/darkman.el
Your association with the package
I'm the author.
Checklist
M-x checkdoc
is happy with my docstrings