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

is it possible to set iconTheme in stylix? #458

Closed
laycookie opened this issue Jun 30, 2024 · 21 comments · Fixed by #603
Closed

is it possible to set iconTheme in stylix? #458

laycookie opened this issue Jun 30, 2024 · 21 comments · Fixed by #603
Labels
feature A new feature or a feature request

Comments

@laycookie
Copy link
Contributor

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.

@danth
Copy link
Owner

danth commented Jul 3, 2024

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.

@laycookie
Copy link
Contributor Author

@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.

@danth
Copy link
Owner

danth commented Jul 4, 2024

Absolutely: there are both benefits and drawbacks to this.

@trueNAHO trueNAHO added the feature A new feature or a feature request label Jul 5, 2024
@jaredmontoya
Copy link

jaredmontoya commented Jul 28, 2024

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
  };
};

eum3l pushed a commit to eum3l/stylix that referenced this issue Feb 10, 2025
Closes: danth#458
Link: danth#603

Reviewed-by: NAHO <[email protected]>
Tested-by: Kamron Bhavnagri <[email protected]>
@de-abreu
Copy link

Please bring this option to the stable release 24.11.

@trueNAHO
Copy link
Collaborator

Please bring this option to the stable release 24.11.

Is this not already available with the following module:

stylix/stylix/icon.nix

Lines 1 to 26 in 2c5104d

{ lib, ... }:
{
options.stylix.iconTheme = {
enable = lib.mkOption {
description = "enable/disable icon theming.";
type = lib.types.bool;
default = false;
};
package = lib.mkOption {
description = "Package providing the icon theme.";
type = lib.types.nullOr lib.types.package;
default = null;
};
light = lib.mkOption {
description = "Light icon theme name.";
type = lib.types.nullOr lib.types.str;
default = null;
};
dark = lib.mkOption {
description = "Dark icon theme name.";
type = lib.types.nullOr lib.types.str;
default = null;
};
};
}

@nonetrix
Copy link

nonetrix commented Feb 22, 2025

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

@laycookie
Copy link
Contributor Author

laycookie commented Feb 22, 2025

@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.

@nonetrix
Copy link

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";
    };
  };
}

@laycookie
Copy link
Contributor Author

laycookie commented Feb 22, 2025

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)

@nonetrix
Copy link

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
Copy link

Wait I'm dumb

@nonetrix
Copy link

Still no worky after removing the extra stylix.

@laycookie
Copy link
Contributor Author

laycookie commented Feb 22, 2025

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.

@nonetrix
Copy link

Same error I guess I'm just cursed

@Familex
Copy link

Familex commented Feb 22, 2025

Same error I guess I'm just cursed

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

@danth
Copy link
Owner

danth commented Feb 22, 2025

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

@nonetrix
Copy link

nonetrix commented Feb 22, 2025

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

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

@Familex
Copy link

Familex commented Feb 22, 2025

maybe mild improvement could be throwing a error I guess

This error seems impossible to implement

@laycookie
Copy link
Contributor Author

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.

@danth
Copy link
Owner

danth commented Feb 22, 2025

#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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature or a feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants