From bd736646cc8bb8c7186d172c1a30bafe1d035610 Mon Sep 17 00:00:00 2001 From: Loric Brevet Date: Fri, 3 May 2024 04:37:48 +0200 Subject: [PATCH] overload: preserve layer during pending action --- src/keyboard.c | 2 +- src/vkbd/usb-gadget.service | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/vkbd/usb-gadget.service diff --git a/src/keyboard.c b/src/keyboard.c index b21d6df..624fdbd 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -626,7 +626,7 @@ static long process_descriptor(struct keyboard *kbd, uint8_t code, kbd->overload_start_time = time; activate_layer(kbd, code, idx); update_mods(kbd, -1, 0); - } else { + } else if (!kbd->pending_key.code) { deactivate_layer(kbd, idx); update_mods(kbd, -1, 0); diff --git a/src/vkbd/usb-gadget.service b/src/vkbd/usb-gadget.service new file mode 100644 index 0000000..d7beb0e --- /dev/null +++ b/src/vkbd/usb-gadget.service @@ -0,0 +1,14 @@ +[Unit] +Description=usb gadget setup +Requires=systemd-modules-load.service,keyd.service +Before=keyd.service +After=systemd-modules-load.service + + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/bin/bash /usr/local/bin/keyd-usb-gadget.sh + +[Install] +WantedBy=keyd.service