Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 828
Francis Bongiovanni Avatar asked Dec 08 '15 15:12

Francis Bongiovanni


2 Answers

cmd + u toggles the transparency.

like image 193
DKo Avatar answered Oct 02 '22 19:10

DKo


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...

like image 43
SushiHangover Avatar answered Oct 02 '22 19:10

SushiHangover