Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Mapping volume and eject keys to 3rd-party keyboard Other Hardware
If you have a keyboard that does not have eject and volume controls natively (like Das Keyboard), you can map them using KeyRemap4MacBook (it works for more than MacBook though!). This is kernel level mapping, so the keys act native, contrary to solutions provided by Quicksilver or Spark.

Download and install KeyRemap4Macbook. Despite the name, it works for any Mac, not just the Macbook.

You can search through the preferences and see if any of the built-ins work for you. I chose to do my mappings manually, as it allows you to map any key to any key.

Open up your private.xml through the "Misc & Uninstall" tab of KeyRemap4Macbook. The following code maps Insert, Home, and Pageup to Volume Down, Up, and Mute respectively. Those keys are pretty useless anyway, so you probably won't miss them. If you wanted to map them to something else, you can do that here. If you want syntax on different keys, you can find them documented here:


Here's the code:
<?xml version="1.0"?>
      <name>Volume Keys</name>
      <appendix>Up, Down, Mute</appendix>
      <autogen>--KeyToConsumer-- KeyCode::PC_INSERT,         ConsumerKeyCode::VOLUME_DOWN</autogen>
      <autogen>--KeyToConsumer-- KeyCode::HOME,              ConsumerKeyCode::VOLUME_UP</autogen>
      <autogen>--KeyToConsumer-- KeyCode::PAGEUP,            ConsumerKeyCode::VOLUME_MUTE</autogen>
I mapped PrintScreen to Eject (which is also available as a built-in option). If you wanted to map a different key to Eject, this is the following syntax.
<autogen>--KeyToConsumer-- KeyCode::PC_PRINTSCREEN, ConsumerKeyCode::EJECT</autogen>
Let me finish by stating that this is very powerful software, and it is capable of much more. For instance, I have it do my Dvorak layout remappings, so to user level programs my keyboard looks like a standard QWERTY. This allows for greater compatibility throughout the system. Often, non-QWERTY layouts got tripped up by Java or Carbon apps. With this program, you should have no issues. If you use a non-standard keyboard layout, look into this program!

[crarko adds: I haven't tested this one.]
  • Currently 5.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)

Mapping volume and eject keys to 3rd-party keyboard | 5 comments | Create New Account
Click here to return to the 'Mapping volume and eject keys to 3rd-party keyboard' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Mapping volume and eject keys to 3rd-party keyboard
Authored by: bglnelissen on May 19, '11 08:14:36AM

KeyRemap4MacBook does a nice job.

I was remapping my keys because of some issues with the right sided shift key that was stuck. I opened the machine (new plastic macbook) to try get out the keyboard to see what was wrong but unfortunately I did not have the proper screwdrivers and therefor could not take out the keyboard. This was when I thought of remapping the right shift key.

In search for remapping software i found out that the Left and Right shift key have the same 'key code', the system sees both keys as the same. So I had to disable them both. I tried 'Ukelele' but I could not got it to remap the shift key. Than i tried 'KeyRemap4MacBook' which did a nice job. I remapped another (unused) key to the shift key.

Oh, by the way, booting with your shiftkey down gets you in 'Save Mode'. Very annoying when the key is stuck... Holding down the esc key just after the chime will prevent this and will give you a normal boot.

Edited on May 19, '11 08:15:49AM by bglnelissen

[ Reply to This | # ]
Mapping volume and eject keys to 3rd-party keyboard
Authored by: Anonymous on May 19, '11 10:24:58AM

Very good info. Thanks.

KeyRemap4MacBook looks like it would be very handy all round. There's a 10.5 version, which I hope means it's PPC -- my old PowerBook is still very useful, and with this I could remap [`~] to shift, and the top-left [] to `~. No hope for the Return key and [\|] though...

Which idiot designed the UK keyboard anyway? Just print the sign next to #, and next to @ and be done with it, reducing costs along the way.

[ Reply to This | # ]
Mapping volume and eject keys to 3rd-party keyboard
Authored by: milkmage on May 19, '11 04:46:20PM

I have a DAS, and F12 just works (MacPro), option or ctrl (i forget) +F12 will eject the second optical drive if you have one.

not sure if there are volume equivalents though. I'll have to try this when I get home.

[ Reply to This | # ]
Mapping volume and eject keys to 3rd-party keyboard
Authored by: ivan_liao on May 21, '11 12:05:53AM

I also use a Cherry switcher keyboard after my G5 keyboard is retired, and I found a perfect way to remap the keys.

I modify private.xml instead of checkbox.xml, the benefit is I can also enable "Don't remap Apple's keyboards" and "Don't remap Apple's pointing devices" that provided by checkbox.xml.

I remap PC_Application key as Eject, and remap PC_PrintScreen/PC_ScrollLock/PC_Pause as Volume_Down/Volume_Up/Mute.

I use PC_Application as Eject, so that I can easier press WIN_R+ALT_R+APP to let my MAC sleep, because all these 3 keys are together.

Here is my code:
~/Library/Application\ Support/KeyRemap4MacBook/private.xml

<?xml version="1.0"?>
<name>Volume and Eject Keys</name>
<appendix>Up, Down, Mute, Eject</appendix>
<autogen>--KeyToConsumer-- KeyCode::PC_PRINTSCREEN, ConsumerKeyCode::VOLUME_DOWN</autogen>
<autogen>--KeyToConsumer-- KeyCode::PC_SCROLLLOCK, ConsumerKeyCode::VOLUME_UP</autogen>
<autogen>--KeyToConsumer-- KeyCode::PC_PAUSE, ConsumerKeyCode::VOLUME_MUTE</autogen>
<autogen>--KeyToConsumer-- KeyCode::PC_APPLICATION, ConsumerKeyCode::EJECT</autogen>

[ Reply to This | # ]
Mapping volume and eject keys to 3rd-party keyboard
Authored by: jmac05r1 on Jul 03, '12 08:23:29PM

Thanks Ivan! Very nice!

Although I wanted to map to some different keys and I was looking for /Library/org.pqrs/KeyRemap4MacBook/prefpane/checkbox.xml which there is no file "org.pqrs"?? Any can help with this?

This software is a little overkill for just wanting volume keys on my daskeyboard.

Is there anything lighter weight?


[ Reply to This | # ]