stylix icon indicating copy to clipboard operation
stylix copied to clipboard

is it possible to set iconTheme in stylix?

Open laycookie opened this issue 1 year ago • 4 comments

Hello, I just started using stylix and I was wondering if there is anyway of setting an icon-theme trough it. As of now I'm just using gtk.iconTheme to set it up and it works perfectly, but preferably I would like to do it trough stylix. I didn't find any information related to this feature so I just wanted to trow this question in case anyone else is having the same question.

laycookie avatar Jun 30 '24 23:06 laycookie

Stylix doesn't have an option for this since gtk.iconTheme is all you need to set for the icon theme to be applied. So, if Stylix provided an option, it would just be an alias.

danth avatar Jul 03 '24 11:07 danth

@danth Alright happy to hear that it is actually, as simple as setting gtk.iconTheme, I'm not sure how many people actually want that kind of alias but Im certainly one of them. I also feel like this feature will benefit new users as it will add icon-theme section to the docs, there for people who are new to theming will not have to go outside of stylix docs to research how to change icon-theme.

laycookie avatar Jul 04 '24 03:07 laycookie

Absolutely: there are both benefits and drawbacks to this.

danth avatar Jul 04 '24 21:07 danth

I don't know if I am the only one but gtk.iconTheme does not seem to change libreoffice icon theme for me, and it does not appear in the libreoffice settings either, the "system" icon theme is for some reason set to Elementary. And no I am not using the QT backend of libreoffice. Maybe if there are some extra steps for setting libreoffice icon theme, stylix could expose an icon theme options and handle this in a libreoffice stylix module?

not sure if necessary but stylix could also set the qt icon theme together with gtk icon theme in one place.

by the way, stylix has a polarity option right? Setting an icon theme through stylix could make it possible to automatically change the icon theme between dark and light variant depending on the polarity option.

I can imagine such interface:

stylix = {
  polarity = "dark";
  iconTheme = {
    package = pkgs.papirus-icon-theme.override { color = "indigo"; };
    dark = "Papirus-Dark"; # used
    light = "Papirus-Light"; # unused
  };
};

jaredmontoya avatar Jul 28 '24 20:07 jaredmontoya

Please bring this option to the stable release 24.11.

de-abreu avatar Feb 18 '25 00:02 de-abreu

Please bring this option to the stable release 24.11.

Is this not already available with the following module:

https://github.com/danth/stylix/blob/2c5104d5a7150ea2cd5ae00d48d2fc20c0685c96/stylix/icon.nix#L1-L26

trueNAHO avatar Feb 18 '25 12:02 trueNAHO

For some reason I am on master branch and despite that I am getting

nixdots on  master [✘!+⇡] took 37s
❯ sudo nixos-rebuild switch --flake . --impure
[sudo] password for noah:
warning: Git tree '/home/noah/Documents/projects/nix/nixdots' is dirty
error:
       … while calling the 'seq' builtin
         at /nix/store/kdynjy1mbgkdg4p196v9gx6ljpf7q4nk-source/lib/modules.nix:334:18:
          333|         options = checked options;
          334|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          335|         _module = checked (config._module);

       … while calling the 'throw' builtin
         at /nix/store/kdynjy1mbgkdg4p196v9gx6ljpf7q4nk-source/lib/modules.nix:310:18:
          309|                     ''
          310|             else throw baseMsg
             |                  ^
          311|         else null;

       error: The option `stylix.iconTheme' does not exist. Definition values:
       - In `/nix/store/a7y03jjrqsmz0gb2gxwyaqid7lvcqmzs-source/modules/user/graphical/stylix.nix':
           {
             enable = true;
           }

Considering master is the default branch and I am running unstable I would assume

stylix.url = "github:danth/stylix";

Is enough

P.s. Ignore the --impure I'm lazy tbh

nonetrix avatar Feb 22 '25 01:02 nonetrix

@nonetrix It should work, but you can try:

	stylix = {
		url = "https://github.com/danth/stylix/";
		type = "git";
		rev = "917e07af1451d7765be57c8b31bb3372c7b821a7";
	};

The best guess I have off the top of my head, is if you have added stylix that way a while ago, it might have just never updated since the initial install, which was a problem for me way back in the day. Replacing stylix.url = "github:danth/stylix"; with the above should update it to the latest version, and if you decided to add stylix.url = "github:danth/stylix"; back it should still stay at the latest version from my memory.

laycookie avatar Feb 22 '25 01:02 laycookie

Idk I have seen it update multiple times, so I'm pretty sure it should be updating?

Image

Should have done this before, but here is my config

{pkgs, ...}: {
  stylix = {
    enable = true;
    polarity = "dark";
    image = ./image.jpg;
    iconTheme.enable = true;
    # TODO: Pretty sure I could put this in Nix store or something idk
    base16Scheme = "/home/noah/Documents/projects/nix/nixdots/modules/user/graphical/avg.yaml";
    opacity = {
      terminal = 0.9;
      popups = 0.9;
    };
    cursor = {
      package = pkgs.rose-pine-cursor;
      name = "BreezeX-RosePine-Linux";
    };
  };
}

nonetrix avatar Feb 22 '25 04:02 nonetrix

Idk I have seen it update multiple times, so I'm pretty sure it should be updating?

Image

Should have done this before, but here is my config

{pkgs, ...}: {
  stylix = {
    enable = true;
    polarity = "dark";
    image = ./image.jpg;
    iconTheme.enable = true;
    # TODO: Pretty sure I could put this in Nix store or something idk
    base16Scheme = "/home/noah/Documents/projects/nix/nixdots/modules/user/graphical/avg.yaml";
    opacity = {
      terminal = 0.9;
      popups = 0.9;
    };
    cursor = {
      package = pkgs.rose-pine-cursor;
      name = "BreezeX-RosePine-Linux";
    };
  };
}

Huh weird, I'm getting a different error in this case. In any case I believe I trow it somewhere in the docs that if you enable icon theme but do not set the light, or dark variables, it would throw an error, which is just the behavior inherited from GTK. Add the iconTheme as light, or dark theme (or both), and it should work. (If it is something else through, I'll try to debug it later, if what I mentioned above will not work)

laycookie avatar Feb 22 '25 04:02 laycookie

I set both doesn't do anything, likely got the name wrong but it should work but set it to something invalid I would imagine and be ignored. For good measure also set it to commit you mentioned

{pkgs, ...}: {
  stylix = {
    enable = true;
    polarity = "dark";
    image = ./image.jpg;
    stylix.iconTheme.package = pkgs.papirus-icon-theme;
    stylix.iconTheme.dark = "Papirus-dark";
    stylix.iconTheme.light = "Papirus-light";
    iconTheme.enable = true;
    # TODO: Pretty sure I could put this in Nix store or something idk
    base16Scheme = "/home/noah/Documents/projects/nix/nixdots/modules/user/graphical/avg.yaml";
    opacity = {
      terminal = 0.9;
      popups = 0.9;
    };
    cursor = {
      package = pkgs.rose-pine-cursor;
      name = "BreezeX-RosePine-Linux";
    };
  };
}

nonetrix avatar Feb 22 '25 04:02 nonetrix

Wait I'm dumb

nonetrix avatar Feb 22 '25 04:02 nonetrix

Still no worky after removing the extra stylix.

nonetrix avatar Feb 22 '25 05:02 nonetrix

Still no worky after removing the extra stylix.

Alright then just to make sure try to duplicate my stylix config, just to make sure it isn't a problem with your config.

stylix = {
 		enable = true;
 		image = ./image.jpg;

 		targets.rofi.enable = false;
 	       	targets.waybar.enable = false;

 	       	 polarity = "dark";

	 	iconTheme = {
			enable = true;
	 		package = pkgs.reversal-icon-theme;
	 		light = "Reversal";
	 		dark = "Reversal";
	 	};
 	       	base16Scheme = {
 	       		base00 = "282828";
 	       		base01 = "3c3836";
 	       		base02 = "504945";
 	       		base03 = "665c54";
 	       		base04 = "bdae93";
 	       		base05 = "d5c4a1";
 	       		base06 = "ebdbb2";
 	       		base07 = "fbf1c7";
 	       		base08 = "fb4934";
 	       		base09 = "fe8019";
 	       		base0A = "fabd2f";
 	       		base0B = "b8bb26";
 	       		base0C = "8ec07c";
 	       		base0D = "83a598";
 	       		base0E = "d3869b";
 	       		base0F = "d65d0e";
 	       	};
 	       	cursor = {
 	       		package = pkgs.bibata-cursors;
 	       		name = "Bibata-Modern-Classic";
 	       		size = 24;
 	       	};
 	       	fonts = {
 	       		sizes = {
 	       			terminal = 14;
 	       			desktop = 12;
 	       		};

 	       		monospace = {
 	       			package = pkgs.nerd-fonts.jetbrains-mono;
 	       			name = "JetBrainsMono Nerd Font Mono";
 	       		};
 	       		sansSerif = {
 	       			package = pkgs.dejavu_fonts;
 	       			name = "DejaVu Sans";
 	       		};
 	       		serif = {
 	       			package = pkgs.dejavu_fonts;
 	       			name = "DejaVu Serif";
 	       		};
 	       	};
 	};

And, check if the terminal output has changed.

Also preferably create a new issue, as it appears to only be tangentially related to this one.

laycookie avatar Feb 22 '25 05:02 laycookie

Same error I guess I'm just cursed

nonetrix avatar Feb 22 '25 05:02 nonetrix

Same error I guess I'm just cursed

iconTheme is in home-manager module: https://stylix.danth.me/options/hm.html#stylixiconthemeenable

Familex avatar Feb 22 '25 06:02 Familex

As @Familex suggests - check you're setting the option in Home Manager and not NixOS

danth avatar Feb 22 '25 11:02 danth

Oh... That's probably it I feel really dumb now 💀

Bit confusing though, maybe mild improvement could be throwing a error I guess

nonetrix avatar Feb 22 '25 11:02 nonetrix

maybe mild improvement could be throwing a error I guess

This error seems impossible to implement

Familex avatar Feb 22 '25 11:02 Familex

Ohh, even I forgot that it is the case lol. Might also be the reason why @de-abreu has mentioned adding this feature to 24.11 even though it is already added. I will write about this in #890 which hopefully will increase index-ability of this issue if it would ever happen to anyone else again.

laycookie avatar Feb 22 '25 11:02 laycookie

#873 puts NixOS / Home Manager / Darwin options for the same target on the same page, with clearly labelled sections, which should hopefully make this a bit better

danth avatar Feb 22 '25 13:02 danth