Jump to content
Flirc Forums

Apple keyboard Eject button


Recommended Posts

My mac mini is using the wake/suspend button under Computer Media Keys in the GUI to put to sleep,
which works kinda odd, there's 3 outcomes randomly happening once the button recorded on remote is pressed.

  1. No response
  2. immediate sleep (the one i want)
  3. jumps out the window asking either sleep, shutdown, cancel, restart.

Therefore I was trying to get it record it by using flirc_util, but I can't find the USB HID code for the eject button.
option+command+eject is what always work to put my computer to sleep.

Does anyone know how to find this particular value?  I tried a two values of eject from here.
But they all recorded as !.( I checked what's recorded with flirc_util keys.

Link to comment
Share on other sites

You can record Eject button with

flirc_util record_api 184 102

But you won't be able to add modifier keys to it because this is not a key from HID Keyboard usage table (only keys from that table support modifier keys). Because of that this key will act ONLY as an Eject for your DVD drive.

I think that Mac keyboard's controller (inside the keyboard) doesn't send an Eject code when you press option+command+eject, but it sends something else. Maybe it's just a standard Sleep code. Try recording a Sleep button using that command

flirc_util record_api 50 102


Link to comment
Share on other sites

  • 3 weeks later...

Hey sorry for the long reply, just came back from a trip

I did more testing,
I don't have a dvd drive on hand that I can test with recording eject button.  Will try once I have access to it.

But for 

flirc_util record_api 50 102

It works just like using the GUI to set a sleep.
If I clear the flirc mapping and record a button with sleep, the first time I press the button will put the machine to sleep like what it is intended.
But after waking it up, by pressing it once no longer works, need to keep pressing it for a few seconds and the prompt window like scenario 3 I mentioned in post 1 will jump out.
I can record enter(return) and tab(shift tab) to navigate the prompt for now, however it isn't very elegant way in my opinion.

I will keep trying other workarounds and report back.  thank you for the help.

Edited by Cayprol
Link to comment
Share on other sites

@Cayprol in my opinion it's more an issue with OS than with Flirc itself. Flirc just sends a key press according to a HID standard. It's up to the system to interpret it and act on it. Maybe there's some setting in the Mac OS itself you need to change.

I don't know Mac OS. Maybe @jason will know something, but he's currently heavily preoccupied with his family matters (mostly by new baby).

Link to comment
Share on other sites

Again really appreciate your help, I think the same, that it has mostly do to the OS.

However, I use some work around by using the built-in program automator in macOS.
Steps as following
1. Open Automator in the Application/Utility
2. Select Service at the template menu(open up the app will prompt)
3. On the side menu, select Utilities -> Run Shell Script 
4. type in "pmset sleepnow" no quotes. set Service receives as no input and in any application.
5. save and give it a name.
6. go to service app and keyboard find it under shortcut tab and under service, should be able to find the name in the last step, assign it a shortcut
7. Record assigned shortcut by Flirc, I use command+shift+option+S.  It works perfectly, upon press, it sleeps right away.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...