xkeysnail
xkeysnail copied to clipboard
xkeysnail captures all my input, but it doesn't work anywhere else
xkeysnail captures all my input, but it doesn't work anywhere else, and it seems to be acting like my keyboard is not working
I got the same issue.
I got the same issue.
I upgrade version from 0.3.0
to 0.4.0
, the problem was solved.
You can also try to upgrade the version:
sudo pip3 install --upgrade xkeysnail
I'm having this same problem and it's driving me crazy. I'm using version 0.4.0 and I've had it installed for years with no problems. I've tried:
- Uninstalling and reinstalling.
- Using the default config.py file
- Using different windows managers (kde, awesomewm)
- Using different terminals (xterm, konsole)
- Not using sudo (this won't work at all)
They all act the same: I'll run xkeysnail with its config file, and once it's running, it'll capture my input, but my keyboard will not work anymore. I can't even ctrl + C to kill it. How can I debug it?
I have the exact same problem, here's the fix that worked for me.
in '/usr/lib/python3.10/site-packages/xkeysnail/output.py',
line 30 should be
_uinput = UInput(events={ecodes.EV_KEY: _keyboard_codes, ecodes.EV_REL: set([0,1,6,8,9]), })
I deleted the events parameter because evdev was working without it.
Now it looks like this
_uinput = UInput()
And it magically works?
I'm not sure if this fix will create more problems with different configs... But for my usecase, everything seems to be working fine.
Wow, that worked. Can you explained why it works? I'm not really clear on it.
Just in case it works for anyone else, I've been using keyd temporarily while I fixed this and it's working okay. Not as well as xkeysnail but it could probably get there without too much work.
It seems that UInput init params with latest udev makes virtual device identified not as keyboard but as tablet, and events are ignored. More info: https://github.com/joshgoebel/keyszer/issues/137#issuecomment-1454236393
There are few ways to fix it. Removing events parameter makes device seen as keyboard by udev, because default events value is all keys (according to python-evdev doc). But then you may lose ability to bind axes and wheels events (EV_REL). But I guess people rarely use them in bindings.
Other solution is to modify _keyboard_codes
variable, like changing it to set(ecodes.keys.keys())
. At least on my machines it makes virtual input device detected as keyboard.
I can't propose proper patch though, because all these solutions may break some user configs or not work with different udev versions.
Other solution is to modify _keyboard_codes variable, like changing it to set(ecodes.keys.keys()). At least on my machines it makes virtual input device detected as keyboard.
From reading the systemd source I have no idea how this would change anything. You'd still have all the buttons registered and if you didn't remove the REL reference you'd have the relative events also - putting you squarely in the "touchpad" game again... or worse joystick - which is what we were trying to avoid with the "not all the buttons" hacks.
If you're only using it to remap a keyboard ONLY then simply removing the EV_REL stuff from the constructor should cause no harm at all.
From reading the systemd source I have no idea how this would change anything. You'd still have all the buttons registered and if you didn't remove the REL reference you'd have the relative events also - putting you squarely in the "touchpad" game again... or worse joystick - which is what we were trying to avoid with the "not all the buttons" hacks.
I guess it is here: https://github.com/systemd/systemd/blob/877e68e7022c3f551d9f485f6791f2070c500aca/src/udev/udev-builtin-input_id.c#L261
if (has_pad_buttons && has_wheel) {
is_tablet = true;
is_tablet_pad = true;
}
has_pad_buttons
becomes true when we have BTN_0
, BTN_1
and not BTN_TOOL_PEN
.
has_pen = test_bit(BTN_TOOL_PEN, bitmask_key);
// ...
has_pad_buttons = test_bit(BTN_0, bitmask_key) && test_bit(BTN_1, bitmask_key) && !has_pen;
Initially all these buttons are inside ecodes.keys
. When we doing ecodes.keys.keys() - ecodes.BTN
, the BTN_TOOL_PEN
value is removed and never added, so has_pen
is false. Meanwhile, _MOUSE_BUTTONS
in xkeysnail/keyszer adds BTN_0
and BTN_1
later. Then has_pad_buttons
becomes true (and has_wheel
is also true) and udev assignes ID_TABLET
and ID_TABLET_PAD
.
When all BTNs aren't removed from events, that BTN_TOOL_PEN
forces has_pen
to be true and that tabled ids not assigned to device. There are other places in udev code that assign tablet ids, but they rely on has_abs_coordinates
and has_mt_coordinates
, both must be false because app code doesn't do anything with ABS_*
.
Ah, right. I missed the the TOOL_PEN connection...