native_messenger icon indicating copy to clipboard operation
native_messenger copied to clipboard

Support installation in Flatpaks.

Open gebner opened this issue 1 year ago • 0 comments

Running the current installer doesn't work for the Flatpak version of Firefox no matter whether you run it inside the sandbox or outside on the host. The .mozilla and .local directories are different in the sandbox, running the script outside the sandbox simply has no effect whatsoever. Running it inside the sandbox doesn't work either, the .local directory is wiped on restart and the HOME environment variable is unset. (There are installation instructions in the main Tridactyl readme that claim to work for the Flatpak version, but they simply don't.)

This PR makes it possible to successfully install the native messenger in the Flatpak version of Firefox:

curl -fsSl https://raw.githubusercontent.com/gebner/native_messenger/flatpak/installers/install.sh | bash

(You can also run the installer inside the sandbox, using flatpak enter org.mozilla.firefox bash. This didn't work either.)

There are two challenges here:

  • The .local directory inside the sandbox is not persisted, i.e., it gets wiped every time you restart Firefox. Therefore the PR installs the native binary in ~/.mozilla/native-messaging-hosts/ instead of ~/.local/share.
  • The .mozilla directory inside the sandbox is bind-mounted from ~/.var/app/org.mozilla.firefox/.mozilla/ on the host, so the installer needs to know about both the host and sandbox paths. The PR changes the installer to put the native messenger in both the ~/.mozilla and all ~/.var/app/*/.mozilla directories it can find.

gebner avatar Nov 14 '23 23:11 gebner