如何使用mac快捷键打开终端

在mac中,有时候如果需要频繁的调用终端,即使是放在里栏目中固定,其实也有点觉得打开好累(对就是这么懒),如果通过快捷键我在任何时候想打开就打开是最好的。所以搜集资料整理了一哈,有需要的可以looklook

来人,给朕把图抬上来

1 找到mac内置的【自动操作】程序,对,就是扛着火箭筒的那个家伙
image.png

2 打开后选择快速操作
image.png

3 右边窗口找到【工作流程收到】,选择没有输入
4 左边菜单搜索【AppleScript】,将以下脚本粘贴

on run {input, parameters}
	
	(* Your script goes here *)
	tell application "Terminal"
	reopen
	activate
	activate
	end tell
end run

image.png
5 保存,取名为【 open terminal】
6 打开【系统偏好设置】,选择键盘,选择快捷键,左侧选择服务,右侧找到【通用】下刚刚自定义的名称【open terminal】,然后设置你需要的快捷键即可。最后按下刚设置的快捷键,快乐来了~~
image.png
image.png

其他脚本

任意位置打开终端脚本

on run {input, parameters}
	
	(* Your script goes here *)
	tell application "Terminal"
	reopen
	activate
	activate
	end tell
end run

当前文件夹打开终端脚本

 on run {input, parameters}
	tell application "Finder"
		set myWin to window 1
		set thePath to (quoted form of POSIX path of (target of myWin as alias))
		if application "Terminal" is running then
			tell application "Terminal"
				do script "cd " & thePath
				activate
			end tell
		else
			tell application "Terminal"
				do script "cd " & thePath in window 1
				activate
			end tell
		end if
	end tell
end run

参考文章

参考了人家的文章就要贴出来,如下:
https://segmentfault.com/a/1190000022225906
https://blog.csdn.net/weixin_44672591/article/details/105018673

原文地址:https://www.cnblogs.com/xuduan/p/14509213.html