mirror of
https://github.com/caelestia-dots/cli.git
synced 2026-06-05 23:09:27 -05:00
pip: use batch request
This commit is contained in:
@@ -29,8 +29,10 @@ class Command:
|
||||
off = min(mon["width"], mon["height"]) * 0.03
|
||||
move_to = f"{int(mon['x']) + int(mon['width'] - off - width * scale_factor)} {int(mon['y']) + int(mon['height'] - off - height * scale_factor)}"
|
||||
|
||||
hypr.dispatch("resizewindowpixel", "exact", f"{scaled_win_size},address:{address}")
|
||||
hypr.dispatch("movewindowpixel", "exact", f"{move_to},address:{address}")
|
||||
hypr.batch(
|
||||
f"dispatch resizewindowpixel exact {scaled_win_size},address:{address}",
|
||||
f"dispatch movewindowpixel exact {move_to},address:{address}",
|
||||
)
|
||||
|
||||
def daemon(self) -> None:
|
||||
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock:
|
||||
|
||||
@@ -27,3 +27,9 @@ def message(msg: str, json: bool = True) -> str | dict[str, any]:
|
||||
|
||||
def dispatch(dispatcher: str, *args: list[any]) -> bool:
|
||||
return message(f"dispatch {dispatcher} {' '.join(map(str, args))}".rstrip(), json=False) == "ok"
|
||||
|
||||
|
||||
def batch(*msgs: list[str], json: bool = False) -> str | dict[str, any]:
|
||||
if json:
|
||||
msgs = (f"j/{m.strip()}" for m in msgs)
|
||||
return message(f"[[BATCH]]{';'.join(msgs)}", json=False)
|
||||
|
||||
Reference in New Issue
Block a user