Launch external editor (Linux, Ubuntu/PopOS, flatpak)

Version: 1.7.11
OS: Pop!_OS 20.10

When I configure an external editor in the Joplin config, it never launches; According to the dev console, for example when using Typora, I get:

internal/child_process.js:267 Uncaught (in promise) Error: spawn /usr/bin/typora ENOENT

Command was: "/usr/bin/typora" /home/fnl/.config/joplin-desktop/edit-b1cd0a6c21c3494480eb12f9af568255.md
at Process.ChildProcess._handle.onexit (internal/child_process.js:267)
at onErrorNT (internal/child_process.js:469)
at processTicksAndRejections (internal/process/task_queues.js:84)

(To avoid potential questions, /usr/bin/typora is a softlink to /usr/share/typora/Typora on my system. And yes, even if I use the latter, direct path, I get the same problem.)

Interstingly, if I try to browse to the binary to use as external editor, none of my Markdown apps show up; For example, Typora gets installed into /usr/share/typora/ but that typora directory doesn't even show up as a folder to open in the share directory.

Any hints what to do next would be greatly appreciated!

If using either the Flatpak or Snap packages, the sandboxing interferes with launching binaries outside of their containers. You can't see your normally installed editors because of mount namespaces (aka fancy chroots).

Both make use of xdg-desktop-portals by default, which means if you press control-e for example to open an external editor, you'll get a list of editors to use assuming that functionality is working (reliant upon having xdg-desktop-portals installed on the host system, which is often default these days, and the editors having .desktop files that actually claims it supports .md/jpg/pdf/etc

As a special case with the Flatpak, you can use flatpak-launch to potentially launch arbitrary programs on the normal filesystem, but I'm not honestly entirely sure how that works, the Flatpak repo has this example

Path: 
/bin/flatpak-spawn
Arguments: 
--host /bin/flatpak run --filesystem=xdg-config/joplin-desktop org.gnome.gedit

That's presumably launching gedit also installed as another flatpak, I don't know if this could point to the native /usr/bin/typora

Ultimately, the official AppImage doesn't have these problems and given this is the official forums, you're encouraged to prefer the AppImage if you're having problems as the other ones are third party support only.

3 Likes

Thank you for the explanations and the solution! I was not aware that flatpak chroots the apps it installs (I am new to PopOS and flatpak). And yes, your above suggestion works, with that I can span other flatpak apps from the (flatpak'd) Joplin. Thanks again!

2 Likes

One amendment for completeness, if others have a similar issue and if you want to spawn non-flatpak apps from a flatpak-installed Joplin, such as Typora (which in turn isn't using flatpak), you can use this configuration instead:

Path: 
/bin/flatpak-spawn
Arguments: 
--host /usr/bin/typora
3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.