Project and Repair workspaces; adoption keeps the person's own pane; truncation fix

This commit is contained in:
Sam
2026-11-10 14:28:18 +11:00
parent 031073fc46
commit c9a1a61cba
15 changed files with 910 additions and 23 deletions

View File

@@ -46,6 +46,8 @@ def pages(cfg, folder):
("work", "work", "%s -screen work -folder %s" % (shlex.quote(bin_path), shlex.quote(folder))),
("reply", "reply", "%s -screen reply -issue %s" % (shlex.quote(bin_path), task)),
("new", "new", "%s -screen new -project %s" % (shlex.quote(bin_path), proj)),
("project", "project", "%s -screen project -folder %s" % (shlex.quote(bin_path), shlex.quote(folder))),
("repair", "repair", "%s -screen repair -folder %s" % (shlex.quote(bin_path), shlex.quote(folder))),
]

Binary file not shown.

View File

@@ -100,19 +100,24 @@ def open_pane(name, workspace_name, cwd, command, session=None, adopt_existing=F
the pane that keeps the workspace alive.
"""
ws = claim(workspace_name, session)
# A pane that was already in this workspace before us is the one to keep:
# it is the person's own shell, and it is what stops the workspace being
# deleted. Only when the workspace is empty do we make a new one, and only
# then does a name match matter.
if adopt_existing:
existing = [w for w in windows(session) if w.get("workspace") == ws]
if existing:
w = existing[0]
if (w.get("custom_name") or "") != name:
subprocess.run(
["tuios", "set-window", "-w", w["window_id"], "--name", name,
"-s", session or SESSION],
capture_output=True, text=True, timeout=30, check=False,
)
return "adopted", w["window_id"], ws
for w in windows(session):
if (w.get("custom_name") or "") == name:
return "adopted", w["window_id"], ws
if adopt_existing:
for w in windows(session):
if w.get("workspace") == ws:
if not (w.get("custom_name") or ""):
subprocess.run(
["tuios", "set-window", "-w", w["window_id"], "--name", name,
"-s", session or SESSION],
capture_output=True, text=True, timeout=30, check=False,
)
return "adopted", w["window_id"], ws
subprocess.run(
[
"tuios", "new-window", name,