Revert "Every workspace split into real panes: 19 panes across 7 workspaces, one program per panel"

This reverts commit 32fa2752af.
This commit is contained in:
2026-11-10 16:40:14 +11:00
parent 32fa2752af
commit 851a15be74
19 changed files with 58 additions and 972 deletions

View File

@@ -133,51 +133,30 @@ def open_pane(name, workspace_name, cwd, command, session=None, adopt_existing=F
def arrange(order, session=None):
"""Put these panes on their workspaces, in this order, and name the workspaces.
"""Put these panes on workspaces 1..N in this order, and name the workspaces.
`order` is a list of (pane name, workspace name). Panes that name the same
workspace are put in that same workspace, so one workspace can hold several
panes. Workspaces are numbered in the order they first appear.
`order` is a list of (pane name, workspace name) pairs. The pane keeps its
own name; the workspace gets the name a person reads on the rail.
TUIOS numbering follows the order panes land in, and closing panes renumbers
the rest, so a rebuild can scatter the pages. Moving each pane once, at the
end, is what makes the rail readable and stable.
"""
names = []
for _pane, workspace in order:
if workspace not in names:
names.append(workspace)
moved = []
for number, workspace in enumerate(names, start=1):
for pane, ws in order:
if ws != workspace:
continue
win = next((w for w in windows(session) if (w.get("custom_name") or "") == pane), None)
if win is None:
continue
if win.get("workspace") != number:
subprocess.run(
["tuios", "move-window", str(number), "-w", win["window_id"], "-s", session or SESSION],
capture_output=True, text=True, timeout=30, check=False,
)
for number, (pane, workspace) in enumerate(order, start=1):
win = next((w for w in windows(session) if (w.get("custom_name") or "") == pane), None)
if win is None:
continue
if win.get("workspace") != number:
subprocess.run(
["tuios", "move-window", str(number), "-w", win["window_id"], "-s", session or SESSION],
capture_output=True, text=True, timeout=30, check=False,
)
_name_workspace(number, workspace, session)
moved.append((number, workspace))
return moved
def new_window(name, workspace_number, cwd, command, session=None):
"""Create one pane in a workspace that has already been claimed."""
subprocess.run(
[
"tuios", "new-window", name,
"-s", session or SESSION,
"--workspace", str(workspace_number),
"--cwd", cwd,
"--no-focus", "--keep-open",
"--", "/bin/sh", "-c", command,
],
capture_output=True, text=True, timeout=60, check=False,
)
return name
def close_pane(name, session=None):
for w in windows(session):
if (w.get("custom_name") or "") == name: