qewer33/Exquisite

Option to open Exquisite using only the mouse

emvaized opened this issue ยท 7 comments

Exquisite seems to be a lot of mouse-oriented utility, so I think it should provide a simple way to launch it using only the mouse.
Maybe some sort of system tray applet would be enough, which will launch it using dbus.

If there already is such a way, README should mention it.
Thanks

There currently isn't any way, never worked with DBus calls on scripts/widgets before so can't promise anything but I will definitely take a look

Thanks! DBus was just a suggestion, I'm not actually sure how this thing is usually done...
I came to this conclusion because "Activate Latte launcher" KWin script uses DBus call to activate it from the outside.

I spent some time digging into this, documenting my findings so I have it in writing to hopefully help someone else and so it's not just in my head.

I have a proof of concept of a Qt system tray icon with DBus calls working in C++.

The challenge now is how to initiate Exquisite from the system tray. I've looked into DBus and while I can figure out how to send a signal to KWin, there doesn't appear to be an API for a KWin script to actually listen to an incoming DBus signal, only for it to initiate an outgoing signal. There is an open bug requesting this kind of feature here: https://bugs.kde.org/show_bug.cgi?id=445129

I can call the KWin scripting API with org.kde.kwin.Scripting.loadScript and org.kde.kwin.Scripting.start, but Exquisite doesn't display its UI on load.

There could be a "Launch with system tray" option in the settings, but this would mean you'd have to disable the hotkey listener so that a DBus call to load the script immediately launches the tiling UI, with the system tray application now handling the hotkey launching. The problem with this solution is now you don't have an easy way to access the settings window unless you break that out into a separate KWin script that could separately be loaded and run via DBus calls so it can be launched from the tray applet or a button in the main UI.

A hail-mary alternative would be to rewrite the application in Python or C++, which would give you simple access to a Qt tray icon and a DBus interface for both sending and receiving signals, but that isn't a small ask, though I'd be willing to approach it if @qewer33 is interested.

I need to go work on my actual job, but I'm going to keep thinking on this. It's not a use case I specifically need (I prefer the hotkey), but it's been a good crash course introduction into Qt, C++, and DBus. I have no real experience with any of these technologies before now so there may be something obvious I'm missing here, feedback is welcome.

Thanks for your research! but I feel like I have found the ideal solution. Just pushed a simple widget under the widget/ subdirectory. It is fairly simple, has a configurable icon and just toggles the state of Exquisite when clicked.

What I found was you can invoke KWin shortcuts via dbus, so all the widget has to do is to execute:

qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Exquisite"

I will be really happy if you guys can test it in your free time, seems to work fine for me but it's always better to test new stuff in different cases.

I also need to look if I can have the widget installed alongside when Exquisite is installed, adding dependencies is possible with Global Themes but not sure about other extensions.

As for the rewrite question @Zetaphor, I may possibly rewrite Exquisite in the future with Rust (it will be blazingly fast trust me) but that would probably mainly be for supporting the entire Linux desktop/wm ecosystem rather than just KDE. Still quite a far idea from now though.

I just tested the new widget, and I'd say it is just perfect! Does exactly what it's supposed to.
Perhaps would be cool to make the main install.sh script install the widget

What I found was you can invoke KWin shortcuts via dbus, so all the widget has to do is to execute:

qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Exquisite"

So simple and yet so obvious!

I can also confirm the widget works.