malob / DarkMode.spoon

Hammerspoon Spoon to enable, disable, and toggle DarkMode either manually, or on a schedule (by default enabled on sunset and disabled as sunrise).
3 stars 0 forks source link

Provide watchers for theme change event #4

Closed andreiborisov closed 5 years ago

andreiborisov commented 5 years ago

In order to do custom things when theme is changing (for example, to change Sublime Text theme and color scheme or change macOS accent color), it would be very handy to subscribe to such event through watchers

malob commented 5 years ago

I think I've already got you covered here. The spoon allows you to assign a function to DarkMode.functionToCall.

Here's the documentation for reference:

DarkMode.functionToCall (Function) Variable A function that accepts on boolean argument, which will be true when Dark Mode is enabled, and false when it's disabled.

If you haven't had a look yet you might want to have a look at the docs. You can find them by running hs.doc.hsdocs.help() and then going to the Spoons tab.

andreiborisov commented 5 years ago

Oh, you're absolutely right, I've missed it because it's new one😳

malob commented 5 years ago

FYI, in a recent commit, c0bad0f, I renamed this variable to callbackFn.