MacOS – multiple terminal launchers on the dock

dockmacosterminal

I have a terminal shortcut on my dock which I use every day. Depending on my monitor setup (extra, 2 extra, etc.) to my Macbook Pro, I like to have a different launching scheme (either 4 windows or 5 windows).

Is there a way to have 2 (or more) terminal launchers on the dock, one which launches the "4 windows" setup and one which launches the "5 windows" setup?

Best Answer

Here's how you can switch Terminal's startup window group automatically:

defaults write com.apple.Terminal 'Startup Window Group' 'four-windows'
defaults write com.apple.Terminal 'Startup Window Group' 'five-windows'

(four-windows and five-windows should be replaced with the Terminal window group names.)

You can use AppleScript or Automator to make an app that does that then launches Terminal:

-- AppleScript version
do shell script "defaults write com.apple.Terminal 'Startup Window Group' 'four-windows'"
tell app "Terminal" to activate

Or you can use my linkapp script to make a new app bundle that will do the same thing, and the icon will stay there.

python linkapp.py /Applications/Utilities/Terminal.app ./term-layout-4.app

Then when it gives you the wrapper script, edit it and add the defaults write line above the "$executable".

#!/usr/bin/env bash
executable="$(dirname "$0")/Terminal"

defaults write com.apple.Terminal 'Startup Window Group' 'four-windows'

"$executable" 

You can then do the same with your other window group. One caveat with linkapp.py is that you can't run them both at the same time, because it will try to restore your windows.

If you want you can change the icon too (but if you don't use linkapp.py, the normal Terminal icon will be what shows up in your Dock and Command+Tab when it's running).