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

Allow setting 'icon_position' and 'max_icon_size' via rules #638

Closed
donbex opened this issue Jun 27, 2019 · 12 comments
Closed

Allow setting 'icon_position' and 'max_icon_size' via rules #638

donbex opened this issue Jun 27, 2019 · 12 comments
Labels
Milestone

Comments

@donbex
Copy link

donbex commented Jun 27, 2019

I would like to enable displaying icons only for some notifications, or at least to be able to change the maximum allowed icon size on a rule basis. However, as of v1.4.0-10-gac94eca, neither icon_position nor max_icon_size can be set via rules.

My specific use case is showing album art in "now playing" notifications, but suppress (or at least reduce the size of) all other icons. I guess I could write a script and call that via rules, but I think that would be more of a hack than a proper solution.

@tsipinakis
Copy link
Member

I agree this and a more dynamic layout in general would be nice to have.

The basic implementation of this is pretty simple, and would probably work in most cases but the code that handles the notification layout is currently a bit outdated and without any tests so I'm hesitant to add this immediately without a lot of testing and/or refactoring. That being said I'd accept a PR if someone wants to go through the trouble of making sure this works properly.

For displaying icons for only specific notifications you can try setting a rule with new_icon = "".

@rudevdr
Copy link

rudevdr commented Aug 30, 2019

+1.

This seems very useful feature. More settings should be accessible from rules like geometry, frame_width, etc.

I guess I could write a script and call that via rules, but I think that would be more of a hack than a proper solution.

@donbex How can we change icon_position via script? I am not sure if it's possible.

For displaying icons for only specific notifications you can try setting a rule with new_icon = ""

@tsipinakis Unfortunately, this workaround doesn't work for me.

@SamsiFPV
Copy link

I'd like to have this feature too. I want to adjust the icon size depending on the app, since i like seeing album covers from spotify, but not such big icons from other apps

@fwsmit fwsmit added this to the 1.7 milestone Jun 7, 2021
@fwsmit
Copy link
Member

fwsmit commented Nov 8, 2021

With #947 merged, you can set different icon sizes for each notification. See the man page for how to do that.

@ncfavier
Copy link

Could you give a concrete example? I can't seem to make this work.

I'm running dunstify -a foobar -I img.png with the following configuration

dunstrc
[foobar]
appname="foobar"
icon_size=500

[global]
browser="xdg-open"
dmenu="rofi -dmenu -p dunst -no-fixed-num-lines"
enable_recursive_icon_lookup=yes
font="bitmap 8"
format="<b>%s</b>\n%b %p"
frame_color="#ffffff"
frame_width=1
height=500
horizontal_padding=16
icon_path=""
icon_position="right"
icon_theme="Flat-Remix-Blue"
markup="full"
max_icon_size=64
min_icon_size=64
mouse_right_click="context"
notification_limit=6
offset="32x64"
padding=16
separator_color="frame"
show_indicators=no
shrink=yes
width="(0, 1200)"
word_wrap=yes

[urgency_critical]
background="#ff00cc"
foreground="#ffffff"
timeout=0

[urgency_low]
background="#000000"
foreground="#ffffff"
timeout=10

[urgency_normal]
background="#000000"
foreground="#ffffff"
timeout=10

The image is 64 px tall instead of 500. If I set max_icon_size to 500, then regular icons scale up to that size, which I don't want.

@fwsmit
Copy link
Member

fwsmit commented Nov 14, 2021

Could you give a concrete example? I can't seem to make this work.

I'm running dunstify -a foobar -I img.png with the following configuration
dunstrc

The image is 64 px tall instead of 500. If I set max_icon_size to 500, then regular icons scale up to that size, which I don't want.

Currently the icon_size doesn't scale the icons. It only affects the searching of icons. It's still a work in progress to work with icons that are passed from a path.
The way it's supposed to work when using an icon theme is like this:


[global]
enable_recursive_icon_lookup=yes
icon_theme="Flat-Remix-Blue"
# set global icon size of 32
icon_size = 32

# Make sure to put any app-specific modifications after the global modifications
[foobar]
appname="foobar"

# use bigger icons for the application foobar
icon_size = 64

If you now send notifications with icons from your icon theme the size of the icon will be different for the application foobar.
dunstify -i dialog-information "Test with small icon"
dunstify -i dialog-information -a foobar "Test with big icon"

@ncfavier
Copy link

Right. My use case is the same as @SamsiFPV's: I would like to be able to have one maximum icon size for regular icons -i(say 64 px) and another for raw images -I (say 500 px).

The icon theme I'm using only has scalable versions of the icons I'm interested in, no fixed size, so icon_size won't help.

@fwsmit
Copy link
Member

fwsmit commented Nov 14, 2021

Right. My use case is the same as @SamsiFPV's: I would like to be able to have one maximum icon size for regular icons -i(say 64 px) and another for raw images -I (say 500 px).

So adding a raw_icon_size would suit your needs? It might still be confusing for users, though. I haven't figured out the right configuration options yet. What would be your suggestion?

The icon theme I'm using only has scalable versions of the icons I'm interested in, no fixed size, so icon_size won't help.

The icon theme specifies how big the icons may be scaled in index.theme. When an icon is found from the icon theme, dunst should scale the icon to icon_size. Maybe that currently isn't the case yet, but that was the idea.

@ncfavier
Copy link

So adding a raw_icon_size would suit your needs? It might still be confusing for users, though. I haven't figured out the right configuration options yet. What would be your suggestion?

If there was a way for a rule to match notifications with raw icons, and a way for a rule to override max_icon_size, then that could work.

The man page says icon="" should do the former, but it doesn't.

@fwsmit
Copy link
Member

fwsmit commented Feb 18, 2022

Both these requests have been implemented. See #985 for icon_position and #947 for the icon sizes (and a complete new icon lookup system).

@fwsmit fwsmit closed this as completed Feb 18, 2022
@ncfavier
Copy link

Has anything changed since the previous discussion? #947 was already merged. I still don't know how to have a max icon size for icons but not for raw images.

@fwsmit
Copy link
Member

fwsmit commented Feb 18, 2022

Ah yes, I forgot to read back. There has been discussion #992 about a scale_non_svgoption for this use case. I'm not yet happy with the name though. Maybe scale_raw_icons? I made a separate issue about this for discussions: #1037. I'd be interested in your suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants