fix: let restore rescue windows left in sway's scratchpad

Nothing puts windows there any more, but a window parked by an older
classroom build — the exact case this work exists to fix — would
otherwise be invisible to restore and stranded until the next reboot.
Counting the scratchpad as hidden means the Browser button and
Super+Shift+M both pull it back, tiled.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
ekklesia
2026-09-04 17:13:51 -05:00
co-authored by Claude Opus 5
parent aed4d9737d
commit 36100ad40c
2 changed files with 10 additions and 3 deletions
+8 -3
View File
@@ -18,6 +18,11 @@ import sys
HIDDEN_WORKSPACE = "__ekklesia_hidden"
# sway parks scratchpad windows on a workspace of its own. Nothing here
# puts them there, but treating it as hidden means a window left in the
# scratchpad by an older classroom build can still be restored.
HIDDEN_WORKSPACES = {HIDDEN_WORKSPACE, "__i3_scratch"}
STATE_DIR = os.path.join(
os.environ.get("XDG_RUNTIME_DIR") or "/tmp",
"ekklesia-classroom",
@@ -77,7 +82,7 @@ def collect(node, workspace, found):
"instance": properties.get("instance") or "",
"focused": bool(node.get("focused")),
"workspace": workspace,
"hidden": workspace == HIDDEN_WORKSPACE,
"hidden": workspace in HIDDEN_WORKSPACES,
}
)
@@ -119,11 +124,11 @@ def visible_workspace():
workspaces = query("get_workspaces") or []
for workspace in workspaces:
if workspace.get("focused") and workspace.get("name") != HIDDEN_WORKSPACE:
if workspace.get("focused") and workspace.get("name") not in HIDDEN_WORKSPACES:
return workspace.get("name")
for workspace in workspaces:
if workspace.get("visible") and workspace.get("name") != HIDDEN_WORKSPACE:
if workspace.get("visible") and workspace.get("name") not in HIDDEN_WORKSPACES:
return workspace.get("name")
return "1"