Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On my macbook air, the F5 key is un-assigned. So in Sparrow I set that key to hide/show Sparrow. Basically I have a dedicated F key to look at my inbox then hide it again to go back to my work.

My question is: How can I re-assign F3 (expose) or F4 (dashboard) or even F12 (eject) to show/hide other apps like Skype, Adium, or VLC?

Sparrow's preferences allowed me to assign a key. Is there an applescript I can write or a Mac System Preferences setting I can manipulate to achieve this goal? I'm open to 3rd-party software, preferably one that doesn't require being in the dock or menubar.

EDIT: I found a handy program FunctionFlip that only changes some of the function keys to their original state. I then found a launcher, Alfred, that I can assign keys to. Thanks to @slhck for the inspiration!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

If you want to re-assign system keys such as F3 or F4, you first need to go to  » System Preferences » Keyboard Shortcuts, then check the following option:

Use all F1, F2, etc. keys as standard function keys

Now you're ready to go.

This page gives you lots of AppleScripts to toggle the visibility of apps. Here's one that should work:

set appName to "Skype"
set needsActivation to false
tell application "System Events"
    if frontmost of process appName then
        set visible of process appName to false
    else
        set needsActivation to true
    end if
end tell

if needsActivation then
    tell application appName to activate
end if

You could then use any third party launcher to open it. Spark comes to mind. You can paste the script from above as-is and use F5 as the hotkey:

Rinse and repeat for other applications!

share|improve this answer
    
I can't seem to override the keys that are normally used for expose and dashboard –  victoroux May 1 '12 at 17:06
    
If you go to System Preferences, in Keyboard, check Use all F1, F2, etc. keys as standard function keys. This way, they won't interfere, and you'll be able to assign them. –  slhck May 1 '12 at 17:16
    
I didn't want to go through all the work of assigning the rest of the F keys back so I installed FunctionFlip. And I'm using Alfred to launch things as you suggested a third party (Spark wasn't working well on my system). Thank you so much :) –  victoroux May 1 '12 at 17:51
    
Glad you got it working, you're welcome! –  slhck May 1 '12 at 17:55

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.