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

Don't take over primary userChrome.css/userContent.css #18

Closed
smithfred opened this issue Dec 26, 2017 · 6 comments
Closed

Don't take over primary userChrome.css/userContent.css #18

smithfred opened this issue Dec 26, 2017 · 6 comments

Comments

@smithfred
Copy link

smithfred commented Dec 26, 2017

At the moment (when installing per the instructions) firefox-gnome-theme takes over the entire $firefoxprofiledir/chrome directory, and subsequently "owns" (controls) that profile's primary userChrome.css and userContent.css files.

Instead, it's much tidier to put all of firefox-gnome-theme's files in their own subdirectory, and add a single @import to each of the user's userChrome.css and userContent.css files:

#!/bin/bash
cd ~/.mozilla/firefox/*.default
# Create chrome dir if non-existent
mkdir -p chrome
cd chrome
# Clone to subdir
git clone https://github.com/kurogetsusai/firefox-gnome-theme.git
# Create single-line main user CSS files if non-existent or empty (at least one line needed for sed)
[[ -s userChrome.css ]] || echo >> userChrome.css
[[ -s userContent.css ]] || echo >> userContent.css
# Insert imports at beginning of user CSS files (before any existing @namespace)
sed -i '1s/^/@import "firefox-gnome-theme\/userChrome.css";\n/' userChrome.css
sed -i '1s/^/@import "firefox-gnome-theme\/userContent.css";\n/' userContent.css

This has a number of benefits:

  • You don't replace the user's existing userChrome.css/userContent.css files (e.g. if they already exist with customisations)
  • You don't change the location for any unrelated custom user*css rules (currently you're telling the user "now you have to put your unrelated custom CSS in my project-specific custom CSS files instead" (customChrome.css/customContent.css).
  • Can co-exist nicely with any other similar userChrome/userContent projects (each project can be @import-ed from the user-controlled master userChrome/userContent files). Currently, another similarly structured project would also want to "own" the primary userChrome/userContent files).
  • Keeps the chrome directory tidy, with clear/obvious file-project origins/mappings. Again, currently, as per above, another similarly structured project would mix files with (and possibly clobber) this project's.
@lunakurame
Copy link
Owner

That's probably a good idea if it doesn't break anything when an existing user runs git pull on his repo clone, I'll consider it when we merge all those fixes from #21.

@lunakurame lunakurame added this to the Firefox 57 milestone Feb 3, 2018
@smithfred
Copy link
Author

It works perfectly ;) Please feel free to test.

@lunakurame
Copy link
Owner

Changed the installation instructions, no code change needed. I'm not removing the @imports for the old custom*.css files, because people use them, so that would be an unnecessary breaking change.

@smithfred
Copy link
Author

Nice one, thanks :) Might be worth including a "setup.sh" or similar that automates the instructions - the "create userC*.css" items are idempotent; the sed ones just need a grep blah || sort of test before them. Could also automate detection of >1 Firefox profiles (if only one, install to *.default, otherwise prompt for which).

@lunakurame
Copy link
Owner

I actually tried, but the script turned out to be too complicated. I don't want to lock it down to only work with profiles located in your ~/.mozilla/firefox dir since I use my own FF profile manager, which doesn't use this location and then it has to detect whether you run it inside your chrome dir or the repo's dir, or somewhere else... The installation steps aren't too complicated, so I think that's okay to leave them as they are.

@smithfred
Copy link
Author

Having a script for the default FF profile/recommended installation method wouldn't preclude manual installation.

You could also just put a `read -p 'This will install this theme to your default profile, continue y/N?' as well.

I can probably chuck one together if you'd include it.

andrew-ls pushed a commit to andrew-ls/firefox-gnome-theme that referenced this issue Oct 15, 2019
andrew-ls pushed a commit to andrew-ls/firefox-gnome-theme that referenced this issue Oct 15, 2019
andrew-ls pushed a commit to andrew-ls/firefox-gnome-theme that referenced this issue Oct 15, 2019
andrew-ls pushed a commit to andrew-ls/firefox-gnome-theme that referenced this issue Oct 15, 2019
andrew-ls pushed a commit to andrew-ls/firefox-gnome-theme that referenced this issue Oct 15, 2019
andrew-ls pushed a commit to andrew-ls/firefox-gnome-theme that referenced this issue Oct 15, 2019
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