aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Albéric TROUPLIN <palb-github@troupl.in>2021-02-16 11:38:57 +0100
committerSimon Ser <contact@emersion.fr>2021-02-16 11:45:10 +0100
commita3d45c3280ac38227c30dbc7620d1c45ef3c2426 (patch)
treeed4d21367a711e87cf511e3ce265b89df2d164cc
parent42cbaf278cc96218e38662ba5cb84c7023968bc8 (diff)
Prevent inactive-windows-transparency.py to crash on lockscreen
-rwxr-xr-xcontrib/inactive-windows-transparency.py7
1 files changed, 6 insertions, 1 deletions
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")