-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_terminals
More file actions
executable file
·35 lines (29 loc) · 1003 Bytes
/
list_terminals
File metadata and controls
executable file
·35 lines (29 loc) · 1003 Bytes
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
#!/usr/bin/osascript
tell application "Terminal"
set windowList to ""
set windowCount to count of windows
repeat with i from 1 to windowCount
set w to window i
set windowInfo to "Window " & i & ": "
-- Try to get custom title
try
set customTitle to custom title of selected tab of w
set windowInfo to windowInfo & "\"" & customTitle & "\""
on error
set windowInfo to windowInfo & "(untitled)"
end try
-- Add tab count
set tabCount to count of tabs of w
set windowInfo to windowInfo & " [" & tabCount & " tab"
if tabCount is not 1 then
set windowInfo to windowInfo & "s"
end if
set windowInfo to windowInfo & "]"
set windowList to windowList & windowInfo & "\n"
end repeat
if windowCount is 0 then
return "No Terminal windows open"
else
return windowList
end if
end tell