contrib/inactive-windows-transparency: Add --ignore flag

Works as the title suggests. `--ignore firefox vlc gimp` would as an
example completely ignore any opacity modifications to the respective
windows, defaulting to 1.
This commit is contained in:
gibbz00 2022-10-03 11:54:42 +02:00
parent a5cab2bb5d
commit 85133395c1

View file

@ -19,11 +19,19 @@ def on_window_focus(args, ipc, event):
focused = event.container
# on_window_focus not called only when focused is changed,
# but also when a window is moved
if focused.id != prev_focused.id:
focused.command("opacity " + args.active_opacity)
prev_focused.command("opacity " + args.inactive_opacity)
if prev_focused.app_id in args.ignore:
prev_focused.command("opacity 1")
else:
prev_focused.command("opacity " + args.inactive_opacity)
if focused.app_id in args.ignore:
focused.command("opacity 1")
else:
focused.command("opacity " + args.active_opacity)
prev_focused = focused
@ -59,6 +67,13 @@ if __name__ == "__main__":
default=default_active_opacity,
help="value between 0 and 1 denoting opacity for active windows",
)
parser.add_argument(
"--ignore",
type=str,
default=[],
help="List of applications to be ignored.",
nargs="+"
)
args = parser.parse_args()
ipc = i3ipc.Connection()