From a3d45c3280ac38227c30dbc7620d1c45ef3c2426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Alb=C3=A9ric=20TROUPLIN?= Date: Tue, 16 Feb 2021 11:38:57 +0100 Subject: [PATCH] Prevent inactive-windows-transparency.py to crash on lockscreen --- contrib/inactive-windows-transparency.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/contrib/inactive-windows-transparency.py b/contrib/inactive-windows-transparency.py index 77b1f221..b81134dd 100755 --- a/contrib/inactive-windows-transparency.py +++ b/contrib/inactive-windows-transparency.py @@ -15,8 +15,13 @@ def on_window_focus(inactive_opacity, ipc, event): global prev_focused global prev_workspace + focused_workspace = ipc.get_tree().find_focused() + + if focused_workspace == None: + return + focused = event.container - workspace = ipc.get_tree().find_focused().workspace().num + workspace = focused_workspace.workspace().num if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859 focused.command("opacity 1")