Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ipc trailfocus update #204

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 38 additions & 19 deletions ipc-scripts/trailfocus.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,50 @@
commands_sock = WayfireSocket(addr)
commands_sock.watch()

outputs = []

def output_realized(output):
for o in outputs:
if output == o:
return True
return False

def sort_views():
i = 0
for v in commands_sock.list_views():
if v["app-id"] == "$unfocus panel" or v["layer"] == "background":
continue
if v["state"] != {} and v["state"]["minimized"]:
continue
i += 1
o_step = 0.2 / i
b_step = 0.5 / i
s_step = 1.0 / i
o_value = 0.8
b_value = 0.5
s_value = 0.0
for v in commands_sock.list_views()[::-1]:
if v["app-id"] == "$unfocus panel" or v["layer"] == "background":
continue
if v["state"] != {} and v["state"]["minimized"]:
continue
o_value += o_step
b_value += b_step
s_value += s_step
commands_sock.set_view_opacity(v["id"], o_value, 1000)
commands_sock.set_view_brightness(v["id"], b_value, 1000)
commands_sock.set_view_saturation(v["id"], s_value, 1000)
if not output_realized(v["output"]):
outputs.append(v["output"])
for o in outputs:
try:
i = 0
for v in commands_sock.list_views():
if v["output"] != o or v["app-id"] == "$unfocus panel" or v["layer"] == "background":
continue
if v["state"] != {} and v["state"]["minimized"]:
continue
i += 1
o_step = 0.2 / i
b_step = 0.5 / i
s_step = 1.0 / i
o_value = 0.8
b_value = 0.5
s_value = 0.0
for v in commands_sock.list_views()[::-1]:
if v["output"] != o or v["app-id"] == "$unfocus panel" or v["layer"] == "background":
continue
if v["state"] != {} and v["state"]["minimized"]:
continue
o_value += o_step
b_value += b_step
s_value += s_step
commands_sock.set_view_opacity(v["id"], o_value, 1000)
commands_sock.set_view_brightness(v["id"], b_value, 1000)
commands_sock.set_view_saturation(v["id"], s_value, 1000)
except:
pass

sort_views()

Expand Down
Loading