Repository navigation
Conversation
|
Hey @hseliger, Thank you for the help! Impressive work. Please bear with me for delays in the review, I'm going through the busiest period of my life and I only have limited capacity for OS at the moment. I'll get back to you as soon as I can, I hope you'll understand :) Cheers :) |
|
Hi! |
|
Would this work for all Wayland? Let's say with Sway? |
|
Since I don't use sway, I can only speak for my setup. Works well for me for many months now, but I use Gnome/Wayland/mutter. For other setups, you could only try and maybe help espanso by adapting code to work on your setup. |
|
Hi! this look good, can you switch the target branch from |
|
Done. Moved the PR to dev. |
|
Hi everyone! Finally got the chance to give this a proper review/thought, sorry for the late reply First of all, thank you for the contribution, the work is impressive, and shows us that app-specific detection is possible in Wayland under Gnome I don't think we should merge the PR as is, as the supported case is quite narrow, and brings additional complexity and dependencies to the project that would only benefit a small portion of users. Thinking about the fragmented nature of Wayland (eg. Gnome, KDE, Sway, etc), and how each of those Desktop environments will require specific implementations to solve this problem, I think the long-term solution would be to introduce a (simple) plugin mechanism to add this functionality. This way, users could install Espanso + the specific plugin for their desktop environment. This could be implemented in several ways. The easiest would be to have "App-Info" plugins be standalone executables that, when invoked, return the current app information as JSON to STDOUT: For example: Espanso could then invoke this binary every time the app information is needed and parse the result. If the binary startup time is significant, we could switch to a different model where instead of invoking the binary on each call, Espanso would invoke it once and receive a streaming update of app information over time (eg. every 2/3 seconds): This PR would serve as the perfect starting point to introduce the first Gnome-specific plugin Thoughts? :) |
|
I think this is a good idea. And you are fully right, the use case for this Gnome/Wayland solution is too narrow and a general plugin system should be more versatile. Wayland seems to require an extension to get to the data, but providing a command line utility to tap into that extension and feed the updates to expanso (or whoever may want them) should be quick to establish. And then it would indeed be easy for others to add KDE and others as well. |
As I mentioned in a recent discussion (#287 (comment)), using a Gnome extension it is possible to get the application filters working.
I created such a version and it is working perfectly for me (with respect to application filters).
2 limitations:
a) It currently only works under Gnome version 41. I have not used KDE in some 20 years (yep, I am that old) and don't know if xfce etc. use Wayland, so it would need someone else to make those ports. I also do not have different versions of Gnome (such as 42, which I guess would be key going forward) available for testing. It requires the
dbus-1library to be installed on the system.b) Since v. 41, Gnome enforces some "security" measures, which mean than applications cannot easily get details on other windows. So it requires a Gnome shell extension. I the discussion I mentioned "Window calls". That one only returns a JSON object, so espanso would have to take that apart. I created a version using rapidJSON, but it kind of bloats espanso and adds a non-standard library. So I opted to pimp (a.k.a. expand) the extension. I got it published on Gnome Extensions yesterday, so you will have to install "Window Calls Extended" (https://extensions.gnome.org/extension/4974/window-calls-extended/) to make application filters work in espanso.
Error handling still is quite simplistic. I also hope that I grasped the cargo build system sufficiently to get the Wayland version compiled without breaking anything else. There is a DEBUG switch in the code: 0 takes all debug stuff out, 1 writes many comments, and 2 even permits native.cpp to the compiled as program, so one can test it (
g++ -o dbus-test native.cpp -std=c++0x $(pkg-config dbus-1 --cflags) -ldbus-1 -Werror -Wall -Wextra).Have a look and merge if you feel it's safe.
– Hendrik