dmauro / Keypress

A keyboard input capturing utility in which any key can be a modifier key.
http://dmauro.github.io/Keypress/
Apache License 2.0
3.18k stars 313 forks source link

Created a `normalize_caps_lock` option #115

Closed beauwest closed 8 years ago

beauwest commented 8 years ago

Do not allow turning caps lock on to prevent combos from being activated.

Discussed in issue #114.

I decided to implement a caps-specific check, instead of trying to make it apply to all toggle keys. I think the most common scenario will be a user with caps lock enabled. Even in games, it's common for caps lock to be triggered either accidentally, or as an OS PTT key.

I only committed the .coffee file, if I need to include the other files, let me know, but I assume that it'll require a new version to be built.

I couldn't find a repository for the Keypress site, so I wasn't able to write documentation for it. If I just missed it, let me know as well.

Thank you!

beauwest commented 8 years ago

I tried several different methods for doing this. I decided on modifying the _match_combo_arrays function. If a registered combo is set to normalize_caps_lock: true, and caps is in the potential matches (keys down), it checks for a potential match without caps in the keys down.

This should allow the is_exclusive option to still be effective.