logseq icon indicating copy to clipboard operation
logseq copied to clipboard

custom.css, config.edn, etc. do not function when they belong to read-only filesystems

Open sylvi-3 opened this issue 1 year ago • 1 comments

Search first

  • [X] I searched and no similar issues were found

What Happened?

When the custom.css file (located at /logseqdirectory/graphdirectory/logseq/custom.css) is a symbolic link to a file in a read-only filesystem, the contents will appear in the in-app 'edit custom.css' page, but will not have any effect. The same seems to be the case with the config.edn file within the same directory.

Reproduce the Bug

  1. Create a custom.css file in a read only filesystem, then create a symbolic link in /logseqdirectory/graphdirectory/logseq/custom.css 1a. In my case this means declaring the custom.css file with home-manager.
  2. Launch the logseq application. Enter Settings > Edit custom.css
  3. The text of your linked file should be visible, since it is named correctly and in the right place, but the CSS will never update.

Expected Behavior

custom.css declared using home-manager, or any otherwise valid .css file that is linked from a RO directory, should be read and applied properly by logseq.

Desktop or Mobile Platform Information

NixOS 24.05 Using nixpkgs unstable, home-manager, and nix-flakes Logseq version 0.10.8

Additional Context

I have found a workaround for this issue, which involves declaring the custom.css and config.edn in a nearby directory, then setting home-manager's home.file."filename".onChange setting to a script that copies the file from the directory it's created in to the /logseq directory of my graph.

Are you willing to submit a PR? If you know how to fix the bug.

  • [ ] I'm willing to submit a PR (Thank you!)

sylvi-3 avatar Apr 26 '24 01:04 sylvi-3

I have a similar setup (same OS, nixpkgs branch, home-manager, and flakes, etc) and see the behavior described. However, I think the issue is not that the nix store is read-only but that Logseq does not follow symlinks. To reproduce, just make the symlink point to a file in the same directory:

❯ ls -l custom.css*
lrwxrwxrwx 1 bryton users   16 Sep 25 00:21 custom.css -> custom.css.local
-r--r--r-- 1 bryton users 5499 Sep 25 00:19 custom.css.local

hall avatar Sep 25 '24 04:09 hall

I'm on Ubuntu with read/write files and I can confirm that symlinks do not work for just about anything. I tried config.edn, custom.css, even the entire ~/.logseq folder.

I tend to like to keep data that I like to backup on a separate internal drive, then symlink them into my home directory as needed, rather than navigate backing up my entire home directory.

This also comes into play when trying to manage global vs. graph specific config/css/javascript with many graphs. Logseq tends to really want a local config.edn file, even when there is one in ~/.logseq/config. If no local one is detected, it writes a blank one and ignores most of the global settings (not a bug, just by redefining them locally).

How did everyone (@hall @sylvi-3) use the desktop version here? Flatpak? I actually suspect that the issue might be with permissions in flatpak not knowing how to, or being prevented in, handling symlinks.

clemtibs avatar Feb 05 '25 22:02 clemtibs