aboutsummaryrefslogtreecommitdiff
path: root/contrib/inactive-windows-transparency.py
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/inactive-windows-transparency.py')
-rwxr-xr-xcontrib/inactive-windows-transparency.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/inactive-windows-transparency.py b/contrib/inactive-windows-transparency.py
index 15e2a91b..77b1f221 100755
--- a/contrib/inactive-windows-transparency.py
+++ b/contrib/inactive-windows-transparency.py
@@ -9,9 +9,9 @@ import argparse
import i3ipc
import signal
import sys
+from functools import partial
-
-def on_window_focus(ipc, event):
+def on_window_focus(inactive_opacity, ipc, event):
global prev_focused
global prev_workspace
@@ -21,7 +21,7 @@ def on_window_focus(ipc, event):
if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859
focused.command("opacity 1")
if workspace == prev_workspace:
- prev_focused.command("opacity " + transparency_val)
+ prev_focused.command("opacity " + inactive_opacity)
prev_focused = focused
prev_workspace = workspace
@@ -60,5 +60,5 @@ if __name__ == "__main__":
window.command("opacity " + args.opacity)
for sig in [signal.SIGINT, signal.SIGTERM]:
signal.signal(sig, lambda signal, frame: remove_opacity(ipc))
- ipc.on("window::focus", on_window_focus)
- ipc.main()
+ ipc.on("window::focus", partial(on_window_focus, args.opacity))
+ ipc.main() \ No newline at end of file