Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

after a other mac or macbook is connected with a mini display port to a new generation imac you can switch between the imac and the other connected mac pressing cmd+F2(brightness up) using the keyboard of the imac.

i connect my macbook to my imac, switch to the macbook and connect the bluetooth keyboard and mouse of my imac to my macbook.

after that i'm not able to switch back to my imac, because the keyboard is used on my macbook. i have a second mouse connected to my imac, so i'd would be cool to switch views and control my imac with my second mouse.

is it possible to send the shortcut cmd+F2 to my imac from my macbook? via command line or something? using apple script?

all ideas are welcome, thanks!

share|improve this question
Could you check e.g. System Preferences » Keyboard » Keyboard Shortcuts to see if you can change the Cmd-F2 shortcut? Not that it's important, but I'd love to see if Apple implemented that or how that shortcut is presented to a user. – Daniel Beck Dec 29 '10 at 14:31
up vote 0 down vote accepted

You could invoke the following AppleScript:

tell application "System Events"
    key code 122 using command down # Cmd-F2
end tell

for example, by SSH-ing into your iMac.

Execute a local script performing e.g. the SSH call on your Macbook using Butler, LaunchBar, Alfred, Quicksilver, Keyboard Maestro, or any of the other, similar tools, or simply the Services menu/Automator.

(Key code from here)

share|improve this answer
okay, you mean i should store this code in a .scpt. how do i run this script? i know how to ssh into my imac, but how tu run it? – choise Dec 29 '10 at 14:44
@choise Click the link "SSH-ing" and read that web page. – Daniel Beck Dec 29 '10 at 14:46
seems working. but i need "brightness up", not f2... seems not the same. can't figure out the right keycode. google isnt helping me =/ – choise Dec 29 '10 at 16:28
@choise You mean Fn-F2, not Cmd-F2? – Daniel Beck Dec 29 '10 at 16:38
if i press f2(brightness) my brightness increases. and i want "cmd"+"increase brightness" . fn+f2 is real f2 on my mac – choise Dec 29 '10 at 17:11

Your Answer


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.