mirror of
https://github.com/swaywm/sway.git
synced 2026-04-23 06:46:27 -04:00
contrib/inactive-windows-transparency: Show only one window as focused
Script currently has the ability to show multiple windows as active,
wrongly implying that more than one window can be focused at the same
time. It happens when multiple outputs are configured such that multiple
workspaces can be simultaneously shown. Stemming from a conditional to
only change transparency values if the focus change is done on the same
workspace in which the previous focus change was made. (Introduced in:
6235423544.) Commit is somewhat poor in
that it clumps multiple features into one commit, so it's hard to
understand what problem the author attempted to solve with the
conditional. I, for one, can not see any other reason for adding this
arguably incorrect behavior, as it goes directly against the script's
purpose. As such, it's regarded as a bug and the change will remove the
behavior entirely, not making it an option.
This commit is contained in:
parent
10c697d33a
commit
47023befbf
1 changed files with 4 additions and 7 deletions
|
|
@ -13,7 +13,6 @@ from functools import partial
|
|||
|
||||
def on_window_focus(inactive_opacity, ipc, event):
|
||||
global prev_focused
|
||||
global prev_workspace
|
||||
|
||||
focused_workspace = ipc.get_tree().find_focused()
|
||||
|
||||
|
|
@ -21,14 +20,13 @@ def on_window_focus(inactive_opacity, ipc, event):
|
|||
return
|
||||
|
||||
focused = event.container
|
||||
workspace = focused_workspace.workspace().num
|
||||
|
||||
if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859
|
||||
# on_window_focus not called only when focused is changed,
|
||||
# but also when a window is moved
|
||||
if focused.id != prev_focused.id:
|
||||
focused.command("opacity 1")
|
||||
if workspace == prev_workspace:
|
||||
prev_focused.command("opacity " + inactive_opacity)
|
||||
prev_focused.command("opacity " + inactive_opacity)
|
||||
prev_focused = focused
|
||||
prev_workspace = workspace
|
||||
|
||||
|
||||
def remove_opacity(ipc):
|
||||
|
|
@ -59,7 +57,6 @@ if __name__ == "__main__":
|
|||
|
||||
ipc = i3ipc.Connection()
|
||||
prev_focused = None
|
||||
prev_workspace = ipc.get_tree().find_focused().workspace().num
|
||||
|
||||
for window in ipc.get_tree():
|
||||
if window.focused:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue