removed prefix, prefiltering evtest output via grep

This commit is contained in:
Daniel Sommer 2022-02-18 00:30:56 +01:00
parent 6aade27a5a
commit 1a994010f5
3 changed files with 6 additions and 8 deletions

View file

@ -5,10 +5,10 @@
}, },
"watchers": [ "watchers": [
{ {
"device": "/dev/input/event10", "device": "usb-Razer_Razer_Blade_Stealth-if01-event-kbd",
"keys": [ "keys": [
{ {
"key": "enter", "key": "key_enter",
"type": "keydown", "type": "keydown",
"command": "notify-send", "command": "notify-send",
"args": [ "args": [
@ -17,7 +17,7 @@
] ]
}, },
{ {
"key": "esc", "key": "key_esc",
"type": "keyup", "type": "keyup",
"command": "notify-send", "command": "notify-send",
"args": [ "args": [
@ -26,7 +26,7 @@
] ]
}, },
{ {
"key": "space", "key": "key_space",
"type": "keyhold", "type": "keyhold",
"delay": 1000, "delay": 1000,
"command": "notify-send", "command": "notify-send",

View file

@ -1,7 +1,5 @@
const FILTER_START = 'Testing ... (interrupt to exit)'; const FILTER_START = 'Testing ... (interrupt to exit)';
const KEY_PREFIX = 'KEY_';
const ACTION_KEYUP = { id: 0, action: 'keyup' }; const ACTION_KEYUP = { id: 0, action: 'keyup' };
const ACTION_KEYDOWN = { id: 1, action: 'keydown' }; const ACTION_KEYDOWN = { id: 1, action: 'keydown' };
const ACTION_KEYHOLD = { id: 2, action: 'keyhold' }; const ACTION_KEYHOLD = { id: 2, action: 'keyhold' };
@ -28,7 +26,7 @@ class Keyfilter {
var command = config[index].command; var command = config[index].command;
var args = config[index].args; var args = config[index].args;
var delay = config[index].delay; var delay = config[index].delay;
this.actions.set(KEY_PREFIX + config[index].key.toUpperCase(), { type, command, args, delay }); this.actions.set(config[index].key.toUpperCase(), { type, command, args, delay });
} }
} }
filterActive(input) { filterActive(input) {

View file

@ -23,7 +23,7 @@ class Watcher {
return; return;
} }
logger.debug('starting watcher \'' + this.device + '\'...'); logger.debug('starting watcher \'' + this.device + '\'...');
this.process = spawn("evtest", [this.device]); this.process = spawn("evtest", [this.device, "|", "grep", "EV_KEY"]);
this.attachListeners(); this.attachListeners();
logger.info('watcher \'' + this.device + '\' initialized and capturing configured events'); logger.info('watcher \'' + this.device + '\' initialized and capturing configured events');
} }