Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Feature request) Fully adhere to the XDG Base Directory Specification #3885

Open
Zocker1999NET opened this issue Apr 29, 2023 · 3 comments
Open

Comments

@Zocker1999NET
Copy link

Describe feature

(I describe this for Linux systems as I use Linux myself, however Windows & Mac OS X should have similar cache directories and as the same arguments apply, Trilium should move the "Electron cache" to their appropriate locations as well).

Currently, due to Trilium being based on Electron, Trilium creates a .config/Trilium Notes (default location for XDG_CONFIG_HOME) directory, which contains all data Electron (or Chromium) requires to be executed. Currently, because it is placed there, most backup software will backup it as well because it might contain valuable user configuration files. However, in the case of Trilium, this directory was bloated with about 800 MiB of files in my case (for referece, Trilium's own data directory was 827 MiB). Further examining revealed that most data there were images I stored in Trilium, which the Electron front-end cached there.

Now that Electron finally recently introduced the ability for app developers to change the location of this directory (see electron/electron#33554), and Trilium does not really depend on that stored in this directory as I tested myself by removing it and also like described here, this may only be cache directory for Trilium.

So I propose to change the location of this directory to $XDG_CACHE_HOME (defaulting to ~/.cache if not set) immediately so Trilium fully adheres to the XDG Base Directory Specification.

Additional Information

Further work might even be able disable this overall doubled caching of images, as this unnecessarily still requires more disk space, more disk I/O usage and so more wear out of SSDs. But I assume that this might be nearly impossible as long as Trilium is based on Electron / Chromium. But my proposal from above should be really easy to just implement for the advantages it already brings with (cleaning software might automatically remove those data, others might have their cache directory always in RAM, backup software can more easily exclude backing up this data, …).

And: I really, really appreciate your work and absolutely love this app.

@zadam
Copy link
Owner

zadam commented Apr 29, 2023

I'll add this to a backlog, I guess first we'll have to do an electron upgrade which is currently planned for 0.61.

@zadam zadam closed this as completed Apr 29, 2023
@zadam zadam added this to the backlog milestone Apr 29, 2023
@Zocker1999NET
Copy link
Author

okay, makes sense, thanks for your work.

For folks who want this right away:

mv -i "${XDG_CONFIG_HOME:-$HOME/.config}/Trilium Notes" "${XDG_CACHE_HOME:-$HOME/.config}/Trilium Notes Hotfix" \
&& ln -is "${XDG_CACHE_HOME:-$HOME/.config}/Trilium Notes Hotfix" "${XDG_CONFIG_HOME:-$HOME/.config}/Trilium Notes"

@zadam zadam reopened this May 16, 2023
@zadam
Copy link
Owner

zadam commented May 16, 2023

Reopening, it was closed by mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants