3 ms·
-- In AppleScript while I wait for tea to steep... if application "Terminal" is frontmost then tell application "Terminal" get name of first item of
by GHFigs 18y ago
-- In AppleScript while I wait for tea to steep...
if application "Terminal" is frontmost then
tell application "Terminal"
get name of first item of windows of it
if result contains "ssh" then
set red to false
set yellow to true
set green to false
end if
end tell
end if
-- or a one-liner...
if application "Terminal" is frontmost then tell application "Terminal" to ¬
if (name of first item of windows of it contains "ssh") then set stoplight to "yellow"
- jrockway 18y agoThis is even easier with a window manager like Xmonad, since you can configure it to "log" state changes. No polling necessary.