From 85133395c1196fba880552acc51a92d5d2bb344d Mon Sep 17 00:00:00 2001 From: gibbz00 Date: Mon, 3 Oct 2022 11:54:42 +0200 Subject: [PATCH] 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. --- contrib/inactive-windows-transparency.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/contrib/inactive-windows-transparency.py b/contrib/inactive-windows-transparency.py index 6ecf6f9e9..a92588780 100755 --- a/contrib/inactive-windows-transparency.py +++ b/contrib/inactive-windows-transparency.py @@ -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()