the-argus / spicetify-nix

A nix flake for configuring spicetify. Includes packaging for many popular themes and extensions.
GNU General Public License v3.0
135 stars 22 forks source link

Expose an option to enable devtools #38

Open AgathaSorceress opened 10 months ago

AgathaSorceress commented 10 months ago

Spicetify CLI has an spicetify enable-devtools action that enables chromium devtools, seemingly by patching .cache/spotify/offline.bnk, which is helpful when developing themes and CSS snippets. I'm not sure if just conditionally appending it to this line would be a good idea, or if there's a better way to do it, but I think it would be useful to have.

aemogie commented 9 months ago

offline.bnk is generated at spotify runtime, therefore theres no proper way to get it into the nix store (afaik), so that it can be patched.

an alternative is to disable nix's sandboxing, and run

{config, ...}: {
  imports = [...]; # import spicetify-nix
  nix.settings.use-sandbox = false;
  programs.spicetify = {
    ... # rest of config
    # you need to set HOME manually because the builder is a different user
    extraCommands = "HOME=${config.home.homeDirectory} spicetify-cli enable-devtools";
  }
}

but this is not recommended because this requires that spotify be run atleast once before, breaking reproducibility. i recommend doing this, making whatever changes you want, then removing this again.

aemogie commented 5 months ago

@AgathaSorceress I was recommended to use this extension, and it works with no weirdness unlike the above approach. https://github.com/kyrie25/spicetify-utilities/

comfysage commented 2 months ago

unfortunatly, neither of these solutions work for me. is there another way to achieve this?

aemogie commented 2 months ago

If you go with the second option of the utilities extension (then enable devtools), and launch spotify from the terminal there will be a message similar to

DevTools listening on ws://127.0.0.1:8088/devtools/browser/4f06d9b2-4ffc-4ed9-936a-689b1f80ad8d

For some reason I was unable to open the devtools even though it was running. Instead what I did was temporarily install chromium (nix run nixpkgs#chromium) and use that, should also work with any other chromium-based browser.

Once you have it running, go to chrome://inspect, then click on Configure... and add 127.0.0.1:8088 (which was what the log line on spotify told)

Then Spotify should show up in there. Click on Inspect to use it. (Only one of them works, the other gives a 404 for me) image