politicus Posted December 12, 2017 Share Posted December 12, 2017 I want to be able to launch some zsh/bash commands from the Alfred's bar. I sat the prefix to my likings, selected "Custom", modify the script accordingly. on alfred_script(q) tell application "iTerm" activate do script q end tell end alfred_script But it doesn't work. Link to comment
Andrew Posted December 12, 2017 Share Posted December 12, 2017 @politicus the iTerm script is a little more involving than this, take a look at this blog post: https://www.alfredapp.com/blog/tips-and-tricks/better-iterm-integration-in-alfred/ Which links to some pre-baked iTerm scripts: https://github.com/stuartcryan/custom-iterm-applescripts-for-alfred Cheers, Andrew matteor 1 Link to comment
politicus Posted December 14, 2017 Author Share Posted December 14, 2017 @Andrew Thank you. Unfortunately there is no script for the iTerm version I do have (3.1.5). I tried using the script for the 2.9 version but it didn't work. I will have to keep iTerm 2 open Link to comment
politicus Posted December 15, 2017 Author Share Posted December 15, 2017 Retried today and apparently it is working. Link to comment
joshwcorbett Posted September 16, 2019 Share Posted September 16, 2019 Is there a solution for iTerm 3 with Alfred 4?? blizzrdof77 1 Link to comment
vitor Posted September 16, 2019 Share Posted September 16, 2019 3 hours ago, joshwcorbett said: Is there a solution for iTerm 3 with Alfred 4?? Welcome @joshwcorbett, @Andrew’s shared solutions still work. I’m on Alfred 4 and iTerm 3 and it still works just as well as when I was using Alfred 3 and iTerm 2. Link to comment
joeynotjoe Posted September 17, 2019 Share Posted September 17, 2019 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 Hao Tran 1 Link to comment
vitor Posted June 9, 2020 Share Posted June 9, 2020 For anyone landing on this thread: the previous iTerm scripts have changed ownership (disclaimer: I’m the new author) and have been rewritten from scratch, so if you have any issues try the newer versions. You can find them on the new repository, or by using the old links as they will redirect to the new one. deanishe, joeynotjoe, thebitguru and 1 other 4 Link to comment
joeynotjoe Posted June 10, 2020 Share Posted June 10, 2020 Working like a charm so far, and I appreciate the customization. You're a boss, @vitor! vitor 1 Link to comment
matteor Posted July 30, 2022 Share Posted July 30, 2022 Just validated against Alfred 5.0.1 with iTerm2 3.4.16 and it works perfectly, thanks a lot @Andrew Pyetro 1 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