Skip to content

Commit e7aaf87

Browse files
committed
initial commit
0 parents  commit e7aaf87

6 files changed

+1098
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Setup
2+
3+
This only works with Nodejs 12 / darwin / x64 as I have only manually compiled the node library for this architecture. I tested this on Node 14 and wasn't able to do it, but you may attempt to compile iohook for other environments by following these steps: https://github.com/wilix-team/iohook/issues/124#issuecomment-731925826
4+
5+
1. `nvm use 12`
6+
2. `npm i`
7+
3. Replace all files in `node_modules/iohook/builds/node-v72-darwin-x64/build/Release` with `iohook.node` in the project root directory
8+
4. Place your clips in the `clips` folder. Number them accordingly from 1 to 10.
9+
5. Play the clips by pressing the combination of `ctrl+cmd+n`, where n is a digit from 0 to 9. (0 is clip 10)

index.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
3+
const ioHook = require('iohook');
4+
5+
// key n has a keycode of n + 1
6+
const numberKeyCodes = Array.from({ length: 10 }, (_v, i) => i + 2);
7+
8+
ioHook.on('keydown', (event) => {
9+
// ctrl + cmd key
10+
if (event.ctrlKey && event.metaKey) {
11+
if (numberKeyCodes.includes(event.keycode)) {
12+
console.log(`playing ${event.keycode-1}.mp3`);
13+
}
14+
}
15+
});
16+
17+
// Register and start hook
18+
ioHook.start();

iohook.node

104 KB
Binary file not shown.

0 commit comments

Comments
 (0)