diff --git a/keyd.1.gz b/keyd.1.gz index 193c778..278a4a5 100644 Binary files a/keyd.1.gz and b/keyd.1.gz differ diff --git a/man.md b/man.md index 0b99c23..a207aed 100644 --- a/man.md +++ b/man.md @@ -20,6 +20,16 @@ independently. The default behaviour is to run the forground and print to stderr, unless **-d** is supplied, in which case in which case log output will be stored in */var/log/keyd.log*. +**NOTE** + +Becuase keyd modifies your primary input device it is possible to render your +machine unusuable with a bad config file. If you find yourself in this +situation the sequence *\+\+\* will force keyd to +terminate. If you are experimenting with the available options it is advisable +to do so in a keyboard specific file (see CONFIGURATION) instead of directly in +`default.cfg`, so it remains possible to plug in another keyboard unaffected by the +changes. + # OPTIONS **-m**: Run in monitor mode. (ensure keyd is not running to see untranslated events). @@ -76,7 +86,7 @@ It is, for instance, possible to map a key to escape when tapped and control when held by assigning it to `overload(C, esc)`. A complete list of available actions can be found in *ACTIONS*. -As a special case may be 'noop' which causes it to be +As a special case \ may be 'noop' which causes it to be ignored. This can be used to simulate a modifier sequence with no attendant termination key: @@ -307,13 +317,6 @@ of \` will thus produce A-S-tab instead of M-\`. ` = A-S-tab -# NOTES - -Because of the way keyd works it is possible to render your machine unusable -with a bad config file. This can usually be resolved by plugging in a different -keyboard, however if *default.cfg* has been misconfigured you will have to find -an alternate way to kill the daemon (e.g SSH). - # AUTHOR Written by Raheman Vaiya (2017-). diff --git a/src/main.c b/src/main.c index 1a81602..0e2029e 100644 --- a/src/main.c +++ b/src/main.c @@ -356,6 +356,16 @@ static void reify_layer_mods(struct keyboard *kbd) setmods(mods); } +static struct key_descriptor *kbd_panic_check(struct keyboard *kbd) +{ + if(kbd->dcache[KEY_BACKSPACE] && + kbd->dcache[KEY_BACKSLASH] && + kbd->dcache[KEY_ENTER]) { + info("Termination key sequence triggered (backspace backslash enter), terminating."); + exit(1); + } +} + static struct key_descriptor *kbd_lookup_descriptor(struct keyboard *kbd, uint16_t code, int pressed, uint16_t *modsp) { size_t i; @@ -457,6 +467,8 @@ static void process_key_event(struct keyboard *kbd, uint16_t code, int pressed) d = kbd_lookup_descriptor(kbd, code, pressed, &mods); if(!d) goto keyseq_cleanup; + kbd_panic_check(kbd); + switch(d->action) { struct layer *layer; uint32_t keyseq;