Alfred extension or equivalent that brings a single window to the forefront
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
If you have the full Alfred version, then you can map hotkeys to application launching and switching.
For example, as you see on the screen I've mapped option-1 for MacVim, option-2 for Chrome, etc.
If the app is not running it will launch it but more importantly if the app is running but not focused, then it will simply switch to that app.
I hope that helps!