Don't skip opacity changes if prev_focused was killed
This commit is contained in:
parent
c4964abe96
commit
93c786f9e3
|
@ -20,7 +20,8 @@ def on_window_focus(opacity, ipc, event):
|
|||
global prev_focused
|
||||
global prev_workspace
|
||||
# Refresh previous window in case it changed while in focus
|
||||
prev_focused = ipc.get_tree().find_by_id(prev_focused.id)
|
||||
if prev_focused:
|
||||
prev_focused = ipc.get_tree().find_by_id(prev_focused.id)
|
||||
|
||||
focused_workspace = ipc.get_tree().find_focused()
|
||||
|
||||
|
@ -30,9 +31,9 @@ def on_window_focus(opacity, ipc, event):
|
|||
focused = event.container
|
||||
workspace = focused_workspace.workspace().num
|
||||
|
||||
if prev_focused and focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859
|
||||
if prev_focused == None or focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859
|
||||
focused.command("opacity 1")
|
||||
if workspace == prev_workspace and not prev_focused.sticky:
|
||||
if prev_focused and workspace == prev_workspace and not prev_focused.sticky:
|
||||
prev_focused.command("opacity " + opacity)
|
||||
prev_focused = focused
|
||||
prev_workspace = workspace
|
||||
|
|
Loading…
Reference in New Issue