iTerm2获取当前会话配置文件?

gdo*_*eod 5 applescript iterm iterm2

因此,我知道有一种方法可以通过echo -e“ \ 033] 50; SetProfile = Foo \ a”来设置会话配置文件,但是有没有办法获取当前会话的配置文件?

小智 7

您可以通过检查$ITERM_PROFILE变量来获取会话(对于那些正在寻找的人)。它可以帮助您查看打印输出,printenv从而看到类似的信息。

  • 但是在编辑当前会话的配置文件后,这个“ITERM_PROFILE”环境变量不会更改。 (2认同)

Lri*_*Lri 2

除了这样的内容之外,我没有找到任何方法来获取配置文件的名称:

tell application "System Events" to tell process "iTerm"
    keystroke "i" using command down
    set p to value of text field 1 of tab group 1 of group 1 of window 1
    click button 1 of window 1
end tell
p
Run Code Online (Sandbox Code Playgroud)

您也许能够通过某些属性来识别配置文件:

tell application "iTerm" to tell current session of terminal 1
    background color is {0, 0, 0} and transparency is 0.0
end tell
Run Code Online (Sandbox Code Playgroud)

字典中记录的属性:

背景颜色、背景图像路径、粗体颜色、内容、光标颜色、光标文本颜色、前景色、id、名称、数字、所选文本颜色、选择颜色、透明度、tty