1

I would like to use a single keyboard shortcut to focus on multiple applications in Slate. For example, I want to map Command+1 to Chrome and Firefox. Each time I press Cmd+1 the focused application should rotate. Is this possible? If so, how can I do this?

bind 1:cmd focus 'Chrome'
bind 1:cmd focus 'Firefox'

1 Answer 1

1

For example save this script as ~/bin/chromeorfirefox and make it executable:

#!/bin/bash
if [[ $(lsappinfo visibleprocesslist|cut -d\" -f2) = Google\ Chrome ]]; then
  open -a Firefox
else
  open -a Google\ Chrome
fi

Then add

1:cmd shell '~/bin/chromeorfirefox'

to ~/.slate.

lsappinfo was added in 10.9. You can use a script like this in 10.8 and earlier:

#!/usr/bin/osascript
if (path to frontmost application) is (path to application "Google Chrome") then
    "Firefox"
else
    "Google Chrome"
end if
tell application result
    reopen
    activate
end tell

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .