houmain / keymapper

A cross-platform context-aware key remapper.
GNU General Public License v3.0
260 stars 22 forks source link

External keyboard isn't affected #37

Closed mark2185 closed 1 year ago

mark2185 commented 1 year ago

Everything used to work a-okay for a few months (reboots included), but stopped working yesterday for some reason.

I tried rebooting, restarting the daemon, running keymapper -u -v manually, building the latest master, but the external keyboard isn't affected at all, it works as an ordinary keyboard, but at the same time my laptop's keyboard is intercepted by keymapper.

I start it with a script like this.

#!/bin/bash

# for remapping caps+{hjkl} to arrow keys and similar
line=$(pgrep -x keymapper)
if [[ -z "$line" ]]; then
    keymapper -u & &> /tmp/keymapper.log 
    sleep 2
fi

setxkbmap -layout us,hr
setxkbmap -option 'grp:win_space_toggle'

# To turn auto-repeat off or on:
xset r rate 240 50

How can I debug this further?

houmain commented 1 year ago

Do you have a Razer keyboard by any chance (there is an open issue #29)? Could you please post the output of sudo evtest? To see which functionality this not working keyboard has.

mark2185 commented 1 year ago

It's not Razer, it's Logitech.

I'll get back to you on Monday with the output of sudo evtest.

mark2185 commented 1 year ago

Let's pretend today's Monday.

I didn't know which exactly buttons should I've pressed, so I just tapped CapsLock a couple of times, here's the output of evtest.

https://gist.github.com/mark2185/4e501dde33ca92f8685c62fe30148d07

houmain commented 1 year ago

Thanks, this helps! It appears to have a scroll wheel and an absolute volume slider:

  Event type 2 (EV_REL)
    Event code 6 (REL_HWHEEL)
    Event code 12 (REL_HWHEEL_HI_RES)
  Event type 3 (EV_ABS)
    Event code 32 (ABS_VOLUME)
      Value      0
      Min        1
      Max      767

The volume slider is the reason why also some Razer devices do not work yet. Because of the wheel it might also get ignored for being a mouse (unless your configuration contains mouse button mappings). I will try to fix both.

houmain commented 1 year ago

Hi Luka, now it should work. Unfortunately I do not possess such a device (with volume slider/wheel), so I could not test it. Maybe you could check out the latest commit (eaca49f259acd65b695d27609ea03bf838d61308) and test it? Thanks!

mark2185 commented 1 year ago

Maybe you could check out the latest commit (https://github.com/houmain/keymapper/commit/eaca49f259acd65b695d27609ea03bf838d61308) and test it? Thanks!

Of course, it's not a problem at all! The keyboard's in the office, so I'll get back to you tomorrow!

mark2185 commented 1 year ago

I can confirm that it works, at least for the Logitech keyboard (I don't have a Razer one to test that out too).

Thank you!