Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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
share|improve this question
add comment

2 Answers

If you have the full Alfred version, then you can map hotkeys to application launching and switching.

enter image description here

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!

share|improve this answer
add comment

Are you using Alfred v1? I know v2 is still in beta but it seems many have bought access. Anyways, with v1 the answer is no or it will be very hard if possible to search or filter your current windows by title. Using Alfred v2 however it would be much easier and definitely possible as you can feed all those window titles back for Alfred v2 to display... allowing you to then filter and choose the window you want.

Sorry this really isn't an answer or solution. If your on v2, let us know...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.