在 Terminal/iTerm 中使用热键切换不透明度

Toggle Opacity with HotKey in Terminal/iTerm

有没有办法设置热键来更改终端或 iTerm 中的不透明度?我通常使用低百分比的不透明度,如果能够快速打开和关闭会很好。

编辑:Cmd + U 本质上做同样的事情,但没有一些可定制性

您可以使用 AppleScript 来做到这一点。

即在 iTerm(版本 2.9+)中,您可以使用以下方法将所有 windows/sessons 设置为 50% 透明度:

tell application "iTerm"
    repeat with aWindow in windows
        tell aWindow
            tell current session
                set transparency to 0.5
            end tell
        end tell
    end repeat
end tell

将其保存到一个文件中,然后 运行 从命令行通过:

osascript scriptname.scpt

您也可以将其放入 Automator.app 并通过热键组合将其设置为 运行..

假设您可以在 Terminal.app 中执行相同的操作,打开它的 AppleScript 词典并查看设置 window properties/transparency...

cmd + u 切换透明度。