https://bugs.kde.org/show_bug.cgi?id=470438

kwvanderli...@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kwvanderli...@gmail.com

--- Comment #1 from kwvanderli...@gmail.com ---
Did some digging on this as I encountered the same problem on Linux Mint with
Okular 24.05.1. I'm not an expert with the tech involved, but the issue seems
to be a combo of collisions between D-Bus service names and lack of permissions
on the flatpak itself.

For flatpak permissions, okular needs to have access to the session bus since
it needs to discover the other okular services. But the flatpak does not have
this permission set by default and so the user has to enable it explicitly.

For the D-Bus service name, okular includes the PID, which normally results in
separate a D-Bus service for each okular process. But under flatpak, the PID is
always the same due to running under a separate PID namespace (e.g., I always
see a PID of 2). So when okular is already running, and we try to open a new
document from the file explorer, the new okular process will have the same PID
and D-Bus service name as the existing process. So even if the new process
could discover the existing process service, it will think it just discovered
itself and won't send the new paths over to the existing process.

As a workaround, here's what I did to get the flatpak to open docs in new tabs
instead of new windows:
1. Add the `socket=session-bus` permission, e.g., through flatseal. This is
generally not recommended by flatpak, but is required for service discovery.
2. Enable PID sharing with the top-level namespace, which will give each okular
process a distinct PID. Instead of `flatpak run org.kde.okular`, use `flatpak
--parent-pid=1 --parent-share-pids run org.kde.okular`.

I think the ideal (from a flatpak perspective) would be for okular to use one
d-bus service with a consistent name rather than having a unique service
per-process. This way the flatpak would only need permission for that
particular service instead of the entire session bus. It would also mean there
would be no issue with PID collisions, so those would not have to be shared
with the parent namespace.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to