[Scripting] [Feature request] Automatic profile switching hook
See mailing list thread subject Light/Dark (Day/Night) mode Integration with Preferences/Advanced/Automatic Profile Switching
I've been playing with the automatic profile switching. It can be really handy for determining which machine I'm on and making sure I have the right context.
But I've run into a snag in that I want it to also be timed to the time of day/lightness or darkness of my environment.
Would it be possible to add in some sort of ability to have profiles grouped into day/nights or some tagging like that so that the automatic profile switch could have different profiles depending on what time of day it is or what the ambient light conditions are?
The reason it's important is that once one gets used to easily switching between Dark/Light modes, the forced Automatic Profile Switching overrides that so because I'm finding light/dark more important from a usability perspective, I've had to turn off Automatic Profile Switching.
This sounds like a job for scripting. You could pretty much implement this with the existing scripting APIs using async_subscribe_to_location_change_notification (see https://iterm2.com/python-api/notifications.html) and implementing automatic profile switching yourself. Note this is only in the nightly build and it's still under active development.
A better solution would be to have an explicit link between APS and scripting. A script could be used to break ties, for example: if two profiles want to be switched to under the same condition (e.g., same hostname) then it could go to the script to make the choice. It would check the ambient light levels and pick the light or dark profile appropriately.