opened 09:36PM - 02 Jan 26 UTC
closed 09:45PM - 02 Jan 26 UTC
**Is your feature request related to a problem? Please describe.**
Whonix curr…ently uses the LXQt desktop environment, and ships an AppArmor-confined Tor Browser for security reasons. Tor Browser's usual behavior is to first try to access an already-running or D-Bus-activation-configured file manager using the `org.freedesktop.FileManager1` interface. If that fails, it then launches the default file manager (probably through something like xdg-open I'm guessing) directly. Due to the AppArmor profile however, Tor Browser can't directly launch the file manager (the profile doesn't permit it to), and allowing it to launch the file manager unconfined would potentially allow the browser to escape confinement if compromised.
The obvious workaround for this is to simply ensure PCManFM-Qt is always running in the background, using something like `--daemon-mode`. Unfortunately, due to the memory-constrained environments Whonix is designed to run in, this is non-ideal (it may only be 40 or 50 MB of RAM consumed, but we already have one upstream project pressuring us to stop consuming more RAM because it's causing problems).
For this reason, it would be very useful if PCManFM-Qt could be launched via D-Bus activation, similar to Thunar. This would allow the file manager to be launched unconfined without allowing Tor Browser to escape the AppArmor confinement. It would also eliminate the need to run PCManFM-Qt in the background at all times (it could be launched on-demand).
I tried configuring D-Bus activation by dropping a very simple D-Bus service into `/usr/share/dbus-1/services` that simply launched `pcmanfm-qt` when triggered:
```
# In file /usr/share/dbus-1/services/org.lxqt-project.pcmanfm-qt.service
[D-BUS Service]
Name=org.freedesktop.FileManager1
Exec=/usr/bin/pcmanfm-qt
```
This does allow Tor Browser to launch PCManFM-Qt, but it ends up opening the home folder the first time, rather than the folder the user expected to be opened. The following error is also displayed on the console when this occurs:
```
Failed to query file manager via ShowItems: GDBus.Error:org.freedesktop.DBus.Error.UnknownObject: No such object path '/org/freedesktop/FileManager`'
```
I tried also combining this with a systemd user service, but ended up with similarly problematic results.
**Describe the solution you'd like**
* Ship a file under `/usr/share/dbus-1/services` that allows PCManFM-Qt's to be launched via D-Bus activation.
* Fix whatever causes the error message above (this doesn't happen with Thunar, but why is unclear). https://unix.stackexchange.com/a/787633/535873 might be relevant here?
**Describe eventual alternatives you've considered**
Use PCManFM-Qt in daemon mode, but this has resource consumption concerns as explained above. We might also be able to write a lightweight daemon that listens for a file manager launch request, execs PCManFM-Qt with the appropriate arguments when requested, and then wait to start itself again until PCManFM-Qt is closed. (This is something we could do downstream as a stop-gap, I don't think this would be the right solution for LXQt.)
##### Context
This is the bug report we got that inspired this feature request: https://forums.whonix.org/t/is-catfish-the-new-default-in-the-qubes-domain-open-file-manager-quick-widget-for-whonix/20233/22