Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Delete" when button is unpressed #31

Closed
bezenson opened this issue Oct 25, 2015 · 4 comments
Closed

"Delete" when button is unpressed #31

bezenson opened this issue Oct 25, 2015 · 4 comments

Comments

@bezenson
Copy link

Application is cool, but will be better if delete (or another action) will work after I move my hand from button. Because now when I want to lock my laptop it first remove one symbol and only then locking.

@pkamb
Copy link
Owner

pkamb commented Nov 6, 2015

Good idea. We do get the Key Up / Key Down events for the Power Key. And there is a small window where the system power key behavior does not activate, to reduce accidental presses.

PowerKey could be changed to only activate the replacement keystroke if the measured delay between key up / key down is less than the system's power key delay.

Before Implementing I'd like to find the exact millisecond delay used by the system. Does anyone know?

@bezenson
Copy link
Author

bezenson commented Nov 6, 2015

I can only assume, that there is 1000ms delay before laptop goes to sleep mode.

@pkamb
Copy link
Owner

pkamb commented Nov 6, 2015

Through a bit of testing it looks like 0.35 seconds is our magic number.

Testing in OS X 10.11.1 shows: a power key Key Up > Key Down timeframe of 0.342775 seconds no-ops. A press of 0.366125 causes the screen to go black.

@pkamb pkamb closed this as completed Nov 6, 2015
@pkamb pkamb reopened this Nov 6, 2015
@pkamb
Copy link
Owner

pkamb commented Nov 21, 2015

In the new version of PowerKey I've enabled modifier keys to work alongside the power key, and that will cause some issues with this proposed "key up" behavior. When modifier keys are held, the system does not send the "key up / key down" event pair that is needed for this to work.

So we have no choice but to send the event on key down when using modifier keys. Inputing the character on key down also feels more natural.

Due to the above I'm going to close this issue, but thanks for the suggestion. If you'd like you could enable it on your copy of the app by changing the place in which the replacement key is inputted.

@pkamb pkamb closed this as completed Nov 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants