Jump to content

Workflow to open new Terminal tab in currently opened window


Recommended Posts

Posted

Is there any way to have a workflow that opens a new tab in the currently opened window? Even if the window is not focused.

I'm struggling to do that.
Thanks for your help.

Posted (edited)

AppleScript is your friend. Unfortunately, Terminal's scripting support sucks, so you have to simulate keyboard shortcuts instead:
 
tell application "System Events"

    tell application process "Terminal"

        set frontmost to true

        keystroke "t" using command down

    end tell

end tell

 
On my machine, that opens a new Terminal window if none is open, and creates a new tab in the front window otherwise.

Edited by deanishe

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...