Advertisement
s0ulslack

Wayfire Inactive Transparent windows

Jan 25th, 2024 (edited)
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. #!/usr/bin/python3
  2. #
  3. # (c) Copyright 2023, wrote by Tony Annen
  4. # Use Wayfire's IPC to set opacity/move things around
  5.  
  6. import os
  7. from wayfire_socket import *
  8.  
  9. addr = os.getenv('WAYFIRE_SOCKET')
  10. sock = WayfireSocket(addr)
  11. sock.watch()
  12. #opacity shit
  13. last_focused_toplevel = -1
  14. while True:
  15. msg = sock.read_message()
  16. # The view-mapped event is emitted when a new window has been opened.
  17. if "event" in msg and msg["event"] == "view-focused":
  18. view = msg["view"]
  19. print(view)
  20. new_focus = view["id"] if view and view["type"] == "toplevel" else -1
  21. if last_focused_toplevel != new_focus:
  22. if last_focused_toplevel != -1 and new_focus != -1:
  23. sock.set_view_alpha(last_focused_toplevel, 0.4)
  24. #sock.set_view_blur(last_focused_toplevel, 0.4)
  25.  
  26. if new_focus != -1:
  27. sock.set_view_alpha(new_focus, 1.0)
  28.  
  29. last_focused_toplevel = new_focus
  30.  
  31. # put shit exactly where I want it
  32. if "event" in msg and msg["event"] == "view-mapped":
  33. view = msg["view"]
  34. if view["app-id"] == "kitty":
  35. output_data = sock.query_output(view["output"])
  36. x = 69
  37. y = 603
  38. w = 880
  39. h = 392
  40. sock.configure_view(view["id"], x, y, w, h)
  41. if view["app-id"] == "mpdevil":
  42. output_data = sock.query_output(view["output"])
  43. x = 833
  44. y = 506
  45. w = 1069
  46. h = 523
  47. sock.configure_view(view["id"], x, y, w, h)
  48. if view["app-id"] == "loqui":
  49. output_data = sock.query_output(view["output"])
  50. x = 423
  51. y = 257
  52. w = 1052
  53. h = 578
  54. sock.configure_view(view["id"], x, y, w, h)
  55. if view["app-id"] == "firefox":
  56. output_data = sock.query_output(view["output"])
  57. x = 0
  58. y = 0
  59. w = 1920
  60. h = 1049
  61. sock.configure_view(view["id"], x, y, w, h)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement