24
12
I'm trying to set up a few keyboard shortcuts that open specific iTerm sessions, which I was able to do with BetterTouchTool and a bit of AppleScript magic. The problem is that OS X insists to open a Terminal window for any shell script you execute through the GUI (i.e. from Finder, or as a keyboard shortcut from BetterTouchTool). The terminal window doesn't appear if I run the script directly from another terminal.
A workaround I found was to wrap the script in an .app directory, which solves the problem of the superfluous terminal window, but has some other issues (for example OS X seems to treat each resulting iTerm window as a separate app, cluttering my dock). (EDIT: this behaviour was actually caused by a bug in my script, see below)
I also tried assigning the Terminal app to another virtual desktop in the Spaces settings in an attempt to move it out of sight, but then it will just first switch to that desktop before running the script.
Is there a way to disable this behaviour completely? I already found the setting in the Terminal preferences to close the window after the script has finished, but it's still annoying to have the Terminal window pop up for a second.
Sorry, I don't quite understand. What do you want to do with those shell scripts? Do you want to open iTerm though a shell script? Are you exclusively talking about Terminal.app or mixing iTerm with "Terminal" in your question? Could you maybe post an example of what you're trying to run? – slhck – 2011-11-22T12:37:06.747
I've setup several iTerm sessions to launch a normal shell, open a Rails console, display the Rails log etc.
I'm using iTerm exclusively, and Terminal is opened automatically by OS X for whatever silly reason.
But anyway, I found a solution to make the bundle approach work properly (see edited question). – toupeira – 2011-11-22T14:20:42.477
I see! Well, it would be awesome if you could answer your own question (using the button below) and tell us what you did, or how you solved the issue. Maybe post some examples in your question, and then just add a brief answer. This way, if somebody stumbles upon your post, they might learn something from it! – slhck – 2011-11-22T14:25:31.237
Well I still don't have an answer for the actual question (i.e. how to avoid the Terminal completely, without having to use an .app wrapper), so I'd rather leave it open in case somebody can enlighten me. – toupeira – 2011-11-22T14:39:27.277
1I'm still confused. You don't want to run them via an .app created by Automator? – slhck – 2011-11-22T15:03:23.450