Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alfred集成iTerm2终端 #110

Closed
alanhe421 opened this issue Dec 16, 2018 · 1 comment
Closed

Alfred集成iTerm2终端 #110

alanhe421 opened this issue Dec 16, 2018 · 1 comment
Labels

Comments

@alanhe421
Copy link
Owner

alanhe421 commented Dec 16, 2018

Alfred输入框中支持直接输入命令,回车启动终端。但默认是Terminal,这里需要进行设置来使默认启动iTerm2。

image

applescript

-- This is v0.7 of the custom script for AlfredApp for iTerm 3.1.1+
-- created by Sinan Eldem www.sinaneldem.com.tr

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

相关链接

@bigfoolliu
Copy link

nice

@alanhe421 alanhe421 transferred this issue from alanhe421/others-note Apr 18, 2022
Repository owner locked and limited conversation to collaborators Apr 18, 2022
@alanhe421 alanhe421 converted this issue into discussion #113 Apr 18, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

2 participants