Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- #
- # (c) Copyright 2023, wrote by Tony Annen
- # Use Wayfire's IPC to set opacity/move things around
- import os
- from wayfire_socket import *
- addr = os.getenv('WAYFIRE_SOCKET')
- sock = WayfireSocket(addr)
- sock.watch()
- #opacity shit
- last_focused_toplevel = -1
- while True:
- msg = sock.read_message()
- # The view-mapped event is emitted when a new window has been opened.
- if "event" in msg and msg["event"] == "view-focused":
- view = msg["view"]
- print(view)
- new_focus = view["id"] if view and view["type"] == "toplevel" else -1
- if last_focused_toplevel != new_focus:
- if last_focused_toplevel != -1 and new_focus != -1:
- sock.set_view_alpha(last_focused_toplevel, 0.4)
- #sock.set_view_blur(last_focused_toplevel, 0.4)
- if new_focus != -1:
- sock.set_view_alpha(new_focus, 1.0)
- last_focused_toplevel = new_focus
- # put shit exactly where I want it
- if "event" in msg and msg["event"] == "view-mapped":
- view = msg["view"]
- if view["app-id"] == "kitty":
- output_data = sock.query_output(view["output"])
- x = 69
- y = 603
- w = 880
- h = 392
- sock.configure_view(view["id"], x, y, w, h)
- if view["app-id"] == "mpdevil":
- output_data = sock.query_output(view["output"])
- x = 833
- y = 506
- w = 1069
- h = 523
- sock.configure_view(view["id"], x, y, w, h)
- if view["app-id"] == "loqui":
- output_data = sock.query_output(view["output"])
- x = 423
- y = 257
- w = 1052
- h = 578
- sock.configure_view(view["id"], x, y, w, h)
- if view["app-id"] == "firefox":
- output_data = sock.query_output(view["output"])
- x = 0
- y = 0
- w = 1920
- h = 1049
- sock.configure_view(view["id"], x, y, w, h)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement