

This variant is both simpler, and seems to run more smoothly (no flickering). To get this behavior instead, use the following script.

#Iterm2 themes windows
Seeing that there are windows behind the active one emphasizes that it's in front of them. It makes sense! The transparency creats a sense of depth. Note: macOS currently (11.6, Big Sur) treats windows the opposite of this-it makes active windows transparent (at least, certain parts of them) and inactive ones opaque (and faded). This sounds counter-intuitive, but toggling that "Use transparency" setting doesn't seem to be possible via the API, so the script instead quickly switches windows to opaque on creation.Īt least on my machine the window flickers briefly when first selected, but I'm not sure if there's anything I can do about that. You want to set the desired transparency on your profile, and check the "Use transparency" box for "Settings for New Windows". See the iTerm docs for details on using Python scripts # For other focus change events, do nothing Window = app.get_window_by_id(update.window_changed.window_id) # For window change events, use the provided event reason Tab = app.get_tab_by_id(lected_tab_changed.tab_id) # When switching to a new tab, treat as selecting a window
#Iterm2 themes update
Update = await mon.async_get_next_update() Original = await _get(Ĭt_transparency(ansparency)Īwait session.async_set_profile_properties(change)Īpp = await iterm2.async_get_app(connection)Īwait update_tab_transparency(connection, tab, reason)Īsync with iterm2.FocusMonitor(connection) as mon: # But, only need to do anything if the profile has been changed # make sure transparency matches the original profile # For window change events taking a window out of focus, # For window change events bringing a window into focus, Profile = await session.async_get_profile() Window_selected = Īsync def update_tab_transparency(connection, tab, reason): # Store window change event reason objects in more convenient variables To get the desired behavior (change transparency based on window focus), you need to write a script using iTerm2's Python API, and save it as an AutoLaunch script: #!/usr/bin/env python3.7 One changes transparency, but is static the other dims when windows are inactive, rather than changes transparency. Check out the repo for the up-to-date scripts.Įach of the previous answers gets a piece of the puzzle. Update: I put the two scripts up on GitHub, along with a nice demo GIF :)Īlso did a bit of refactor and bug fixing.
