Created attachment 161254 [details] Screencast showing auto-close of Flatpak apps on Wayland and X11 sessions SUMMARY On Wayland session xdg-desktop-portal-kde mistakenly detects that Flatpak app as running in the background. Then it shows "special" notification. With many popular Flatpak apps (e.g. org.libreoffice.LibreOffice, org.mozilla.firefox, com.google.Chrome) dialog appears right after program launch. Notification has "Find out more" button. if the user clicks on it, a dialog will appear that will inform that app is running in the background so user need to either "Allow" it or "Force quit". If user simple closes this dialog, action "Force quit" will be chosen automatically and application will automatically close as well. After subsequent launches, the program will close automatically in a few second. As a workaround user needs to override "background" permission with some GUI (like "Flatseal") or command flatpak permission-set background background org.mozilla.firefox yes STEPS TO REPRODUCE (also attached screencast) 1. Login into Wayland session (easier to reproduce) 2. Install some application from Flathub flatpak install flathub org.mozilla.firefox 3. Launch installed app flatpak run org.mozilla.firefox 4. Few seconds after launch notice notification about "Background activity" 5. Click "Find out more" button 6. See dialog with a question about "Background activity" and buttons "Allow", "Force quit". 7. Close this dialog (application will be closed automatically) 8. Relaunch Flatpak application OBSERVED RESULT Application silently closes EXPECTED RESULT KDE Portal should not detect "Background activity for visible applications. KDE Portal should not set "Background" permission if the user closes the dialog and does not select any action, SOFTWARE/OS VERSIONS Linux: Fedora 38 Kinoite KDE Plasma Version: 5.27.7 KDE Frameworks Version: 5.109.0 Qt Version: 5.15.10 ADDITIONAL INFORMATION As you can see from the screencast, on X11 session KDE Portal have far less false detects of "Background activity". However if permission "Background" is set as denied, apps on X11 session will auto-close as well. Related bugs: https://bugs.kde.org/show_bug.cgi?id=466325 https://bugs.kde.org/show_bug.cgi?id=468805 https://github.com/flathub/org.libreoffice.LibreOffice/issues/249
I just re-installed a bunch of applications and the user experience is pretty bad. Gimp is throwing up warnings whilst it clearly has windows open because the IDs don't match. I don't see why we should be inhibiting apps from running in the background on the desktop in the first place. We don't have to do stuff just because Gnome pushes it. I would fully support removing this until a time where the situation works better.
Agreed. UX parity with non-flatpak apps is more important here IMO.
(In reply to David Edmundson from comment #1) > I don't see why we should be inhibiting apps from running in the background > on the desktop in the first place. We don't have to do stuff just because > Gnome pushes it. I would fully support removing this until a time where the > situation works better. I would be all in favour of this. The background activity popups are a reoccurring annoyance that I could absolutely do without, if possible. :)
A possibly relevant merge request was started @ https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/merge_requests/246
Git commit dbe20a183509465bb7b230cb1b7d31d1aed9fbe9 by David Edmundson. Committed on 10/11/2023 at 17:40. Pushed by davidedmundson into branch 'master'. Default to allowing background applications without prompts Flatpak tends to have a lot of applications with window IDs that do not match the containment, particularly with X11 applications. There is also the UX question of why we shouldn't an app run in the background, KDE has support for systemtrays with both X11, and the FD.O standard which most apps running in the background would populate. This patch always returns "Allow once" when prompted by the daemon. Whilst this might seem like a lazy solution, from what I can tell from a lot of DBus montioring on Gnome, this is what they do too. We can't just disable the portal implementation as disabling by the config file doesn't work, but even if did we still want enableAutostart to work. I left the original code behind a configuration option in case we want it for mobile. M +31 -26 src/background.cpp https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/commit/dbe20a183509465bb7b230cb1b7d31d1aed9fbe9