diff --git a/ipc-scripts/ipc-ghost-toggle.py b/ipc-scripts/ipc-ghost-toggle.py new file mode 100644 index 0000000..18189c7 --- /dev/null +++ b/ipc-scripts/ipc-ghost-toggle.py @@ -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]} ") + 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"]) diff --git a/ipc-scripts/wayfire_socket.py b/ipc-scripts/wayfire_socket.py index d82c9d8..9d3933c 100644 --- a/ipc-scripts/wayfire_socket.py +++ b/ipc-scripts/wayfire_socket.py @@ -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)