def processKeycode(self, keycode):
"""Parse a command in our current layer bound to the passed keycode (ledger history)."""
# Normalize NumLock "sandwiches" → strip KEY_NUMLOCK if other keys are present
parts = keycode.split("-")
filtered = [p for p in parts if p != "KEY_NUMLOCK"]
if filtered: # only strip if something else remains
keycode = "-".join(filtered)
dprint(f"{self.name} filtered {keycode}") # debug info
dprint(f"{self.name} is processing {keycode} in layer {self.currentLayer}") # debug info
if keycode in readJson(self.currentLayer):
value = readJson(self.currentLayer)[keycode]
value = parseVars(value, self.currentLayer)
# ... rest of Keebie processing# Disable USB autosuspend for all HID devices and hubs
ACTION=="add", SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="03", ATTR{power/control}="on"
ACTION=="add", SUBSYSTEM=="usb", ATTR{bDeviceClass}=="09", ATTR{power/control}="on"Reload rules:
sudo udevadm control --reload-rules
sudo udevadm trigger#!/bin/bash
while true; do
# Keep all USB devices authorized to prevent idle drop
for dev in /sys/bus/usb/devices/*/authorized; do
echo 1 > "$dev"
done
sleep 60
doneMake it executable:
sudo chmod +x /usr/local/bin/keepalive.sh[Unit]
Description=Keep numeric keypads awake
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/local/bin/keepalive.sh
Restart=always
User=root
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl daemon-reload
sudo systemctl enable --now numpad-keepalive.service
sudo systemctl status numpad-keepalive.service- Identify your keypad device:
ls /dev/input/by-id/- Monitor low-level events:
sudo evtest /dev/input/eventX- Press keys after idle —
KP_ENTERshould register immediately. - Press sequences like
KEY_NUMLOCK-KEY_KPENTER-KEY_NUMLOCK— Keebie should normalize toKEY_KPENTER.
✅ Result:
- NumLock sandwiches handled
- First key after idle works reliably
- Works for all HID devices, not just a specific vendor