-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclose_workspaces
More file actions
executable file
·45 lines (39 loc) · 1.54 KB
/
close_workspaces
File metadata and controls
executable file
·45 lines (39 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/osascript
on run argv
-- Optional: specify which workspaces to close
set workspacesToClose to {}
if (count of argv) > 0 then
set workspacesToClose to argv
else
-- Default workspace names if none specified
set workspacesToClose to {"bugs", "medium", "quick"}
end if
tell application "Terminal"
set windowsClosed to 0
set windowList to ""
-- Iterate through all windows
repeat with w in windows
try
-- Get the custom title of the window
set windowTitle to custom title of selected tab of w
-- Check if this window belongs to one of our workspaces
repeat with workspace in workspacesToClose
-- Check if title contains workspace name (handles "bugs - Server", "bugs - Claude", etc.)
if windowTitle contains workspace then
set windowList to windowList & " - " & windowTitle & "\n"
close w
set windowsClosed to windowsClosed + 1
exit repeat
end if
end repeat
on error
-- Window might not have a custom title, skip it
end try
end repeat
if windowsClosed > 0 then
return "Closed " & windowsClosed & " windows:\n" & windowList
else
return "No workspace windows found to close"
end if
end tell
end run