In iTerm2, in the menu bar go to Scripts > Manage > New Python Script
Select Basic. Select Long-Running Daemon
Give the script a decent name (I chose auto_dark_mode.py)
Save and open the script in your editor of choice.
| times in msec | |
| clock self+sourced self: sourced script | |
| clock elapsed: other lines | |
| 000.021 000.021: --- NVIM STARTING --- | |
| 001.377 001.356: locale set | |
| 002.669 001.293: inits 1 | |
| 002.707 000.038: window checked |