Skip to content
New issue

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

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

Already on GitHub? # to your account

userContent.css does not apply to newtab or sidebery when installed from nix flake #96

Open
maxbol opened this issue Jan 17, 2025 · 11 comments

Comments

@maxbol
Copy link
Contributor

maxbol commented Jan 17, 2025

Testing on MacOS.

When I install testfox via the script on after manually installing Firefox 134.1, everything works as expected.

When installing it via the flake together with home manager installed firefox-unwrapped 134.0 (only currently Mac OS-installable nix package of Firefox), about:config and most other about pages are styled using user content css. However, about:home/newtab and sidebery are completely unstyled by textfox.

When running a recursive diff of the profile chrome between these two scenarios, they are identical with exception of config.css not existing in the manual install. Adding the nix-created config.css does not cause the styling in the manual install to stop working, so even with a 100% identical chrome/, there is a difference in behavior.

I have verified that user.js works in both cases and that all settings defined within it have the right value in both installations.

Edit: userChrome.css works perfectly in both installations.

@adriankarlen
Copy link
Owner

I am not using Nix so I can't for sure say that this is related, but on macOS I initially symlinked the chrome dir, this seemed to cause the /content dir to not be resolved properly when importing inside of userContent.css. Causing the same issue, copying instead of symlinking resolved the issue.

I'm not sure how Nix does it but could the issue be similar?

If so the issue is not with Nix itself but with how macOS handles symlinks I think.

@maxbol
Copy link
Contributor Author

maxbol commented Jan 17, 2025

I just tried installing the firefox-unwrapped package directly through home manager (without using the programs.firefox option at all (or the textfox nix flake)), and simply running the install script, and this works as expected. So this, at least, precludes any differences between the .dmg distribution of Firefox and the nixpkg to be the source of the issue.

Yes, as you say, home-manager (through nix) is linking all configuration files into the nix store (essentially the textfox chrome folder becomes a "package" or derivation that lives in the nix store and each .css file in my personal dotfiles becomes a symlink into that package). If the issue has to with what you say about MacOS, @import directives and symlinks, that at least gives me something to look into further. It would be interesting to know exactly why some css (userChrome.css, content/about.css via userContent.css) applies while other css does not.

Edit: As a quick test, I moved the script-installed userContent.css from my chrome folder into a tmp directory, and then symlinked it back in place (all other .css are real files). This immediately made about:home and sidebery css break (although, again, about:config, about:settings etc have font stylings from textfox. Interesting!)

@adriankarlen
Copy link
Owner

adriankarlen commented Jan 17, 2025

Interesting finds I assumed the issue would be with the directory not the actual userContent.css.

I'm not at the computer so I can't test rn, but do you get the same issue when symlinking the content-dir?

If so this suggests that actual issue with this is how Firefox loads the file rather than the imports failing.

@maxbol
Copy link
Contributor Author

maxbol commented Jan 19, 2025

I'm not at the computer so I can't test rn, but do you get the same issue when symlinking the content-dir?

Yes, same issue.

@maxbol
Copy link
Contributor Author

maxbol commented Jan 19, 2025

A bit of a weird fix, but I've managed to get everything working on my end using this branch:

https://github.com/maxbol/textfox/blob/copy-on-activation-mode/nix/hm-module.nix

What it does is create a new option for the textfox module called copyOnActivation. If it is set to true then, instead of creating symlinks via home-manager, it runs a script on home manager activation that copies all files from the chrome/ folder (including the generated config.css) into the user profile. So it ends up with a state of zero symlinked css files.

If you want I can clean it up a bit and make it into a PR.

Would be interesting to see if someone on Linux can reproduce the issue with symlinked css - my googling hasn't yielded that there should be any difference between Linux and MacOS with regards to this. If there isn't, than symlinking via home manager would never be a valid solution, in which case a bit of complexity can be removed from the module.

@adriankarlen
Copy link
Owner

Sure clean it up and send through a PR.

@snaeil
Copy link
Contributor

snaeil commented Jan 21, 2025

Is this a problem for all Mac environments?

If yes, wouldn't it make sense to not introduce a new option but divide the hm-module into

Mac -> copy instead of symlink
Other -> symlink

Pro my argument speaks that textfox would remain nix agnostic.

Against my argument speaks that it can be useful for experimenting with textfox while using it via nix home-manager.

@maxbol
Copy link
Contributor Author

maxbol commented Jan 22, 2025

@snaeil

Not sure. Have you tried the flake on Linux? Do you still get full styling of about:newtab and sidebery? (Do you see the ascii logo on the home screen, is the sidebery background matching the global bg, etc?)

Any Linux users that could verify that moving userContent.css and symlinking it back into place does NOT break their styling of these things?

@snaeil
Copy link
Contributor

snaeil commented Jan 22, 2025

@maxbol I am using linux. I am not sure about all things working, but have a look at this screenshot. You might spot something that is missing which I didn't notice so far...

Image

@maxbol
Copy link
Contributor Author

maxbol commented Jan 22, 2025

It looks correct to me. Did you apply colors by making changes to config.css, or by using Firefox Colors extension?

Regardless, the presence of the textfox logo means that userContent.css from textfox is applied, so it is clearly working better for you on Linux out of the box. So perhaps there needs to be separate solutions for Mac OS and Linux in the nix module.

@snaeil
Copy link
Contributor

snaeil commented Jan 23, 2025

I have used Firefox Color to set colors yes.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants