Francis Bongiovanni
Francis Bongiovanni

Reputation: 367

Toggle Opacity with HotKey in Terminal/iTerm

Is there any way to set up a hotkey to change the opacity in either the terminal or iTerm? I usually use a low percentage opacity and it would be nice to be able to toggle on and off quickly.

EDIT: Cmd + U does essentially the same thing without some customizability

Upvotes: 16

Views: 5787

Answers (2)

DKo
DKo

Reputation: 880

cmd + u toggles the transparency.

Upvotes: 21

SushiHangover
SushiHangover

Reputation: 74174

You can use AppleScript to do that.

i.e. in iTerm (ver. 2.9+) you can use the following to set all windows/sessons to 50% transparency:

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

Save that to a file and run it from the cmd-line via:

osascript scriptname.scpt

You could also drop it into Automator.app and set it up to run via a Hot-key combo..

Assuming you can do the same in Terminal.app, open up the AppleScript Dictionary for it and look at setting window properties/transparency...

Upvotes: 6

Related Questions