JGCarroll / joplin-desktop-snap

MIT License
18 stars 1 forks source link

using/mounting `~/.config/joplin-desktop` #13

Closed alexanderadam closed 3 years ago

alexanderadam commented 3 years ago

So I saw a theme that I would like to use and its setup says:

Copy userchrome.css and userstyles.css to your joplin-desktopfolder (on Linux, it is located in ~/.config/joplin-desktop)

But Joplin doesn't seem to read it in my case, so my guess is that the Snap is currently not using this directory, right?

Would it be possible to mount that folder within the Snap?

PS: Can I otherwise allow access to paths without building the Snap on my own? I would love to add a Backup directory. Nevermind, I think it's working with the Joplin Snap anyway. Would be interesting anyway, though.

JGCarroll commented 3 years ago

Strict snaps set $HOME to ~/snap/snap-name/current, so Joplin writes its data to $HOME/snap/joplin-desktop/current/.config/joplin-desktop (or snap/joplin-james-carroll/ if people are still on that one).

To get your theme working you probably just need to put it in the right folder in the snaps current, and you can find that folder even easier by clicking on tools in the menus at the top, and then open profile directory. Apart from changing where that folder is, I don't do anything special to it so it should act like the regular folder in every way apart from where it's located.

In theory the snap could access the normal ~/.config/.joplin-desktop fine if I added the permissions, but I'd need to justify it to the Snapcraft mods and they'd likely deny me doing it, so it wouldn't be distributable on the Snap Store itself. Given that there's already thousands of users, it's also something I'd like to avoid having to make a migration strategy for, since it's the kind of thing that would likely risk dataloss if I made mistakes.

Plugins should work the same in the snap as outside the snap unless they are looking for specific places in $HOME due to the variable being modified, or if they're trying to access sandboxed areas. You might want to enable the removable-media interface to let the snap access /mnt and /media, which gets you access to USB drives, other OS disks, etc.

sudo snap connect joplin-desktop:removable-media :removable-media

In the extreme case, you can use a bind mount which works like a symlink, and place it your real $HOME but point it elsewhere. Whilst AppArmor will block symlinks, it doesn't block bind mounts, making it a loophole for being able to save data to arbitrary system locations.

alexanderadam commented 3 years ago

As always your answer was fast and informative.

Thank you so much for explaining these things. In this case I will close this issue..