Created
April 21, 2020 18:56
-
-
Save pimeys/84661b25480c57c58265f30c764ccc42 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import i3ipc | |
ipc = i3ipc.Connection() | |
prev_focused = None | |
for window in ipc.get_tree(): | |
if window.focused: | |
prev_focused = window | |
else: | |
window.command('opacity 0.8') | |
def on_window_focus(ipc, focused): | |
global prev_focused | |
if focused.container.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859 | |
focused.container.command('opacity 1') | |
prev_focused.command('opacity 0.8') | |
prev_focused = focused.container | |
ipc.on("window::focus", on_window_focus) | |
ipc.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment