darklight721 / keyboard-sounds

A small Atom package that makes (mechanical) keyboard noise while you type.
https://atom.io/packages/keyboard-sounds
MIT License
8 stars 3 forks source link

How to ignore certain keys? #4

Open tosho opened 8 years ago

tosho commented 8 years ago

I want certain keys (like: CTRL, ALT, SHIFT, WIN key, CAPS LOCK , and FnKeys) to be ignored and not make any sound. It gets annoyning when I go Alt + tab or Ctrl+*, or hitting Shift. The shortcuts for toggle and vol up and down doesn't work. There isn't such file as keymap.cson in ./keymaps/ there is keyboard-sounds.cson. I tried to change it but nothing happens.

jots commented 8 years ago

I made this change which is not perfect but better than nothing:

handleKeyDown({ keyCode, code }) {
    //console.log(code);
    if (code.match(/Arrow|Shift|Control|Numpad|Alt/)) {
      return;
    }
    playAudio(AUDIO_MAP[keyCode] || AUDIO_MAP.DEFAULT, this.volume);
  }

what do you think?