Lock opacity for sticky windows
This commit is contained in:
parent
2be287ef9f
commit
6ef42310f1
|
@ -19,6 +19,8 @@ def on_window_focus(opacity, ipc, event):
|
|||
return
|
||||
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)
|
||||
|
||||
focused_workspace = ipc.get_tree().find_focused()
|
||||
|
||||
|
@ -30,7 +32,7 @@ def on_window_focus(opacity, ipc, event):
|
|||
|
||||
if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859
|
||||
focused.command("opacity 1")
|
||||
if workspace == prev_workspace:
|
||||
if workspace == prev_workspace and not prev_focused.sticky:
|
||||
prev_focused.command("opacity " + opacity)
|
||||
prev_focused = focused
|
||||
prev_workspace = workspace
|
||||
|
@ -81,7 +83,10 @@ def remove_opacity(ipc):
|
|||
|
||||
def set_all(ipc,opacity):
|
||||
for window in ipc.get_tree():
|
||||
window.command("opacity " + opacity)
|
||||
if prev_focused.sticky:
|
||||
window.command("opacity 1")
|
||||
else:
|
||||
window.command("opacity " + opacity)
|
||||
|
||||
flag = os.environ["HOME"]+"/.spool/sway-hidden"
|
||||
pid = os.environ["HOME"]+"/.spool/sway-transparency"
|
||||
|
@ -115,6 +120,8 @@ if __name__ == "__main__":
|
|||
for window in ipc.get_tree():
|
||||
if window.focused:
|
||||
prev_focused = window
|
||||
elif window.sticky:
|
||||
continue
|
||||
else:
|
||||
window.command("opacity " + args.opacity)
|
||||
for sig in [signal.SIGINT, signal.SIGTERM]:
|
||||
|
|
Loading…
Reference in New Issue