Skip to content
pickpj edited this page Feb 26, 2024 · 12 revisions

Quirks / Extra

  1. The low level manner in which the keyboard is capture means that functions work when a key is disabled with xmodmap
  2. If .Xmodmap isn't enough for disabling a key (some keys are still picked up by browsers; eg. F7) this wiki covers how to remap it to an unused key, f13-f24 & MACRO1-MACRO30 are good options (42 keys). Evtest is better for finding scancodes than showkeys.
  3. Can be used with more than just the keyboard, can interact with anything that outputs to events (may need to modify some code)
    • Ex. In evtest the laptop lid switch outputs show up as
    Event: time 1681146031.388762, type 5 (EV_SW), code 0 (SW_LID), value 1
    Event: time 1681146031.388762, -------------- SYN_REPORT ------------
    Event: time 1681146032.121323, type 5 (EV_SW), code 0 (SW_LID), value 0
    Event: time 1681146032.121323, -------------- SYN_REPORT ------------
    
    • If we changed if(ev.type == EV_KEY) to EV_SW we are able to execute commands under code 0. (more info on event types)
    • Also would need to remove the checks for numlock status, given there is no numlock/numlock led, (the lines with libevdev_uinput_write_event and the while loop), and check if there are no interferences with the keycodes reserved for modifiers keys (29,42,54,56,97,100) or the EV_LED with code 0 (won't necessarily mess things up).
  4. Depending on what you are doing, it may help to append an & at the end of the system() command.   more info However, this may introduce race conditions, with commands competing over the same resources at the same time.
  5. More on interactions with fn key
  6. Still works when you switch tty's, probably a con, depending on your use case.
  7. For devices that disconnect and reconnect, thereby changing the event#. A symlink can be created to automatically map to the newly created event Instructions (I use this for wireless headphones). Upon reconnecting the device file needs to be reopened (AKA, run program again), or in the Examples branch there is a more complicated example that allows for reconnecting.
  8. Illegal use of SIGALRM (potentially non-reentrant?) link1, link2

Disabling Keys

Key: DS = Device Specific, G = Global (Not DS)

X11

  • G Xmodmap
    • Check keycode with xev, then set keycodes to NoSymbol in a .Xmodmap file
  • G AHK_X11
    • *Key::Return
  • G Xbindkeys
    • Have not tried.
  • DS xkb
    • My attempts were unsuccessful, but this method should provide a device specific remap using xkbcomp.

Kernel/global

  • DS udev HWDB (Hardware Database) File
    • Extra #2 Above
  • DS keyd
    • Grabs /dev/input other applications (evtest, evmorse) cant read, incompatible.
Clone this wiki locally