From 1a994010f548923f8aa985d7a082aad8dcf9d73a Mon Sep 17 00:00:00 2001 From: velvettear Date: Fri, 18 Feb 2022 00:30:56 +0100 Subject: [PATCH] removed prefix, prefiltering evtest output via grep --- config.json | 8 ++++---- libs/keyfilter.js | 4 +--- libs/watcher.js | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/config.json b/config.json index d8a1e16..ccf9407 100644 --- a/config.json +++ b/config.json @@ -5,10 +5,10 @@ }, "watchers": [ { - "device": "/dev/input/event10", + "device": "usb-Razer_Razer_Blade_Stealth-if01-event-kbd", "keys": [ { - "key": "enter", + "key": "key_enter", "type": "keydown", "command": "notify-send", "args": [ @@ -17,7 +17,7 @@ ] }, { - "key": "esc", + "key": "key_esc", "type": "keyup", "command": "notify-send", "args": [ @@ -26,7 +26,7 @@ ] }, { - "key": "space", + "key": "key_space", "type": "keyhold", "delay": 1000, "command": "notify-send", diff --git a/libs/keyfilter.js b/libs/keyfilter.js index 32fd71d..a25569a 100644 --- a/libs/keyfilter.js +++ b/libs/keyfilter.js @@ -1,7 +1,5 @@ const FILTER_START = 'Testing ... (interrupt to exit)'; -const KEY_PREFIX = 'KEY_'; - const ACTION_KEYUP = { id: 0, action: 'keyup' }; const ACTION_KEYDOWN = { id: 1, action: 'keydown' }; const ACTION_KEYHOLD = { id: 2, action: 'keyhold' }; @@ -28,7 +26,7 @@ class Keyfilter { var command = config[index].command; var args = config[index].args; 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) { diff --git a/libs/watcher.js b/libs/watcher.js index 2b592b3..48e7a00 100644 --- a/libs/watcher.js +++ b/libs/watcher.js @@ -23,7 +23,7 @@ class Watcher { return; } logger.debug('starting watcher \'' + this.device + '\'...'); - this.process = spawn("evtest", [this.device]); + this.process = spawn("evtest", [this.device, "|", "grep", "EV_KEY"]); this.attachListeners(); logger.info('watcher \'' + this.device + '\' initialized and capturing configured events'); }