I'm trying to write an application that prevents certain key signals from propagating beyond the OS in OSX. To clarify, I want to make it so that it almost seems to the user that the key they are pushing on their keyboard is broken. So, the associated letter won't show up in a textarea, the key won't activate a function in another application, etc. Any ideas? Thanks in advance.
Asked
Active
Viewed 4,080 times
2
-
What legitimate use do you have in mind? – mikerobi Sep 27 '10 at 17:28
-
4@mikerobi: Whether the use is legitimate or not is irrelevant. We're not the hacking police. The better question is "what exactly are you trying to do?" since there's a technical difference between "let's keep the user from ever being able to type 'x'" and "let's keep the user from using Cmd-Tab to switch apps." – Joshua Nozzi Sep 27 '10 at 17:33
-
@mikerobi: it's a fair question and I appreciate that you are concerned about the ethics of the application. I can't share the specifics due to an NDA. However, I think you will be happy to know that users will elect to start this application and have full knowledge of what will happen. So, I don't think the ethics are in question. Feel free to PM me if you want to discuss further. – Josh Sep 27 '10 at 18:38
-
1@Joshua Nozzi, I was just asking out of curiosity, because honestly I couldn't think of a use. – mikerobi Sep 28 '10 at 03:06
-
@mikerobi BetterTouchTool developer offers a software with a similar functionality, useful for cleaning the keyboard without activating random things. – Teejay Oct 20 '15 at 18:28
-
@mikerobi if you were purely curious, why use the adjective "legitimate"? – Robino Feb 24 '17 at 12:00
1 Answers
6
You probably want to look into Quartz Event Taps. Note that your process will need to be running with "root" privileges to intercept events at the system level.
See also OSX Quartz Event Taps: event types and how to edit events

Community
- 1
- 1

David Gelhar
- 27,873
- 3
- 67
- 84