Hey! Does anyone from #GNOME or that works with GNOME technologies know how I can make my #python #GTK4 / #Libadwaita app run in the background when closing ? And how to make it appear correctly in GNOME background app menu, or even in the AppIndicator extension ?
Any link to relevant documentation will be useful ! :)
Thank you in advance!
Emmanuele Bassi
in reply to Krafting • • •you can use the background portal through libportal: libportal.org/method.Portal.re…
Or you can call the DBus method directly: flatpak.github.io/xdg-desktop-…
Background
XDG Desktop PortalKrafting
in reply to Emmanuele Bassi • • •Emmanuele Bassi
in reply to Krafting • • •the basics are:
1. request background access
2. if successful, call Gio.Application.hold() to keep the instance alive even if the window is closed
3. on failure, log the issue and continue as normal
Krafting
in reply to Emmanuele Bassi • • •Krafting
in reply to Emmanuele Bassi • • •@ebassi Welp, I got it almost working. I get an error when trying to compile the flatpak thogh...
"ValueError: Namespace Xdp not available"
I import Xdp in python using
gi.require_version('Xdp', '1.0')
from gi.repository import Xdp
It works by running the script with python script.py but not in the flatpak...
Doesn't the org.gnome.Sdk/47 comes with Xdp ?
Emmanuele Bassi
in reply to Krafting • • •no, libportal is not currently in the run time, I'm afraid; you need to build it inside your manifest, like this: github.com/flathub/re.sonny.Wo…
It's enough to build the library: it comes with its own introspection data that can be loaded by pygobject.
re.sonny.Workbench/modules/libportal.json at master · flathub/re.sonny.Workbench
GitHubKrafting
in reply to Emmanuele Bassi • • •@ebassi do you know if it ever will be in the runtime ?
And thank you very much for the info, I'll try to build it then and use it this way !
Emmanuele Bassi
in reply to Krafting • • •Add libportal to Platform/Sdk (#496) · Issues · GNOME / gnome-build-meta · GitLab
GitLabKrafting
in reply to Emmanuele Bassi • • •