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
clangand 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-themeanddark-themeto 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 pto toggle photometry on/off.
it's doesn't works anymore on new Macbooks (with touchbar)
https://stackoverflow.com/a/52150583/1397675