Skip to content
Discussion options

You must be logged in to vote

A quick ChatGPT session gave me this script that seems to work well.

Save it somewhere, chmod +x [script] on it, and run it as a command in Leader Key:

#!/usr/bin/osascript
if application "Terminal" is running then
    tell application "Terminal"
        set windowCount to count of windows
        activate
        tell application "System Events" to keystroke "n" using command down
    end tell
else
    tell application "Terminal" to activate
end if

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@Ian7110
Comment options

@zenangst
Comment options

@mikker
Comment options

Answer selected by Ian7110
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants