Setting up Language Tool as an external editor

So, a bit of an introduction: I'm using Joplin on my Ubuntu 22.04.3 LTS Desktop and I have both Joplin and LanguageTool available in the Software Center.
When no file path for the external editor is specified in the Options and I click on the external editor button, Joplin lets me choose between the default text editor (Gedit I guess) and Libreoffice.
I want to add Language Tool to the list so in a terminal I type the which command:

which languagetool
/snap/bin/languagetool

Then I go back to the option panels, and to be sure, I personally browse the directories.
Indeed, if I personally click the executable found on that path, the output in the Options tab is pretty different.

/run/user/1000/doc/8d133320/languagetool

And the external editor button doesn't work anymore. It doesn't open anything. I guess it's more of a problem of languagetool, or at least the version distributed for Ubuntu. There it is any workaround?

Assuming that you're using the Joplin Snap application, you might find this section of its README helpful.

Thank you, but not. I'm not knowledgeable of Linux in a way that I can make sense of this. Especially because languagetool's executable doesn't sit in the home directory.

The interface that pops up is the XDG File Open portal. There's a fairly big difference between the way Gnome handles it than with e.g KDE.

For Gnome, it'll search your applications for those which report themselves to support .md files. It gets this by looking at their .desktop files, which is basically a text file with some metadata that says where their logo is, what name they should have in the start menu, etc. With KDE, it follows this as default but has an option to show all installed applications if the default set might not be appropriate.

You'd need to either have the languagetool snap provide a .desktop file that claims to support .MD files, or create your own that does the same. There's apps such as MenuLibre that can help with this, but in general; it's just placing a second modified .desktop file into ~/local/share/applications ( I think, path might be wrong ). It'll have higher priority than the snaps default one if modified there.

That said unfortunately the two snaps are likely to still not get along because the sandbox of languagetool wouldn't just let it access the private area for Joplin. There's some work in Ubuntu 23.10 that might allow for this to work; and in theory I've already done some work in the Joplin snap itself that means that it should be attempting to work around the sandbox issues already even on older distros but the implementations don't seem to actually work for it unfortunately.

Unfortunately the path in the Joplin settings would likely never be supportable in the snap and I'd be keen in the future to rework it slightly. The only thing that works in the Joplin snap is xdg-open, which wraps the portals it already uses and is always the implicit default. You can add an argument of --ask which will always force the select app UI to appear, otherwise the choices can become default and it will stop asking after choosing the same app 3 times successively. The --ask parameter is entirely custom to the snap and wouldn't work anywhere else.

In summary, if you really do want languagetool to work with Joplin, you'd likely need to just use the Joplin AppImage (for now at least).

1 Like

I'm not that upset about that, TBH. I've tried to use the Ubuntu version of LT, and saying that it's primitive is an understatement. Furthermore, I discovered that LanguageTool has an extension for LibreOffice, so I can set up LibreOffice as an external editor, and I've obtained what I wanted