Jump to content

Setting the Terminal/Shell to "Custom" (iTerm).


Recommended Posts

  • 1 year later...

I installed the latest beta version of iTerm 2 (Build 3.3.5beta1), and now my modified version of @Andrew's custom script isn't working. I think the only thing I changed was line 9 [set onlywindow to false], and this made my query always open in a new tab in iTerm. But now it seems, I get a new tab, but my query doesn't make it there. Maybe I just need to incorporate a pause or something? It feels like it's just moving too quickly for the new tab to keep up.

 

Prior to this new beta version, the new tab method was working well.

on alfred_script(q)
	if application "iTerm2" is running or application "iTerm" is running then
		run script "
			on run {q}
				tell application \"iTerm\"
					activate
					try
						select first window
						set onlywindow to false
					on error
						create window with default profile
						select first window
						set onlywindow to true
					end try
					tell the first window
						if onlywindow is false then
							create tab with default profile
						end if
						tell current session to write text q
					end tell
				end tell
			end run
		" with parameters {q}
	else
		run script "
			on run {q}
				tell application \"iTerm\"
					activate
					try
						select first window
					on error
						create window with default profile
						select first window
					end try
					tell the first window
						tell current session to write text q
					end tell
				end tell
			end run
		" with parameters {q}
	end if
end alfred_script

 

Link to comment
  • 8 months later...

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...