Author Topic: Code to get Mac OS X Media keys working?  (Read 3812 times)

0 Members and 1 Guest are viewing this topic.

Offline Pyrolistical

  • Thread Starter
  • Posts: 60
  • Location: Vancouver, Canada
Code to get Mac OS X Media keys working?
« on: Fri, 13 January 2012, 04:38:18 »
Has anybody been successful in creating a custom Mac keyboard where the media keys work?

And when I say media keys I exclude the volume control, as they are just normal scan codes.

The functions in question are:
F1 decrease display brightness
F2 increase display brightness
F3 Expose
F4 Gadgets
F5 decrease keyboard backlight
F6 increase keyboard backlight
Fn + "backspace" is "delete"
Fn + Left Arrow is Home
Fn + Up Arrow is Page Up
Fn + Right Arrow is End
Fn + Down Arrow is Page Down

I know the rest are not just scan code and requires kext to enable them, but has anybody been able to do that?  Did it just pretend to be an Apple keyboard to enable the AppleUSBTCKeyboard.kext?

Are there any non Apple keyboard out there that have successfully implemented this in a commercial product?

Offline canthonytucci

  • Posts: 32
Code to get Mac OS X Media keys working?
« Reply #1 on: Sat, 14 January 2012, 07:15:12 »
Have you tried keyremapformacbook ? I will take a look today and see if I cant get it working.
[SIGPIC][/SIGPIC]

Offline canthonytucci

  • Posts: 32
Code to get Mac OS X Media keys working?
« Reply #2 on: Sat, 14 January 2012, 11:56:32 »
I got expose (well, mission control at least, I am running Lion) and dashboard widgets to work just using the built in Keyboard Shortcuts preference pane. I was able to map them to function keys and activate them on my HHKB, did not try with any other boards. I tried mapping a range of keys to brightness up/down but none would have any effect on my apple external monitor (while the apple aluminium keyboard changes screen brightness on this one just fine) there is a cat sleeping on top of the laptop right now who does not like to be moved, so I cant check if it does it on the internal screen, but when he moves I can try.

a very expensive cat bed indeed, I think he likes it because it is warm.
[SIGPIC][/SIGPIC]

Offline Pyrolistical

  • Thread Starter
  • Posts: 60
  • Location: Vancouver, Canada
Code to get Mac OS X Media keys working?
« Reply #3 on: Sun, 15 January 2012, 12:07:34 »
That's a great idea.  I think that should work for all cases

Offline wasdkeyboards

  • * Commercial Vendor
  • Posts: 59
Code to get Mac OS X Media keys working?
« Reply #4 on: Mon, 16 January 2012, 18:32:21 »
A customer of mine remapped a his keyboard with Keyremapformacbook Link

Scroll all the way down for the script he used.
Questions and comments, please visit our Geekhack: WASD Keyboards Vendor Forum
WASDKeyboards.com - Custom Mechanical Keyboards

Offline SmallFry

  • ** Moderator Emeritus
  • Posts: 3887
  • Location: Wisconsin, USA
  • Leaving 6/15; returning 6/22 or so.
Code to get Mac OS X Media keys working?
« Reply #5 on: Mon, 16 January 2012, 19:05:42 »
This got me excited... However, when I put the script into Keyremapformacbook, it did not preform...Is this because of my mac being an iMac or because the script is not what I was expecting?

Offline Architect

  • Posts: 254
  • TECK Lover
Code to get Mac OS X Media keys working?
« Reply #6 on: Mon, 16 January 2012, 19:27:16 »
TrulyErgonomic keyboards support them, well not all, for some reason only the higher ones seems to work. At any rate check out the key codes at the end of the manual
TECK 209 Blank Keys; Leopold Number Pad; X-Keys Professional; X-Keys 84.

Offline SmallFry

  • ** Moderator Emeritus
  • Posts: 3887
  • Location: Wisconsin, USA
  • Leaving 6/15; returning 6/22 or so.
Code to get Mac OS X Media keys working?
« Reply #7 on: Tue, 17 January 2012, 14:14:46 »
I got it to work on my Mac (Snow Leopard 10.6.8; there is separate Lion settings). I also made it so that the Apple Bluetooth Keyboard would not be affected.
I did so with these settings:
[ Attachment Invalid Or Does Not Exist ] 37807[/ATTACH]
You also need to go into the Keyboard section of your system settings and set this:
[ Attachment Invalid Or Does Not Exist ] 37809[/ATTACH]
^^^ALL OF THIS ABOVE IS REQUIRED TO GET THE MEDIA KEYS JUST LIKE THE APPLE BLUETOOTH KEYBOARD^^^
Also, just to be a bit more like a regular keyboard I swapped the USB Keyboard Modifiers like this(NOT Necessary to get the Media Keys):
[ Attachment Invalid Or Does Not Exist ] 37810[/ATTACH]
Have fun with it. Finally, if anyone gets their Eject key bound to Pause/Break please tell me how.

Offline Yeitso

  • Posts: 10
  • Location: Sweden
Re: Code to get Mac OS X Media keys working?
« Reply #8 on: Thu, 05 March 2015, 02:56:09 »
with this ive been able to fix media keys :)

https://gist.github.com/NoobsArePeople2/5121597

Offline KHAANNN

  • Posts: 1660
Re: Code to get Mac OS X Media keys working?
« Reply #9 on: Thu, 05 March 2015, 15:33:52 »
with this ive been able to fix media keys :)

https://gist.github.com/NoobsArePeople2/5121597
You can also do these without any software overriders

You can create them from the Automator as Service's, then add shortcuts to those Service's

On the other hand I'm very tempted to just use Karabiner and get it over with, but I'm against utilities/programs that require admin permissions / modify the system, although Karabiner seems very very very solid, also it's open source, I'm very tempted ...
Endgame | 1.25 Cmd for GMK Sets Please | Or Just 1.25 Blanks Like The Good Old Days