nix-community / home-manager

Manage a user environment using Nix [maintainer=@rycee]
https://nix-community.github.io/home-manager/
MIT License
6.8k stars 1.78k forks source link

dunst: generate an icon_path valid for all theme sizes #2999

Open teto opened 2 years ago

teto commented 2 years ago

Description

I've started trying to set icons for my dunst notifications and found out that icons packages contain different icons for different sizes. The current dunst module allows for one size only (the user can override it but it's a bit complex): https://github.com/nix-community/home-manager/blob/684e85d01d333be91c4875baebb05b93c7d2ffaa/modules/services/dunst.nix#L168 I think we should generate an entry for every size by default ?

for instance I set

    iconTheme = {
        package = pkgs.papirus-icon-theme;
        name = "Papirus";
        # size = "symbolic"; # try with/wihout it
    }; 

With size set to symbolic notify-send --icon=audio-volume-low-symbolic toto works otherwise it doesnt. One can use absolute path to the icon too.

ncfavier commented 2 years ago

Would dunst's new enable_recursive_icon_lookup help with this?

stale[bot] commented 2 years ago

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

BerkeleyTrue commented 11 months ago

@ncfavier I believe it does fix this.

I was having trouble with dunst icons. I ended up changing my dunst config to use the new recursive lookup. It's much simpler than the icon path logic that was used before.

Here is my config https://github.com/BerkeleyTrue/dotfiles/blob/master/.config/home-manager/modules/desktop/services/dunst.nix#L94

The relevant bits:

      enable_recursive_icon_lookup = true;
      icon_theme = "Dracula,hicolor";

This also required some changes to my systemd setup, since the recursive lookup requires xdg_data_dirs to be picked up correctly or it won't find ~/.nix-profile/share. The changes were an addition of a `~/.config/systemd/user.conf' that would duplicate the xdg_data_dirs directory.

https://github.com/BerkeleyTrue/dotfiles/blob/master/.config/home-manager/modules/desktop/services/default.nix#L23

  xdg.configFile."systemd/user.conf".text = ''
    [Manager]
    ManagerEnvironment="XDG_DATA_DIRS=%h/.nix-profile/share:%h/.local/share:/usr/local/share:/usr/share"
    DefaultEnvironment="XDG_DATA_DIRS=%h/.nix-profile/share:%h/.local/.share:/usr/local/share:/usr/share"
  '';

This setup is probably doable with the current services.dunst module, but the module will still add the unnecessary icon_path which I don't think there is a way to overwrite.

stale[bot] commented 8 months ago

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.