Open fecet opened 1 year ago
Here is the log
keyszer v0.6.92
(--) ROOT: Yes, I am. --very-bad-idea acknowledged.
(--) Autodetecting all keyboards (--device not specified)
(+K) Grabbing 'Logitech USB Receiver' (/dev/input/event15)
(+K) Grabbing 'HTKB HTKB HHKB-BLE' (/dev/input/event19)
(+K) Grabbing 'HTKB HTKB HHKB-BLE Keyboard' (/dev/input/event22)
(--) Ready to process input.
ls
llsException in callback receive_input(InputDevice('...nput/event19')) at /root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/keyszer/input.py:102
handle: <Handle receive_input(InputDevice('...nput/event19')) at /root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/keyszer/input.py:102>
Traceback (most recent call last):
File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/keyszer/input.py", line 117, in receive_input
on_event(event, device)
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/keyszer/transform.py", line 347, in on_event
if context.x_error:
^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/keyszer/lib/key_context.py", line 27, in x_error
self._query_window_context()
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/keyszer/lib/key_context.py", line 13, in _query_window_context
self._X_ctx = get_xorg_context()
^^^^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/keyszer/xorg.py", line 36, in get_xorg_context
wm_name = window.get_full_text_property(_display.get_atom("_NET_WM_NAME"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/xobject/drawable.py", line 486, in get_full_text_property
prop = self.get_full_property(property, property_type,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/xobject/drawable.py", line 476, in get_full_property
prop = self.get_property(property, property_type, sizehint,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/xobject/drawable.py", line 455, in get_property
r = request.GetProperty(display = self.display,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/protocol/rq.py", line 1368, in __init__
self.reply()
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/protocol/rq.py", line 1380, in reply
self._display.send_and_recv(request = self._serial)
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/protocol/display.py", line 612, in send_and_recv
gotreq = self.parse_response(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/protocol/display.py", line 719, in parse_response
gotreq = self.parse_error_response(request) or gotreq
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/protocol/display.py", line 745, in parse_error_response
Is it the full log? I don't see it mention BadRRModeError
at the bottom.
Oops, will upload full log next time crashed.
But I think this should be
keyszer v0.6.92
(--) ROOT: Yes, I am. --very-bad-idea acknowledged.
(--) Autodetecting all keyboards (--device not specified)
(+K) Grabbing 'Logitech USB Receiver' (/dev/input/event15)
(+K) Grabbing 'HTKB HTKB HHKB-BLE' (/dev/input/event19)
(+K) Grabbing 'HTKB HTKB HHKB-BLE Keyboard' (/dev/input/event22)
(--) Ready to process input.
ls
llsException in callback receive_input(InputDevice('...nput/event19')) at /root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/keyszer/input.py:102
handle: <Handle receive_input(InputDevice('...nput/event19')) at /root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/keyszer/input.py:102>
Traceback (most recent call last):
File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/keyszer/input.py", line 117, in receive_input
on_event(event, device)
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/keyszer/transform.py", line 347, in on_event
if context.x_error:
^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/keyszer/lib/key_context.py", line 27, in x_error
self._query_window_context()
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/keyszer/lib/key_context.py", line 13, in _query_window_context
self._X_ctx = get_xorg_context()
^^^^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/keyszer/xorg.py", line 36, in get_xorg_context
wm_name = window.get_full_text_property(_display.get_atom("_NET_WM_NAME"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/xobject/drawable.py", line 486, in get_full_text_property
prop = self.get_full_property(property, property_type,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/xobject/drawable.py", line 476, in get_full_property
prop = self.get_property(property, property_type, sizehint,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/xobject/drawable.py", line 455, in get_property
r = request.GetProperty(display = self.display,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/protocol/rq.py", line 1368, in __init__
self.reply()
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/protocol/rq.py", line 1380, in reply
self._display.send_and_recv(request = self._serial)
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/protocol/display.py", line 612, in send_and_recv
gotreq = self.parse_response(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/protocol/display.py", line 719, in parse_response
gotreq = self.parse_error_response(request) or gotreq
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/Xlib/protocol/display.py", line 745, in parse_error_response
req = self.get_waiting_request(e.sequence_number)
AttributeError: 'BadRRModeError' object has no attribute 'sequence_number'
by merging https://github.com/joshgoebel/keyszer/issues/137#issuecomment-1454681938
This seems to be some kind of internal issue with Xlib
version 0.32, so pinning the version to 0.31 should avoid it until the fix is in place. One fix apparently exists, but has not been merged, for some reason.
https://github.com/python-xlib/python-xlib/issues/241
https://github.com/python-xlib/python-xlib/pull/242
https://github.com/python-xlib/python-xlib/issues/259
To install a specific version of the package with pip
:
pip install python-xlib==0.31
It may not be quite that straightforward if you're using pipx
to install keyszer
and relying on the system python-xlib
package, which is probably 0.32 or 0.33 by now. Using a full Python virtual environment is probably the best way to handle these things.
I haven't experienced anything like this with my own project that is using a modified fork of keyszer
with Wayland support. I don't run keyszer
as root, or do much connecting/disconnecting of devices, but I've been testing my project in dozens of Linux distros in Boxes virtual machines without seeing this issue. Though mostly in Wayland to make sure the Wayland support is working.
Looks like wrapping this line in xorg.py
in a try/except could at least stop it from crashing keyszer
, but I'm not sure what the side effects would be.
File "/root/.local/pipx/venvs/keyszer/lib/python3.11/site-packages/keyszer/xorg.py", line 36, in get_xorg_context
wm_name = window.get_full_text_property(_display.get_atom("_NET_WM_NAME"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I haven't experienced anything like this with my own project that is using a modified fork of keyszer with Wayland support.
Did you mean https://github.com/RedBearAK/toshy? It looks promising, does it support https://github.com/hyprwm/Hyprland?
@fecet
That's the one. Toshy installs a development branch of keyszer
with an adaptable window context module, capable of dealing with more environments than just X11/Xorg.
That branch of keyszer
does not have Hyprland support yet. But the project that I've been drawing from has Wayland support for GNOME, KDE, sway, and Hyprland environments. So you may want to take a look at that.
https://github.com/k0kubun/xremap
In theory the sway and Hyprland support could also be added to the same branch of keyszer
that I'm using, but I'd have to take a close look at how they're doing it in xremap
, and whether those environments actually provide the window name info Toshy needs.
Thanks for your link, I tried xremap and it works both at x11 and hyprland (should build seperately though). However I still encouther https://github.com/rust-windowing/winit/issues/2898#issuecomment-1704654965, did you know what's the magic behind keyszer?
@fecet
I don't know keyszer
deeply to know why you're not seeing a similar bug.
I'm trying to figure out if I can get what I need from Hyprland, but I don't have a way to run it right now. Would you mind starting a new issue in the Toshy repo and providing some sample output from commands like hyprctl clients -j
and hyprctrl activewindow -j
? You can title it something like (enh) Hyprland support
.
I still face the problem mentioned at https://github.com/joshgoebel/keyszer/issues/137#issuecomment-1454681938. So open a issue to track this