mac的finder里直接打开iterm

2023/05/23 Tools 共 832 字,约 3 分钟

mac的finder里直接打开iterm

github repo: https://github.com/mafulong/openWithIterm

在mac finder里使用iterm打开当前目录

  • 打开Script Editor
  • 新建文件
  • 输入以下内容

tell application "Finder"
	set pathList to (quoted form of POSIX path of (folder of the front window as alias))
end tell

tell application "System Events"
	if not (exists (processes where name is "iTerm2")) then
		do shell script "open -a iTerm " & pathList
	else
		tell application "iTerm"
			do shell script "open -a iTerm "
			activate
			tell current session of current window
				write text "cd " & pathList
			end tell
			
		end tell
	end if
end tell
  • 文件 -> 导出。选择应用程序,勾选仅运行。

image-20230523145416151

然后

  • finder里cmd+鼠标选中创建的app,拖拽到工具栏。 如果要删除,也是cmd+鼠标拖拽出来进行删除。
  • 设置图标和重命名,不需要重新拖拽。设置图标的话,右键->显示简洁。然后用新图拖拽到图标上即可。细节请看参考2。

安装

git clone https://github.com/mafulong/openWithIterm.git
cd openWithIterm
mkdir /Applications/111mafulong
mv openIterm.app /Applications/111mafulong/
open /Applications/111mafulong/

然后拖拽安装即可。

此时图标是正确的。

Search

    Table of Contents