gpt4 book ai didi

macos - Applescript 打开特定的终端样式窗口

转载 作者:行者123 更新时间:2023-12-01 11:55:18 25 4
gpt4 key购买 nike

好的,事情是这样的。我想为每个工作有不同风格的终端窗口。每个人都有不同的工作,即,一个人将通过 ssh 连接到一个站点,另一个窗口连接到另一个地方,等等。

所以我想这可以通过一些 Applescripting 来完成?

问题是有一些 Applescripts 可以打开不同的终端窗口。然后将每个applescript 添加到快捷方式。

有任何想法吗?

谢谢 :)

最佳答案

如何在终端中设置一个 Window 组?

打开所有你想要的终端窗口 --> Shell --> Show Inspector。在设置下,您可以更改每个终端窗口的主题。

窗口 --> 将窗口另存为组

在首选项中设置启动选项以显示组。

http://img18.imageshack.us/img18/9681/screenshot20111018at110.png
http://img542.imageshack.us/img542/9681/screenshot20111018at110.png

如果您想使用 Applescript 来设置窗口的主题,您首先需要使用此 Applescript 获取您拥有的所有主题的 ID:

set a to {}
tell application "Terminal"
repeat with i from 1 to count settings set
set temp to {settings set i's name, settings set i's id}
set end of a to temp
end repeat
a
end tell

这将输出一个包含 id # 和主题名称的数组。接下来创建一个新窗口,使用以下命令:
tell application "Terminal"
set a to do script "" -- creates new window
set a's current settings to (settings set id <one of the id #>)
end tell

关于macos - Applescript 打开特定的终端样式窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7807962/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com