tomliv Posted January 20, 2020 Share Posted January 20, 2020 I'm new to this. I have the latest versions of Alfred and iTerm2. I am having trouble getting Alfred to use iTerm2 (Build 3.3.7) instead of Terminal. Can someone just show me the script I need for this to work? Or link to it? I'd seen a couple but nothing works. Thanks! Link to comment
vitor Posted January 21, 2020 Share Posted January 21, 2020 Welcome @tomliv, Tip when debugging: never say you’re on the the “latest”, but always the exact version (like you did with iTerm2). When you say “latest” we don’t know if you mean the latest beta or stable version, nor do we know if you’re actually on the newest version. You may think you’re up to date but be mistaken, or might be a version behind because the auto-update hasn’t kicked yet, or we may not be on what we think is the latest version but isn’t, or a multitude of other reasons. It also does not help someone who comes later with the same issue, as they’ll have no idea if their version matches yours. But as to your question, this should work (it’s the code I use). Stick it in Alfred Preferences → Features → Terminal, with Application set to Custom: 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 nowindows to false on error create window with default profile select first window set nowindows to true end try tell the first window if nowindows 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
tomliv Posted January 21, 2020 Author Share Posted January 21, 2020 vitor, thank you for the script. It is working now. And for the record I am using Alfred version 4.0.8 [1135]. Sorry for not including it in my original question. Thanks again! Link to comment
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