MacOS profile switcher based on window title
Making this into a topic since the API thread wont let me post it for some reason :)
I made a small applescript that checks to see if a particular window title is open on mac, and if so, switches to that profile, then it waits to ensure that window is still open, and if not, checks twice with a 1 second delay before going back to the default profile.
I used Yabai for this as the built in mac window title grep was both clunky and slow (about 5-10 seconds to process, which is a lot in a loop) and this is handy for emulators or things like geforce now which uses the main window and just changes the title.
This is part of a bigger script that also turns off location services, activates firewall, changes my mic from my headset internal one to my macbook mic (macbooks is better)
Profiles and titles are 1:1 meaning, put your window title in quotes of the windowTitles array and align its position with your profile under profileNames i.e. "Ready or Not on GeForce NOW" -> "Ready Or Not"
- brew install koekeishiya/formulae/yabai