-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Triggering Kando over and over crashes dbus-broker, crashing the entire desktop (kwin_wayland) #855
Comments
Hi there! Thanks for the report and sorry for the delayed response (I was ill for the last week or so 🤒). I fear that this will be very hard to debug. The only thing which comes to my mind is that the binding and unbinding of global shortcuts is implemented in a very weird way on KWin/Wayland using KWin scripts. And the hotkeys are unbound and rebound whenever a menu is shown. You could test this - if you run Kando from source and remove this line and this line, this part of the D-Bus communication will be skipped. Instructions for running Kando from source are here: https://kando.menu/compile-from-source/ |
Well, if you find a way to improve this, go for it! Back when I implemented this, I was happy that it worked at all 😅. So let's break this down a bit. There are two scripts used by the backend:
I think our best bet would be to remove this "hack" for binding global shortcuts altogether and use the global shortcuts portal instead. I think by now this is pretty widely supported. I have not yet looked into this - however, I have the fear that this is not designed for our use-case. Currently Kando unbinds a menu's shortcut when the menu is shown so that Turbo-Mode works. I think that unbinding and rebinding a shortcut using the portal will not work without user interaction. But one would need to confirm this. |
Oh man this was such a rabbit hole. Wayland support for advanced use cases is still half baked at best... Two ways of solving it"The Proper Way"The way I understand it, simply switching to the Global Shortcuts API wouldn't really help us here, because we'd still need to register a script that then sends the window / mouse info to Kando. For capturing the position of the mouse, we'd have to switch to the Input Capture API. That would also solve the problem with turbo-mode, as Kando could just handle the key binding by itself and not rely on the compositor handling shortcuts properly. I don't think there is a Node.JS library for actually processing LibEi events, so this would be non-trivial to implement. The only real issue I see with this is that there is currently no way to capture the current window title / class, so that feature would just not work on Wayland for now 🤷♀ I think this would be the right and future proof way to do it moving forward. The Input Capture API is currently only supported on KDE, GNOME and Hyprland, but I think more will hop on later. This would allow us to remove some of the compositor-specific code as well. As for implementing this: The hacky wayWe could move more of the logic into the kwin script. Assuming this is the case, we could rewrite the scripts, so that:
However, this sounds scope-wise more like a full blown kwin extension 🫠 |
Create something like Kando with support for Wayland is indeed really painful. It took me really long to figure out that it is actually possible to register and call KWin scripts via D-Bus. Regarding the "Proper Way"The Input Capture API could potentially solve the issue of Turbo Mode. However, there is a good chance that it does not work. Just as a recap - the events here are as follows:
The real problem of replacing the What could be a solution?Ideally, we would use the global shortcuts portal for binding shortcuts, and hope that it does not interfere too much with Turbo Mode. To get the application title and the pointer position, we will require something which hooks into the compositor. A KWin script is the only thing that I tried - do KWin extensions have more capabilities? For GNOME, I also use a custom extension for providing the required information via D-Bus. Maybe a KWin extension could also provide a D-Bus interface? As you figured out we can use both C++ or any NodeJS code for that. Kando already uses the Remote Desktop Portal via JS under KDE/Wayland, so I am pretty confident that using the Global Shortcuts Portal could work in a similar fashion. |
Short Summary
I use Kando to switch music. This involves triggering it very often in a certain amount of time. This usually eventually leads to a complete crash of the desktop due to dbus-broker (or dbus-broker-launch) crashing (see logs). Especially if I do this very often in a certain amount of time.
Steps to Reproduce the Issue
Example:
watch -n 0.5 flatpak run menu.kando.Kando -m "Main"
Kando Version
v1.7.0
Installation Method
Another method (specify in the comments below)
Desktop Environment
KDE on Wayland
Environment Version
KDE Plasma 6.3.2, OpenSUSE Tumbleweed
Additional Information
I have tested this issue with multiple ways of triggering Kando. Be it through my keyboard, my mouse bound to a key or even the command line, it still does it.
I have also tried to see if this is caused by any of my other extensions. Sadly it occurs even on vanilla Plasma.
The issue happens irregardless of if Kando is run as an AppImage, Flatpak or anything else.
While I do think this is a bug in dbus_broker, the issue also seems partially to be on the side of Kando. I think this could be caused by Kando creating a high amount of chatter, which then crashes dbus. That could however be wrong on my side
Logs:
The text was updated successfully, but these errors were encountered: