KDE warning if Flatpak-app goes into background mode (on LibreOffice as example)

Hi !

I have here described the situation, which I encounteted on Fedora Silverblue with KDE (Fedora Kinoite).

I did not find her description on the Internet and on the forums of KDE and LibreOffice. Maybe this description will be useful to someone.

Description of the problem:

After installing LibreOffice, the first time, when its main window is overlapped by the window of another application, a warning appears to the (Fig.1, lower right corner of the picture) :

when you click the “Find out more” button, a dialog box will appear (Fig.2, lower left corner of the picture) :

After pressing the “Force Quit” button in it,LibreOffice application closes. For all subsequent launches, it closes automatically ~30 seconds after launch without warning. I found, that this behavior is peculiar only to KDE when it runs on Wayland. When KDE work on x11, this behavior does not occur. A GNOME on Wayland does not have such behavior.

How do I get the LibreOffice to work and allow me editing documents, and not go down after 30 seconds or 1 minute ?

Solving the problem:

I found a description of similar problems on the Internet, the main reason here were problems with the hardware graphic acceleration functions that LibreOffice uses. Having investigated my situation in this direction, I did not succeed. This was the reason for my post here:

https://forum.kde.org/viewtopic.php?t=173186 and here LibreOffice crash stable on Kinoite + AMD graphic - #2 by jpbn .

Also, no other settings of the LibreOffice, OS and KDE did not allow the LibreOffice to return to working condition. Now, after the research I have done, I can reliably reproduce this behavior of the LibreOffice and reliably bring it into working condition.

Without analyzing the sources of the KDE and LibreOffice, I assume that the reason for this behavior of the LibreOffice on KDE (or maybe any other Flatpack application) is that Wayland monitors the z-position of the application windows and reports this information back to the applications (this does not occur on X11) and the Flatpack uses this. If it is overlapped of the window of another application, i.e. it is inactive now, and work with this application is not currently underway, Flatpak inform KDE about it and it responds to this message GNOME, apparently does not respond to this message). First, a warning appears as in Fig.1, then KDE gives the user the opportunity (Fig.2) to allow or prohibit the application to work, when it is overlapped by another application, i.e. in this case – works in the background.

The results of the answer to this question will be saved in a file ~/.local/flatpak/share/db/background . Its contents determine whether the application will run in the background (when the application window is not on the surface) or not (in GNOME, this folder always remains empty).

Deleting this file will lead to the fact that, as in the first time, a question will be asked as in Fig.1 and Fig. 2. Here you can select “Allow”, if someone has previously chosen “Force Quit”, and the application will be allowed to work when it is overlapped by other windows and it will work reliably. I checked – not all Flatpak applications behave this way. I’ve only seen this at the LibreOffice.

Thanks.

3 Likes

I have to wonder why you are introducing the vagaries of a flatpak when LO is directly available as rpm on fedora.

I suspect that if you were to remove the flatpak and install the rpm version it would work as intended. I have never used the flatpak version and never seen the issue you describe.

OOPS: I looked at the tags and see you have both silverblue and kinoite marked. That may explain the flatpak, but is not mentioned in the discussion.

Yes, I tested this situation on a classical Fedora KDE Spin and everything works fine without these situations.

When the LibreOffice is launched only under the Flatpak shell, this situation arises. I am not sure, that the situaton will appears on classical Fedora KDE Spin, if we will there using Flatpak.

I will edit the post so, that it can be clearly seen, that we are talking about Silverblue with KDE.

1 Like

Hi,

We could also allowing the flatpak app to run in background with permission-set. For LibreOffice we could use $ flatpak permission-set background background org.libreoffice.LibreOffice yes. Please notice there are two background to type.

By the way there a command flatpak permissions to check all permissions of installed package. Or using flatpak permission-show org.libreoffice.LibreOffice to show certain app permission, in this example LibreOffice. But my understanding this only show permissions set by user and not default permission.

There also some other commands related to app permission. Please refer to flatpak documentation.

I believe this things should be reported to Fedora Kinoite maintainer to add LibreOffice as something like white list to run in background by default.

Update:

Just found other post on ask Fedora related to LibreOffice flatpak here. May be this also the same problem with what happen here. If that true, not only need to report to Fedora Kinoite maintainer, but also to Fedora KDE spins maintainer.

I saw this post and tried to reproduce this situation at myself.

For me, if the background mode permissions are set to “no”, LibreOffice does not work on Wayland and on X11 the same way. So, I think, that not exactly this problem is described here.

I would be gratefull if you can me say the right place, where i can write about the problem to KDE SIG.

Thanks.

I looked at my permissions for Flatpak-applications and I have a question. Where else, besides the directory ~/.local/flatpak/share/db/background, is stored the permissions table?

The reason for the question is that I started LibreOffice on X11, it did not ask me for permission, but it worked well and the directory ~/.local/flatpak/share/db/background was empty.

Does this mean that the permissions table is stored somewhere else in the /var/lib/flatpak… directory for example?

Thanks.

From my understanding, if LibreOffice by default allowed to run in background, there will no saved setting in ~/.local/share/flatpak/db/ folder. It’s only present if user customized it.

I managed to find old post related to flatpak functionality by default here.

Hades who are labeled as contributor said:
You need to have 2 moving parts here, whether the application is allowed to run in the background, and whether the app requested to be run in the background. The first one needs to be provided by a Flatpak portal, and be designed such that it allows the creation of a configuration panel to control the toggle, and a store for the application to ask to be run in the background. Again, this cannot be solely under the application’s control as you’d likely want to be able to enable the functionality by default, but still control whether the app gets its wish in the configuration dialogue.