mirror of
https://github.com/swaywm/sway.git
synced 2024-11-25 17:31:28 +00:00
Use transparency arg in the window focus event
This commit is contained in:
parent
c99d423ad9
commit
0106dd135c
|
@ -9,9 +9,9 @@ import argparse
|
||||||
import i3ipc
|
import i3ipc
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
|
def on_window_focus(inactive_opacity, ipc, event):
|
||||||
def on_window_focus(ipc, event):
|
|
||||||
global prev_focused
|
global prev_focused
|
||||||
global prev_workspace
|
global prev_workspace
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ def on_window_focus(ipc, event):
|
||||||
if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859
|
if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859
|
||||||
focused.command("opacity 1")
|
focused.command("opacity 1")
|
||||||
if workspace == prev_workspace:
|
if workspace == prev_workspace:
|
||||||
prev_focused.command("opacity " + transparency_val)
|
prev_focused.command("opacity " + inactive_opacity)
|
||||||
prev_focused = focused
|
prev_focused = focused
|
||||||
prev_workspace = workspace
|
prev_workspace = workspace
|
||||||
|
|
||||||
|
@ -60,5 +60,5 @@ if __name__ == "__main__":
|
||||||
window.command("opacity " + args.opacity)
|
window.command("opacity " + args.opacity)
|
||||||
for sig in [signal.SIGINT, signal.SIGTERM]:
|
for sig in [signal.SIGINT, signal.SIGTERM]:
|
||||||
signal.signal(sig, lambda signal, frame: remove_opacity(ipc))
|
signal.signal(sig, lambda signal, frame: remove_opacity(ipc))
|
||||||
ipc.on("window::focus", on_window_focus)
|
ipc.on("window::focus", partial(on_window_focus, args.opacity))
|
||||||
ipc.main()
|
ipc.main()
|
Loading…
Reference in a new issue