Skip to content

Commit

Permalink
Add python script to toggle ghost
Browse files Browse the repository at this point in the history
  • Loading branch information
soreau committed Jul 24, 2024
1 parent bfcc423 commit 0762128
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ipc-scripts/ipc-ghost-toggle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/python3

import os
import sys
from wayfire_socket import *

if len(sys.argv) < 2:
print(f"Usage: {sys.argv[0]} <app_id>")
exit(1)

addr = os.getenv('WAYFIRE_SOCKET')

events_sock = WayfireSocket(addr)
commands_sock = WayfireSocket(addr)
events_sock.watch()

for view in commands_sock.list_views():
if view["app-id"] == sys.argv[1]:
commands_sock.ghost_view_toggle(view["id"])
5 changes: 5 additions & 0 deletions ipc-scripts/wayfire_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,8 @@ def set_view_saturation(self, view_id: int, saturation: float, duration: int):
message["data"]["saturation"] = saturation
message["data"]["duration"] = duration
return self.send_json(message)

def ghost_view_toggle(self, view_id: int):
message = get_msg_template("ghost/ghost_toggle")
message["data"]["view-id"] = view_id
return self.send_json(message)

0 comments on commit 0762128

Please sign in to comment.