4

I want to create myself very tiny app, which will play a sound every time I press a key on my keyboard. I don't need to know which key on the keyboard was pressed, I just need to somehow know that it happened.

Are there any global system hooks for pressed key on the keyboard?

Anonymous
  • 11,699

1 Answers1

2

Here's a method that in theory should work.

If you visit the "Accessibility" tab in System>Preferences>Keyboard then you can enable the "Slow Keys" "Only accept long keypresses" option. Turn the delay all the way down and you basically null the effects of this option. Then go to "Audio Feedback..." and enable "Beep when a key is pressed" under the "Slow Keys" section.

Configuration Dialogs

This method SHOULD work. I couldn't get it to work, honestly. I do have the sound-theme-freedesktop sound theme installed and enabled. Perhaps it's a bug with gnome 2.32.0.

These configuration options simply play the system bell. On Ubuntu the system bell does not work when desktop effects are enabled. Turn off desktop effects, or on Ubuntu 11.04 login as "Ubuntu Classic (No effects)", and your system bell should work again.