allow batch commands
This commit is contained in:
parent
6207a5616f
commit
f7307f3ef2
2 changed files with 13 additions and 4 deletions
|
@ -31,7 +31,12 @@ async def hyprctl(command):
|
|||
if DEBUG:
|
||||
print(">>>", command)
|
||||
ctl_reader, ctl_writer = await asyncio.open_unix_connection(HYPRCTL)
|
||||
ctl_writer.write(f"/dispatch {command}".encode())
|
||||
if isinstance(command, list):
|
||||
ctl_writer.write(
|
||||
f"[[BATCH]] {' ; '.join('dispatch ' + c for c in command)}".encode()
|
||||
)
|
||||
else:
|
||||
ctl_writer.write(f"/dispatch {command}".encode())
|
||||
await ctl_writer.drain()
|
||||
resp = await ctl_reader.read(100)
|
||||
ctl_writer.close()
|
||||
|
|
|
@ -17,12 +17,16 @@ class Extension(Plugin):
|
|||
for mon in await hyprctlJSON("monitors")
|
||||
if mon["name"] != monitor_id
|
||||
)
|
||||
workspaces = [w["id"] for w in await hyprctlJSON("workspaces") if w["id"] > 0]
|
||||
|
||||
for n in self.workspace_list:
|
||||
batch: list[str] = []
|
||||
for n in workspaces:
|
||||
if n in busy_workspaces or n == workspace_id:
|
||||
continue
|
||||
await hyprctl(f"moveworkspacetomonitor {n} {monitor_id}")
|
||||
await hyprctl(f"workspace {workspace_id}")
|
||||
batch.append(f"moveworkspacetomonitor {n} {monitor_id}")
|
||||
batch.append(f"workspace {workspace_id}")
|
||||
|
||||
await hyprctl(batch)
|
||||
|
||||
async def run_change_workspace(self, direction: str):
|
||||
increment = int(direction)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue