vitor Posted March 18, 2013 Posted March 18, 2013 Alfred v2.0.1 (173) | OSX 10.8.3 If iTerm2 is chosen as the Terminal to use, commands passed through Alfred will, if iTerm2 is not open, cause it to launch with two tabs, executing the commands on the second tab. This happens whether the command is run via the Terminal / Shell feature, or via a Workflow. It becomes annoying because most of the times I use this feature, I want the command to run and the terminal to close, which does not happen since the other tab stays open. I’m using the code in http://www.alfredforum.com/topic/721-executing-iterm2-terminal-commands-in-current-shell/?hl=iterm to go around this issue in the meantime, has it (so far) seems to avoid the issue.
Andrew Posted March 18, 2013 Posted March 18, 2013 Alfred v2.0.1 (173) | OSX 10.8.3 If iTerm2 is chosen as the Terminal to use, commands passed through Alfred will, if iTerm2 is not open, cause it to launch with two tabs, executing the commands on the second tab. This happens whether the command is run via the Terminal / Shell feature, or via a Workflow. It becomes annoying because most of the times I use this feature, I want the command to run and the terminal to close, which does not happen since the other tab stays open. I’m using the code in http://www.alfredforum.com/topic/721-executing-iterm2-terminal-commands-in-current-shell/?hl=iterm to go around this issue in the meantime, has it (so far) seems to avoid the issue. This is an issue with iTerm2 which I've been talking with George about for quite some time. When using the AppleScript to prevent this, there is a long pause of up to 5 or 6 seconds caused by iTerm2. Hopefully he can resolve this fully one day
vitor Posted March 19, 2013 Author Posted March 19, 2013 (edited) There seems, however, to be something weird about the way Alfred calls iTerm2 (or how it executes Applescript, perhaps). Consider this script set command to "echo testing" tell application "System Events" set _wasRunning to exists (processes where name is "iTerm") end tell tell application "iTerm" activate if not _wasRunning then set _session to current session of current terminal else set _term to (make new terminal) tell _term launch session "Default" set _session to current session end tell end if tell _session write text command end tell end tell When I run this via the Applescript Editor, it works as intended (if iTerm2 isn’t running, it opens a single window and executes the command; if iTerm2 is already running, it creates a new window and runs the command there). However, when I try this with the “on alfred_script(q)” handler wrapping it, the problem arises (it works the same if iTerm2 is already running, but if it isn’t it creates two windows, and runs the command on the second one). What is it about the way Alfred executes the code that makes it behave that way? Keep in mind that I’m not the biggest fan of Applescript and usually avoid it where I can, so there could certainly be something I’m missing here, but the fact that it works in Applescript Editor and not in Alfred is strange. Edited March 19, 2013 by vitor
Andrew Posted March 19, 2013 Posted March 19, 2013 Hm this is quite an interesting and different way to how George suggested the AppleScript should be done - I'm going to have a bit of a look into this! Cheers, Andrew
jchlu Posted May 16, 2013 Posted May 16, 2013 Would love an update on this, first reported back in Feb 2012 Johnny.
manjaro Posted November 20, 2013 Posted November 20, 2013 Im also facing the same issue. Is there any update on this issue. Thanks, Joe.
Lucas Steinwalker Posted November 23, 2013 Posted November 23, 2013 I'd like to point out that I am having a similar problem with an applescript (triggered via automator) which launches iterm2. Here's the script: on run {input, parameters} tell application "Finder" set dir_path to "\"" & (POSIX path of (input as string)) & "\"" -- display dialog dir_path end tell CD_to(dir_path)end runon CD_to(theDir) tell application "iTerm" activate try set t to the last terminal on error set t to (make new terminal) end try tell t launch session "Default Session" tell the last session write text "cd " & theDir & ";clear;ls" end tell end tell end tellend CD_to Taken from http://peterdowns.com/posts/open-iterm-finder-service.html As much as I am hoping for a solution, the problem does look like it is with iTerm
jchlu Posted May 15, 2014 Posted May 15, 2014 Folks, I've been hearing good things about iTerm2 again lately, but over two years since first reporting this issue it still exists in the latest version of OSX / iTerm2 / Alfred. I'm extremely reluctant to move to iTerm2 because of this issue alone. Does nobody else care? Johnny. zanoos800 1
Andrew Posted September 5, 2015 Posted September 5, 2015 Really annoys me too! Have you looked at the new iTerm integration? https://www.alfredapp.com/blog/tips-and-tricks/better-iterm-integration-in-alfred/
Lucas Steinwalker Posted September 8, 2015 Posted September 8, 2015 Have you looked at the new iTerm integration? https://www.alfredapp.com/blog/tips-and-tricks/better-iterm-integration-in-alfred/ The new iTerm integration worked, but the 2.9 beta version of iTerm needs to be installed. Here's a link to a YouTube video about how to install the new integration:
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now