Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommandSet freeze qtile in Wayland #4646

Open
2 tasks done
matchatealeaf opened this issue Jan 14, 2024 · 6 comments
Open
2 tasks done

CommandSet freeze qtile in Wayland #4646

matchatealeaf opened this issue Jan 14, 2024 · 6 comments

Comments

@matchatealeaf
Copy link

Issue description

Here's a minimal example.

Add the following to default config.py:

from libqtile import extension

keys.append(Key([], "print", lazy.run_extension(extension.CommandSet(
    commands={
        'Test1': f'{terminal} htop',
        'Test2': f'{terminal} lf',
    },
))))

In X11, press print screen and dmenu appear with Test1 and Test2 options.

In Wayland, press print screen and qtile freeze and have to be killed in another tty.

> WAYLAND_DEBUG=1 qtile start -b wayland

amdgpu: amdgpu_cs_ctx_create2 failed. (-13)
[2286429.151]  -> wl_display@1.get_registry(new id wl_registry@2)
[2286429.168]  -> wl_display@1.sync(new id wl_callback@3)

Version

0.23.0

Backend

Wayland (experimental)

Config

No response

Logs

2024-01-15 00:38:50,650 ERROR wlroots log.py:log_func_callback():L15 [EGL] command: eglQueryDevicesEXT, error: EGL_BAD_ALLOC (0x3003), message: "EGL_BAD_ALLOC error: In eglQueryDevicesEXT: Failed to allocate device list.
"
2024-01-15 00:38:50,650 ERROR wlroots log.py:log_func_callback():L15 [EGL] command: eglQueryDevicesEXT, error: EGL_BAD_ALLOC (0x3003), message: "EGL_BAD_ALLOC error: In eglQueryDevicesEXT: Failed to allocate device list.
"

Required

  • I have searched past issues to see if this bug has already been reported, and it hasn't been.
  • 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.
@elParaguayo
Copy link
Member

Do the commands work in Wayland if you bind each of them to a key and use lazy.spawn?

@jwijenbergh
Copy link
Contributor

can reproduce, investigating...

@jwijenbergh
Copy link
Contributor

threading issue. We have to run the commandset run commands in a separate thread. (not a proper fix but you get the idea where the bug is):

diff --git a/libqtile/extension/command_set.py b/libqtile/extension/command_set.py
index 8143fee0..da1a2638 100644
--- a/libqtile/extension/command_set.py
+++ b/libqtile/extension/command_set.py
@@ -78,22 +78,27 @@ class CommandSet(Dmenu):
             for cmd in self.pre_commands:
                 self.qtile.spawn(cmd)
 
-        out = super(CommandSet, self).run(items=self.commands.keys())
-
-        try:
-            sout = out.rstrip("\n")
-        except AttributeError:
-            # out is not a string (for example it's a Popen object returned
-            # by super(WindowList, self).run() when there are no menu items to
-            # list
-            return
-
-        if sout not in self.commands:
-            return
-
-        command = self.commands[sout]
-
-        if isinstance(command, str):
-            self.qtile.spawn(command)
-        elif isinstance(command, CommandSet):
-            command.run()
+        def r ():
+            out = super(CommandSet, self).run(items=self.commands.keys())
+
+            try:
+                sout = out.rstrip("\n")
+            except AttributeError:
+                # out is not a string (for example it's a Popen object returned
+                # by super(WindowList, self).run() when there are no menu items to
+                # list
+                return
+
+            if sout not in self.commands:
+                return
+
+            command = self.commands[sout]
+
+            if isinstance(command, str):
+                self.qtile.spawn(command)
+            elif isinstance(command, CommandSet):
+                command.run()
+
+        import threading
+        t = threading.Thread(target=r, name="CommandSet")
+        t.start()

will make a proper pr later

@matchatealeaf
Copy link
Author

Thanks, this indeed solved the problem.

Copy link

This issue is stale because it has been open 90 days with no activity. Remove the status: stale label or comment, or this will be closed in 30 days.

@elParaguayo
Copy link
Member

Does #4750 fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants