There is a Linux application that collects activities in the current GUI session: once every time it takes a screenshot of the screen and writes down the name (title) of the window that is in focus and the name of the application that launched this window. The application works as if the session is running in x11. Now we need to add support for the application to run in the wayland environment on Ubuntu 22.04.
I tried to take screenshots in the wayland environment via the gnome dbus API (1), but every The “Share this screenshot with the requesting application” window pops up once. What I tried to fix: use the Screenshot method from here but errors occur, described here. I read somewhere that if you use this API and not (1), then there will be no pop-up window. This is not true?
I tried to get the title/name of the application through the gnome dbus API Eval method, but on ubuntu 22.04 this only works in unsafe mode. What I tried to fix: here there is an example of getting the title/name of an application without using Eval, but it gives errors, described here. I also found where examples with code determine the title/name of the application correctly, but not for all windows.
In general, the application should be able to do 2 things on ubuntu 22.04 wayland:
- Take screenshots without screen flickering or pop-up messages.
- Receive the title and application name of the window that is in focus, without going into unsafe mode
Can this be achieved?