Changing OS X native Terminal theme from commands

I used iTerm2 for a while. But it is taking a lot of memory. I wanted to configure the native terminal application on OS X.

nn

I have a virtual box and I used it for my development. I connect to a bridge to access production. I wanted the terminal to change colours/themes when I log in to each and every host.

nn

I downloaded a few themes from this repository: https://github.com/lysyi3m/macos-terminal-themes. Imported them to OS X terminal application.

nn

Since I am using zsh, I added below code to .zshrc. If you are on bash please change .bash_profile on your mac.

nn

function virt() {n  osascript -e "tell application \"Terminal\" to set current settings of front window to settings set \"Ubuntu\""n  ssh -Ap 5001 vuser@virtual-servern  osascript -e "tell application \"Terminal\" to set current settings of front window to settings set \"One Dark\""n}n

nn

Then I change .zshrc on my virtual server again. It calls my mac to change the active profile.

nn

function prod() {n  ssh -A luser@laptop -C 'osascript -e "tell application \"Terminal\" to set current settings of front window to settings set \"Red Alert\""'n  ssh -A buser@bridge.company.orgn  ssh -A luser@laptop -C 'osascript -e "tell application \"Terminal\" to set current settings of front window to settings set \"Ubuntu\""'n}n

nn

I use password-less login on all the servers. It makes it bit slower when you log-off and log-in.

nn

n

Missing Image

n

nn

Tags

nn

    n

  • terminal
  • n

  • mac
  • n

  • osx
  • n

n

Proudly powered by WordPress

Discover more from Dedunu

Subscribe now to keep reading and get access to the full archive.

Continue reading