Search code examples
bashterminalatom-editoriterm2iterm

iTerm2 & Atom - Switch profiles based on input bash commands in ~/.bash_profile, looking for suggestions


The weather has gotten pretty decent where I am at and recently I've been working outside more often than not. Usually when inside I use a dark theme that is comfortable for the eye, but outside, obviously, I can't see crap and resort to changing iTerm & Atom themes' to ones with a light background.

I'm a man of shortcuts, and after doing some investigation online and some Googling I haven't seen anything that would allow me to change iTerm's or Atom's configuration directly via the terminal. The objective would be to type light to change my Atom's and iTerm's configuration to a lighter theme, and dark to change them back to dark (via ~/.bash_profile).

Regarding iTerm in specific, my idea was to directly modify the configuration file at ~/Library/Prferences/com.googlecode.iterm2.plist when the commands are run. More specifically (so I don't have to deal with converting .plist files to .xml and then back) I would just set up two git branches and flip between them on command.

However, the solution above is extremely bootleg, and not effectively transferable over to other machines, which I do like to be the cases I reformat my computer (yearly clean). I was wondering if someone would have an idea, or has encountered something similar to this and would be willing to give some suggestions that might possibly work.

Much appreciated!


Solution

  • iTerm added native support for dark mode, so no longer need any sort of hack. Using Nightfall to quickly toggle between dark and light mode.