pkamb/PowerKey

OS X 10.9 Mavericks compatibility

pkamb opened this issue · 64 comments

In OS X 10.9 Mavericks, the computer goes to sleep immediately when the power button is pressed. PowerKey still sends your replacement keypress, but does not prevent the Sleep function.

OS X Mavericks: Using the power button
Learn how the power button works in OS X Mavericks.

  1. Tap the power button in Mavericks to put your Mac to sleep or to wake it up.
  2. Press and hold the power button for 1.5 seconds, to bring up additional options.
  3. Hold down the power button for 5 seconds to force the computer to turn off.

PowerKey no longer blocks the 1st item on the list, a quick press of the power key. Need to support/block the new Mavericks interactions.

EDITED WITH THE SOLUTION BELOW

(Note that this issue has been corrected in OS X 10.10 El Capitan and later versions. This fix is only needed if you're running Mavericks)

Additional steps for OS X 10.9 Mavericks

OS X 10.9 introduced new behavior for the Power key:

  • Tap the power button once to put your Mac to sleep.
  • Tap the power button again to wake your Mac.

In the 10.9.2 update, Apple made this behavior configurable:

defaults write com.apple.loginwindow PowerButtonSleepsSystem -bool NO

To disable this immediate Sleep behavior and make the Power key usable with PowerKey:

  1. Update OS X to version 10.9.2 or greater.
  2. Open Terminal.
  3. Run the command: defaults write com.apple.loginwindow PowerButtonSleepsSystem -bool NO
  4. Log out of your OS X account, then log back in.
  5. Run PowerKey.app; pressing the key will now not immediately put your Mac to sleep.

type == NSSystemDefined
keyCode == NX_POWER_KEY
subtype == NX_SUBTYPE_AUX_CONTROL_BUTTONS

The power key sends two NSSystemDefined events. In 10.8, the event above seemed to be no-op; the other power key event triggered the "Restart/Sleep/ShutDown" dialog.

In 10.9, the event above now seems to trigger an immediate Sleep function.

Killing the event by returning CGEventCreate(NULL) does not work.

Command + Power does not trigger Sleep in 10.9; one possible solution would be to somehow activate the Command modifier while/before power is pressed. Still investigating.

do i have to compile it in xcode to make it work? I don't know how to do that. I always accidentally hit the power key... I need to disable it somehow. I never use it unless the computer crashes.

@mellenger Are you using OS X 10.9? Mavericks has unfortunately broken PowerKey.app, still looking for a fix.

It will work correctly in 10.8.

But no, you shouldn't have to compile via Xcode for the app to work. You can find the zipped .app file on the Releases page.

Oh okay. The power button is really annoying me. In mavericks it sleeps the
computer instantly.

On Sunday, November 3, 2013, Peter Kamb wrote:

@mellenger https://github.com/mellenger Are you using OS X 10.9?
Mavericks has unfortunately broken PowerKey.app, still looking for a fix.

It will work correctly in 10.8.

But no, you shouldn't have to compile via Xcode for the app to work. You
can find the zipped .app file on the Releaseshttps://github.com/pkamb/PowerKey/releasespage.


Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-27653296
.

Andrew Mellenger
mellenger interactive
(604) 765-0463

@mellenger http://bugreport.apple.com; hopefully we can get a System Preference to turn off the immediate sleep behavior in a Mavericks update.

this is the sort of thing that people will find a plist that can be overwritten or modified isn’t it? I just want it to do nothing unless i hold it down for 4 seconds.

Andrew Mellenger
Mellenger Interactive Ltd.
(604) 765-0463

On Nov 3, 2013, at 1:29 PM, Peter Kamb notifications@github.com wrote:

bugreport.apple.com; hopefully we can get a System Preference to turn off the immediate sleep behavior in a Mavericks update.


Reply to this email directly or view it on GitHub.

Would really appreciate a fix for this, though I understand it's not easy - was quite dependent on this working and have a new Macbook with Mavericks. Now pressing this button several times a day...

Hi @RichVel, would you mind filing a bug report asking for a System Preference to turn off the "immediate sleep" behavior? Lets get it on Apple's radar. Thanks!

On reedit someone came up with a way to change the behaviour of the power button. Maybe this can somehow help to resolve the issue?

@stroebjo Thanks for the link!

I applied the fix you mentioned, but my screen still goes black and brings me to the OS X login screen when I press the power key. I'm not sure if it's technically "sleeping" any more, but the behavior is essentially the same. Is that what you're getting as well?

Yes, I have the same result as you. Thought it would maybe provide some further insight to the issue. Lets hope that maybe someone can extend this to a complete working fix!

Notes from the creator of that fix:


https://developer.apple.com/library/mac/qa/qa1264/_index.html

Q: I need to do remote debugging on a Mac computer which is hung in the kernel. How do I interrupt this system so I can attach to it from a kernel debugging session?

A: If OS X is started with the DB_NMI bit set in the debug boot argument, momentarily pressing the system's power button will generate a non-maskable interrupt instead of sleeping or waking the system.

Note: Starting with OS X v10.9, one must hold down both the left and right command keys while pressing the power button. This helps to prevent accidental activation.
Important: The interrupt that is generated by the power button technically is not an NMI but an ACPI System Control Interrupt (SCI). Practically speaking, this means that the power button will not interrupt a system while interrupts are disabled.


Note: Lower levels of the system trap and handle some events early in the event stream. These events are never routed to a Cocoa application. These events are generated by reserved keys or key combinations, such as the power and media-eject keys.
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventA

More from Reddit:

I'm tracking where the button triggers the black screen.

/System/Library/Extensions/AppleACPIPlatform.kext/Contents/PlugIns/AppleACPIButtons.kext/Contents/Info.plist

IOKit and powerd are also in charge.

<key>ACPI Power/Sleep Button</key> <dict> <key>CFBundleIdentifier</key>   

<string>com.apple.driver.AppleACPIButtons</string> <key>IOClass</key> <string>AppleACPIButton</string>   

<key>IONameMatch</key> <array> <string>PNP0C0C</string> <string>power-button</string>   

<string>PNP0C0E</string> <string>sleep-button</string> </array> <key>IOProviderClass</key>   

<string>IOACPIPlatformDevice</string> </dict>  

I'm gonna try to probe the USB internal keyboard to see where the power key event/interruption is caught up.
Let me know if you have made any progress.

More from Reddit:

.Op Fl getallowpowerbuttontosleepcomputer
.Op Fl setallowpowerbuttontosleepcomputer Ar on | off

Found this in:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/share/man/man8/systemsetup.8


rMBP:~ axel$ systemsetup -getallowpowerbuttontosleepcomputer
getAllowPowerButtonToSleepComputer: Error, this feature is not supported on this machine.
rMBP:~ axel$ systemsetup -setallowpowerbuttontosleepcomputer off
setallowpowerbuttontosleepcomputer: Error, this feature is not supported on this machine.

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/IOKit.framework/Headers/pwr_mgt/IOPM.h:  kIOPMPowerButton              = (1<<3),  // power button was pressed
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/IOKit.framework/Headers/pwr_mgt/IOPM.h:#define kIOPMSettingSleepOnPowerButtonKey           "Sleep On Power Button"
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/IOKit.framework/Versions/A/Headers/pwr_mgt/IOPM.h:  kIOPMPowerButton              = (1<<3),  // power button was pressed
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/IOKit.framework/Versions/A/Headers/pwr_mgt/IOPM.h:#define kIOPMSettingSleepOnPowerButtonKey           "Sleep On Power Button"
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/IOKit.framework/Versions/Current/Headers/pwr_mgt/IOPM.h:  kIOPMPowerButton              = (1<<3),  // power button was pressed
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/IOKit.framework/Versions/Current/Headers/pwr_mgt/IOPM.h:#define kIOPMSettingSleepOnPowerButtonKey           "Sleep On Power Button"
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Kernel.framework/Headers/IOKit/acpi/IOACPITypes.h:    kIOACPIFixedEventPowerButton   = 2,
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Kernel.framework/Headers/IOKit/pwr_mgt/IOPM.h:  kIOPMPowerButton              = (1<<3),  // power button was pressed
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Kernel.framework/Headers/IOKit/pwr_mgt/IOPM.h:#define kIOPMSettingSleepOnPowerButtonKey           "Sleep On Power Button"
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Kernel.framework/Headers/IOKit/pwr_mgt/RootDomain.h:#define kIOPMPowerButtonSleepKey            "Power Button Sleep"
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/acpi/IOACPITypes.h:    kIOACPIFixedEventPowerButton   = 2,
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/pwr_mgt/IOPM.h:  kIOPMPowerButton              = (1<<3),  // power button was pressed
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/pwr_mgt/IOPM.h:#define kIOPMSettingSleepOnPowerButtonKey           "Sleep On Power Button"
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/pwr_mgt/RootDomain.h:#define kIOPMPowerButtonSleepKey            "Power Button Sleep"
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Kernel.framework/Versions/Current/Headers/IOKit/acpi/IOACPITypes.h:    kIOACPIFixedEventPowerButton   = 2,
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Kernel.framework/Versions/Current/Headers/IOKit/pwr_mgt/IOPM.h:  kIOPMPowerButton              = (1<<3),  // power button was pressed
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Kernel.framework/Versions/Current/Headers/IOKit/pwr_mgt/IOPM.h:#define kIOPMSettingSleepOnPowerButtonKey           "Sleep On Power Button"
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Kernel.framework/Versions/Current/Headers/IOKit/pwr_mgt/RootDomain.h:#define kIOPMPowerButtonSleepKey            "Power Button Sleep"

FYI, I'm watching the efforts going on here to fix this problem, and silently (no longer) cheering you on!

Also, for this ridiculous behavior, I would applaud anyone for placing a flaming bag of poop on Apple's doorstep. Perhaps on top of a cardboard cutout of a "power key".

Looking forward to a fix/workaround, I've been accidentally shutting down my computer about 3 times a day because of this "feature" and half the time I have to hard reboot to get it to come back.

I've reported a bug in the "OS X" section and in the category "UI/Usability" with notes mentioning:

Please add a System Preference to turn off the "Immediate Sleep" behavior of the Power Key. Let your users customize their experience - it's one of the many reasons people love Apple.

Maybe for now the best thing to do is just keep submitting this as a bug at http://bugreport.apple.com

I've submitted it as bug 15542758 to Apple.

👍 @SkiBig3 and @clarkewd ! :)

(hope you linked to this thread. if not, you can update the ticket to do so. :)

apple just closed my ticket saying:

Engineering has determined that your bug report is a duplicate of another issue (14038979) and will be closed.

Looks like that bug report number is pretty low. Hopefully they will create a fix for it.

My bug was closed with the same duplicate:

Duplicate of 14038979 (Open)

Thanks for submitting the issue!

"Killing the event by returning CGEventCreate(NULL) does not work"

I have tried some other ways including
return NULL;
and
return nullEvent;

but no matter what I try there does not seem to be any way to kill the power key special system event in 10.9 Mavericks.

Has anyone else found a way?

Ah, thanks @OpConTech for nullEvent (and also kCGEventNull and NX_NULLEVENT I see).

But yes, the event tap strategy doesn't look like it's going to work in Mavericks. I just messaged the Reddit user (I pasted in some of his work above) to see if he figured anything out; it looked promising a month ago:

I think I have found a way to disable the short press event.
Will let you know later. :)

Duplicating the above bug reports is currently the best way to help!

Hi Peter,

I am pretty sure it is picking up the power key event tap in Mavericks.

I have a malfunctioning power key or something that causes the a system restart event if I stop using the keyboard for more than a minute. So I have been trying to use your app to kill the event. I compiled and ran PowerKey in Xcode 5. The only issues were the auto layout needed to be turned off.

I think in Mavericks, that Apple has not only changed the way the power key system event works but also made it somehow less "accessible" as an event. Seems like we can monitor it in Mavericks but can not kill it, or at least respond to it programatically.

Quite a few people seem to be unhappy with touching the power key and having no control over the computer going to sleep. It is interesting that Apple did not give control over the action of the power key in the settings. So your PowerKey is more useful than ever.

Best,

Tom

So is PowerKey fixing your automatic restart issue? That's good if so!

I don't think Apple has changed the "accessibility" of the events in Mavericks, but they have changed the order of the events when the power key is pressed.

Even in 10.8, for example, the Hold Power Key > Shut Down event can't be prevented. In 10.8 the event that spawned the Restart | Sleep | Cancel dialog could be killed, but in 10.9 the new default immediate sleep event cannot.

Apple changing the power key action to a user-defined setting via a 10.9 point update is probably the best hope unfortunately...

Yes I agree on all points.
Unfortunately i could not find a way to make the PowerKey kill the system restart.

Tom Neary
OpCon Technologies, Inc. | www.opcontech.comhttp://www.opcontech.com | Office: (415) 659-1841 | Mobile: (415) 517-7953 | tneary@opcontech.com

It seems Apple has precedent!

Apple II reset key

I clarified the two event types that are generated by the power key: 56e2e83

Not a great option for PowerKey, but have a look at this in-memory hack for loginwindow.app which at least changes the power button behaviour back to the pre-Mavericks default: https://github.com/binchewer/power_fixer

Blog post has more background.

I have tried RickVel's suggestion and I have my power key back to being a forward delete under 10.9. I am using the power_fixer (which disables the black screen and pops up the shutdown dialog immediately) and also running PowerBlock which blocks the dialog box and runs an applescript (which sends the delete). I hope that this helps, since I too rely heavily on PowerKey for my daily work machine.

Great to hear! Thanks for posting power_fixer. I'm testing it now and will hopefully cut a new release of PowerKey today with special directions for 10.9 users.

@Y0shiY0shi What app are you using to block the dialog? PowerBlock? You must have an older version of that app, as the current one locks out 10.9 users. I also found the slightly older PowerBlock Version 1.1 (6), which also isn't blocking the dialog. Which version are you using?

I wonder what method is being used to block the dialog. PowerKey's 10.8 method (killing the NX_SUBTYPE_POWER_KEY event) isn't working in 10.9; the dialog still pops up. That can however block the dialog when it is activated via Ctrl + Power.

I'm using PowerBlock Version 1.2 (7) which I've had for quite a while. Sometimes it pops up the dialog box, but It's intermittent and not very often. the applescript I have running is:

tell application "System Events"
keystroke (ASCII character 127)
end tell

to note, I am using a MBP from 2009 running 10.9. The power button is the round button in the top right. I have a new rMBP, but have not moved all my work files over and started using it because of the power button issue (it's effectively a paperweight). I will be trying to get the power button working on the new one tomorrow.

Hmm, I wonder if the old round Power button vs. the new Power key is the issue. Let me know if you're able to block the menu on your rMBP.

I installed power_fixer and PowerBlock 1.2 (7) on my rMBP today. I added in the applescript I linked above and the response is different than my old machine. Now, when I press the power key, it does show the dialog box the first time, but when I clear it and then click in some text field to edit a sentence, pressing power forward deletes text. The rate of deletion is not as fast, but does work without popping the shutdown box up. If you press it too many times quickly, the popup does show after about 4-5 seconds, but if you slow your rate, it does not. I've waited a while after and then clicked in a url to edit text and pressed power and the dialog box did not pop up. It is not solid by any means, but hopefully you can recreate this to investigate further.

Can you upload PowerBlock 1.2 (7) somewhere? Thanks.

EDIT: For reference, the current version on Irradiated Software's website is 1.2.1 (8), which intentionally quits when run under 10.9.

I haven't done compiling since college and am new to MacOS...do we have the capacity to compile power_fixer with built-in tools? or can someone post the compiled .dmg?

@draarong I'd open up an issue over at power_fixer: https://github.com/binchewer/power_fixer/issues

I believe you'll need Xcode (free download from the Mac App Store) to compile it.

This is Steve from Irradiated Software, I'm a little late to the conversation.
You can find PowerBlock 1.2 here:
http://www.irradiatedsoftware.com/downloads/PowerBlock_1.2.zip

But I haven't had any luck with power_fixer + PowerBlock to still prevent the dialog. It's possible there's hardware dependent behavior (I'm on a 2011 MBP).

Hi Steve, thanks for chiming in. I wasn't able get PowerBlock or PowerKey working with power_fixer either. Do you use a similar CGEventTap strategy to kill the events?

This is probably the issue to watch:
binchewer/power_fixer#4

Also, here's a thread on Reddit where binchewer shows how to disable the button completely. PowerKey isn't seeing any events after applying this fix:
http://www.reddit.com/r/apple/comments/1u5v5e/mavericks_power_button_fix/ceisg91

Yep, similar CGEventTap strategy.

I'll keep an eye on power_fix. If nothing else, it's an impressive workaround that may come in handy as Apple continues to lock us out of our own hardware.

I didn't like the kextunload "fix" because now my MBP doesn't sleep when I close the lid. Pick your poison I guess.

I just hex diffed the ML and Mavericks versions of the two kexts:

/System/Library/Extensions/AppleACPIPlatform.kext

and the embedded

/System/Library/Extensions/AppleACPIPlatform.kext/Contents/PlugIns/AppleACPIButtons.kext

They are fairly similar - I'd be interested to see if I could replace the one on Mavericks with the version from ML and see if it works. I've been doing some other kext work this evening troubleshooting audio problems with Mavericks and the ML kexts were fairly interchangeable there.

This Pull Request into power_fixer seems to fix the issue and return PowerKey to roughly pre-Mavericks behavior. Thanks @stino! Would appreciate other testers of both power_fixer and PowerKey with this behavior:

binchewer/power_fixer#8

This patch of OSX power button leads to following behavior:

  • press power button less than 1.5 sec -> nothing happens
  • press power button more than 1.5 sec but less than 8 sec -> shows shutdown dialog
  • press power button more than 8 sec -> system powers off

I've tested out the latest change to power_fixer (not entirely positive that I am running Stino's version, but I did pull his code, verified version and then did a build) with PowerKey. The dialog box is removed now when the power key is pressed, but there seems to be a delay when pressing the key to getting delete actions. For instance, when I quickly press the delete key a bunch of times really quickly, they don't all register and it seems I have to slow my rate down. This is different from how the response was pre-10.9

What you described would be issue #1, "Quick successive key presses don't get registered ". This is the same delay that's intentionally built into Caps Lock to prevent accidental keypresses. Will likely be difficult to avoid.

I see. Thanks for explanation. Hopefully I can find something that can prevent that behavior. It didn't do that pre-Mav (in previous macbook) so hopefully there is a way to revert. Almost there!

Did your previous Macbook have a power key on the keyboard or power button in the metal case? This delay definitely also occurred in 10.8, at least for keyboard power keys.

Oh, that's right, I had a round button. You mentioned that to me before. That is not a good sign then if it was similar in 10.8 with a power 'key'.

Also tried PowerKey with power_fixer together, and it looks not so good: power button indeed acts like delete key in text input, if I press button not so fast. BUT it also brings dialog "Are you sure you want to shut down your computer now?". If I press it faster, nothing gonna happen: no dialog, no char deletion. By "not so fast" I mean about 0.5 s. press.

Aw, sorry, didn't notice that pull request is not merged yet. Version from fork did the trick, now my power key works like delete key.

OS X 10.9.2 broke @stino's power_fixer fix. Had it working correctly for about a day :/

binchewer/power_fixer#8

binchewer/power_fixer#9

10.9.2: Disable power button sleep
http://hints.macworld.com/article.php?story=20140305140635280

defaults write com.apple.loginwindow PowerButtonSleepsSystem -bool no 

Then log out and log back in.

I have tested this to work with PowerKey v1.1.1! Would love to have more eyes on it though, to confirm the behavior is roughly equivalent to pre-Mavericks PowerKey behavior.

Many thanks to Josh R. for sending this in!

Confirming that 1.1.1 with the defaults tweak works, feels about the same as pre-Mavericks.

After entering that command in terminal then logging out and then starting
powerkey after login, my rMBP does not go to sleep, but pressing the power
key a few times still brings up the dialog box to shutdown. Was this normal
pre-Mav?

Edit: I believe that the difference in the power key to other keys is the slight delay pulse that is triggered on push. If you retrigger the event too fast, the wait time continues and the dialog box comes up (2 seconds in 10.9.2). Simply pressing and releasing with a slight wait of more than .5 seconds in between does not trigger the shutdown dialog.

Thanks for this! finally get to make this mac my primary and keep my delete key.

Hi,

I have tried to read all the post related to this issue wiht Maveriks, but not sure if there is a solution yet. Please, someone can comment on this? If there is a soluton, can you explain how to solve this issue.
Thanks in advance

Hi @MetMillitia,

What you should do is open Terminal and run the command:

 defaults write com.apple.loginwindow PowerButtonSleepsSystem -bool no 

Log out and log back in.

Then run the latest version of PowerKey and it should work properly.

Today I am going to release v1.2, which will link to a nice doc that outlines all of this.

Fixed in PowerKey v1.2 https://github.com/pkamb/PowerKey/releases/tag/v1.2

Manually run the command:

 defaults write com.apple.loginwindow PowerButtonSleepsSystem -bool no 

Then log out, log back in, and run PowerKey.

Added a link to the Settings window that links to the 10.9 directions:

settingswindow_small

Many thnaks, quick question... is there any way to block the action of the power button If I hold it for more than 5 seconds? (Hold down the power button for 5 seconds to force the computer to turn off.)

Side note: even if is there, it will be really bad decision for notebooks. In case of system hang, you will not be able to reboot it untill your battery drain out.

Yep, completly agree, however, maybe there is a way to use this "feature" only when you want... (I understand that you could not see the future in order to know that your system will hang)...
The issue that I'm having is that the pop-up for additional options ups in my screen every 3 seconds, and sometimes (if I don't do anything) my computer is forced to shut down... So, my believe is that the button is not working propperly...

@MetMillitia

is there any way to block the action of the power button If I hold it for more than 5 seconds?

Not that I know of, no.

The issue that I'm having is that the pop-up for additional options ups in my screen every 3 seconds

Is this when using PowerKey, or without the app?

Using PowerKey + the PowerButtonSleepsSystem console command above, I'm unable to get the pop-up window to show at all. So I'm not sure where that is coming from for you.

sometimes (if I don't do anything) my computer is forced to shut down

Is this related to PowerKey, or does it happen without the app? Was your keyboard water-damaged or anything like that?

Hi pkamb,

Thanks for the interes in my issue.
I'm having this issue without using the app, so this is not an app bug.

I was trying to look for a solution trought this app, unfortunately using PowerKey + the PowerButtonSleepsSystem console command showed above, I'm still getting the pop-up... just for clarify, without the app, the pop-up does not come if I maintain pressed whatever key... so, I can identify completly if this is happening using the app or not...

Not sure, what I have made wrong, because ussing PowerKey + PowerButtonSleepsSystem (maintaining pressed the fn key for example in order to identify that the app is running correctly) the pop-up still appears..

@MetMillitia

is there any way to block the action of the power button If I hold it for more than 5 seconds?

I forgot, there is this from the creator of power_fixer:

http://www.reddit.com/r/apple/comments/1u5v5e/mavericks_power_button_fix/ceisg91

Investigating further. Expect to finish in a week. Small hint for those, who want to simply turn the button off:

sudo kextunload /System/Library/Extensions/AppleACPIPlatform.kext/Contents/PlugIns/AppleACPIButtons.kext/

This should disable the Power key completely. Not sure if it will work in 10.9.2 though.

WARNING: likely many side effects. Your computer will not sleep automatically when you close the lid. No way to force a restart if your computer hangs. Etc.

This is not needed for running PowerKey.app. Only if you want to completely disable the Power key.

Many thanks