Right now, if I want to switch to a Sublime Text 2 window open to a "project" called foo
, I can do option+space
, type Sub hit enter and then hit cmd+`
repeatedly until I arrive at the window I want.
Is there any way to manipulate this in Alfred, or using any other shortcut so that I can simply type the name of an open window to switch to?
I tried writing an AppleScript, but once I got part of the way done, I realized there is no way for me to communicate this list back to Alfred to make a selection:
on alfred_script(q)
tell application "System Events"
set procs to processes
set windowTitles to {}
repeat with proc in procs
try
if exists (window 1 of proc) then
repeat with w in windows of proc
if w's title is not "" then
set titlename to proc's name & " — " & w's title as Unicode text
if q is in titlename is not false
copy titlename to the end of windowTitles
end if
end if
end repeat
end if
end try -- ignore errors
end repeat
end tell
return windowTitles
end alfred_script