contrib/inactive-windows-transparency: remove all transparencies on exit

Hidden windows in the scratchpad failed to have their transparency
reset upon program exit. This is because they are kept separetly in
`ipc.get_tree.scratchpad()`, and not in `ipc.get_tree.workspaces()`.
This commit is contained in:
gibbz00 2022-09-10 18:23:23 +00:00
parent 78b5c0a77e
commit 10c697d33a

View file

@ -32,9 +32,12 @@ def on_window_focus(inactive_opacity, ipc, event):
def remove_opacity(ipc):
for workspace in ipc.get_tree().workspaces():
for w in workspace:
w.command("opacity 1")
tree = ipc.get_tree()
for workspace in tree.workspaces():
for window in workspace:
window.command("opacity 1")
for window in tree.scratchpad():
window.command("opacity 1")
ipc.main_quit()
sys.exit(0)
@ -66,4 +69,4 @@ if __name__ == "__main__":
for sig in [signal.SIGINT, signal.SIGTERM]:
signal.signal(sig, lambda signal, frame: remove_opacity(ipc))
ipc.on("window::focus", partial(on_window_focus, args.opacity))
ipc.main()
ipc.main()