Adding automatic light/dark theme switching to doom-emacs running on a mac with ambient light sensor.
Idea adapted from: Matt Bilyeu https://matthewbilyeu.com/blog/2018-04-09/setting-emacs-theme-based-on-ambient-light
- Make the lmutracker executable using
clang
and place it in your custom doom directory:$ cd ~/.doom.d/ # start in your custom doom directory, wherever that is for you. $ touch lmutracker.mm # copy in the contents of this file however you like $ clang -o lmutracker lmutracker.mm -framework IOKit -framework CoreFoundation # this makes the executable
- Add the relevant elisp to your doom config (e.g. "~/.doom.d/config.el") Edit values for
light-theme
anddark-theme
to match your preferences. - Restart emacs and watch the theme automatically adjust to ambient light. By default, light sensor is probed every 10seconds. Use keybind
SPC t p
to toggle photometry on/off.
it's doesn't works anymore on new Macbooks (with touchbar)
https://stackoverflow.com/a/52150583/1397675