Basically, whenever I edit firefox-profile-path/chrome/userChrome.css, I want firefox to automatically apply the file again. The only posts I found on this are old and not straightforward. I’m wondering what currently works.

    • MrOtherGuy@lemmy.worldM
      link
      fedilink
      arrow-up
      1
      ·
      19 days ago

      Well you can, but it would only run (and thus reload) once very early on startup, which is probably not what you want.

      If you use fx-autoconfig, it also has a helper function for loading userChrome.css (or other stylesheets) that you can call like this: UC_API.Scripts.reloadStyleSheet()

      Still, the complex part is in figuring out when exactly you want to do the reloading. For example, you coud set it up so that it get reloaded when hitting some hotkey (Ctrl + F8 in this example):

      import { Scripts, Hotkeys } from "chrome://userchromejs/content/uc_api.sys.mjs";
      Hotkeys.define({
        id: "reload-userchrome",
        modifiers: "ctrl",
        key: "F8",
        command: () => {
          console.log("reloading...");
          Scripts.reloadStyleSheet()
          
        }
      }).autoAttach()
      

      Adding that as <filename>.sys.mjs should work (unless something else on your system is stealing the Ctrl+F8 shortcut). Note, even though the styles should get reloaded, the window might not re-render immediately - which may require you to move your mouse or do some other stuff before you see the changes.