mirror of
https://github.com/swaywm/sway.git
synced 2026-04-23 06:46:27 -04:00
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:
parent
a5cab2bb5d
commit
85133395c1
1 changed files with 17 additions and 2 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue