added documentation
This commit is contained in:
parent
09d9a90ff1
commit
c6894eff79
1 changed files with 56 additions and 1 deletions
55
README.md
55
README.md
|
@ -1,3 +1,58 @@
|
||||||
# ninwa
|
# ninwa
|
||||||
|
|
||||||
node input watcher
|
node input watcher
|
||||||
|
|
||||||
|
## requirements
|
||||||
|
|
||||||
|
- node.js
|
||||||
|
- yarn
|
||||||
|
- evtest
|
||||||
|
|
||||||
|
## setup
|
||||||
|
|
||||||
|
- clone the project
|
||||||
|
`git clone https://git.velvettear.de/velvettear/ninwa.git`
|
||||||
|
|
||||||
|
- enter the project directory
|
||||||
|
`cd ninwa`
|
||||||
|
|
||||||
|
- installed required modules
|
||||||
|
`yarn install`
|
||||||
|
|
||||||
|
- modify `config.json` according to your needs
|
||||||
|
|
||||||
|
- execute ninwa
|
||||||
|
`node ninwa.js`
|
||||||
|
|
||||||
|
## systemd
|
||||||
|
|
||||||
|
**for security reasons it is highly recommended to not run ninwa with root permissions!**
|
||||||
|
|
||||||
|
- create a new system user
|
||||||
|
`useradd -r -s /usr/bin/nologin ninwa`
|
||||||
|
|
||||||
|
- symlink the provided systemd-service file and modify it according to your needs
|
||||||
|
`ln -s /path/to/ninwa/ninwa.service /etc/systemd/system/ninwa.service`
|
||||||
|
|
||||||
|
- reload systemd-services
|
||||||
|
`systemctl daemon-reload`
|
||||||
|
|
||||||
|
- enable and start the ninwa as a systemd-service
|
||||||
|
`systemctl enable --now ninwa`
|
||||||
|
|
||||||
|
## configuration
|
||||||
|
|
||||||
|
configuration is done entirely within the file `config.json`.
|
||||||
|
|
||||||
|
### log: [*object*]
|
||||||
|
- level: [*string*] verbosity of the log; either `debug`, `info`, `warning` or `error`
|
||||||
|
- timestamp: [*string*] format string for the timestamp; review [moment.js](https://momentjs.com/docs/#/displaying/format/) for further information
|
||||||
|
|
||||||
|
### watchers: [*object-array*]
|
||||||
|
- device: [*string*] name of or path to an input device; ninwa automatically tries to locate the device in `/dev/input` and `/dev/input/by-id/` if only a name is given
|
||||||
|
- keys: [*object-array*]
|
||||||
|
- key: [*string*] name of the key
|
||||||
|
- type: [*string*] type of the key event; either `keyup`, `keydown` or `keyhold`
|
||||||
|
- delay: [*number*] time in milliseconds until the key will be registered again (mostly useful for keyhold-events)
|
||||||
|
- command: [*string*] command to execute on key press
|
||||||
|
- args: [*string-array*] arguments to pass to the executed command
|
Loading…
Reference in a new issue