Repository: qtile/qtile

Issue:
[wayland] Keyboard stopped working on master
### Issue description

I updated to the newest version and found myself not being able to use the keyboard (using wayland). The mouse still worked.
I created the issue for awareness and will help debug this in the next few days.
Not working on: 0.25.1.dev5+ga890670d
Reverted back to: 0.23.1.dev65+g2e89b757 (working here, with the rest of the system identical)

Gentoo Kernel: 6.8.6-gentoo-dist #1 SMP PREEMPT_DYNAMIC Sat Apr 13 15:30:53 -00 2024 x86_64 12th Gen Intel(R) Core(TM) i9-12900H GenuineIntel GNU/Linux

Thank you for your hard work on this!

### Version

master -  0.25.1.dev5+ga890670d

### Backend

Wayland (experimental)

### Config

_No response_

### Logs

_No response_

### Required

- [X] I have searched past issues to see if this bug has already been reported, and it hasn't been.
- [X] I understand that people give their precious time for free, and thus I've done my very best to make this problem as easy as possible to investigate.


Discussion:
Does nothing of the keyboard work? What about another keyboard? Did you check ~/.local/share/qtile/qtile.log?
I checked the logs, nothing out of the ordinary
I can try out an external keyboard (i am on a laptop)
i have the same problem, this is my qtile.log 
``` 2024-04-15 17:48:30,400 ERROR pywayland.server listener.py:notify_func():L42 Exception in callback function
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/usr/local/lib/python3.11/dist-packages/libqtile/backend/wayland/core.py", line 438, in _on_new_input
    device = self._add_new_keyboard(wlr_device)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/libqtile/backend/wayland/core.py", line 1156, in _add_new_keyboard
    device = inputs.Keyboard(self, wlr_device, keyboard)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/libqtile/backend/wayland/inputs.py", line 210, in __init__
    self.qtile = core.qtile
                 ^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/libqtile/command/base.py", line 281, in __getattr__
    raise AttributeError(f"{self.__class__} has no attribute {name}")
AttributeError: <class 'libqtile.backend.wayland.core.Core'> has no attribute qtile
2024-04-15 17:48:30,415 ERROR pywayland.server listener.py:notify_func():L42 Exception in callback function
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/pywayland/server/listener.py", line 40, in notify_func
    callback(listener, data)
  File "/usr/local/lib/python3.11/dist-packages/libqtile/backend/wayland/core.py", line 449, in _on_new_input
    if self.qtile:
       ^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/libqtile/command/base.py", line 281, in __getattr__
    raise AttributeError(f"{self.__class__} has no attribute {name}")
AttributeError: <class 'libqtile.backend.wayland.core.Core'> has no attribute qtile
2024-04-15 17:48:30,521 WARNING libqtile prompt.py:_configure():L440 Prompt widget only supports audible bell under X11
2024-04-15 17:48:30,521 WARNING libqtile core.py:set_keymap():L1545 Could not set keymap: no keyboards set up.
2024-04-15 17:48:30,545 WARNING libqtile core.py:set_keymap():L1545 Could not set keymap: no keyboards set up.
2024-04-15 17:48:33,384 WARNING libqtile core.py:set_keymap():L1545 Could not set keymap: no keyboards set up.
2024-04-15 17:48:43,314 WARNING libqtile core.py:set_keymap():L1545 Could not set keymap: no keyboards set up.
```
can repro, investigating...

Resolving patch:
diff --git a/libqtile/backend/wayland/core.py b/libqtile/backend/wayland/core.py
--- a/libqtile/backend/wayland/core.py
+++ b/libqtile/backend/wayland/core.py
@@ -446,7 +446,7 @@ def _on_new_input(self, _listener: Listener, wlr_device: input_device.InputDevic
         self.seat.set_capabilities(capabilities)
 
         logger.info("New device: %s %s", *device.get_info())
-        if self.qtile:
+        if hasattr(self, "qtile"):
             if self.qtile.config.wl_input_rules:
                 device.configure(self.qtile.config.wl_input_rules)
         else:
diff --git a/libqtile/backend/wayland/inputs.py b/libqtile/backend/wayland/inputs.py
--- a/libqtile/backend/wayland/inputs.py
+++ b/libqtile/backend/wayland/inputs.py
@@ -207,7 +207,6 @@ def configure(self, configs: dict[str, InputConfig]) -> None:
 class Keyboard(_Device):
     def __init__(self, core: Core, wlr_device: InputDevice, keyboard: WlrKeyboard):
         super().__init__(core, wlr_device)
-        self.qtile = core.qtile
         self.seat = core.seat
         self.keyboard = keyboard
         self.grabbed_keys = core.grabbed_keys


Test patch: