dunst-project / dunst

Lightweight and customizable notification daemon
https://dunst-project.org
Other
4.6k stars 342 forks source link

How to configure appearence on the fly ? #1120

Closed ghost closed 1 month ago

ghost commented 2 years ago

Issue description

I've set everything on dunstrc config to show on top left for all notifications. But I need volume level notifications to be exactly in the middle of the screen. Is it possible ?

Currently I'm using these bindings:

set $showvol notify-send -t 1500 'VOLUME' -h int:value:$(pulsemixer --get-volume | awk '{print $1}')
bindsym XF86AudioRaiseVolume $run pactl set-sink-volume @DEFAULT_SINK@ +10% && $showvol
bindsym XF86AudioLowerVolume $run pactl set-sink-volume @DEFAULT_SINK@ -10% && $showvol

But they show at the configured position. I wanna set it to middle of the screen on the fly, unlike the rest of the notifications that appear at the corner.

Installation info

Minimal dunstrc ```ini # Dunstrc here ```
apprehensions commented 2 years ago

Dunst has the ability to set overrdues or settings for a notification with a specific app name:

https://github.com/dunst-project/dunst/blob/53a2ff19728aa3584784b0cb313212a1ed3ef801/dunstrc#L346

Unfortunately doesn't seem you can set origin here.

ismay commented 1 year ago

I was just wondering about the exact same thing. Allowing a different origin and offset for certain notifications would be great. It feels much more natural to me to have volume, microphone and brightness notifications at bottom center.

Related: https://github.com/dunst-project/dunst/issues/1106

voguelike commented 1 year ago

this feature has been implemented by someone's fork here: https://github.com/FT-Labs/phyOS-dunst

you can modify the origin of a notification through dunstify. it would be nice to have this integrated into the main version.

apprehensions commented 1 year ago

@voguelike , that feature is for Xresources configuration.

voguelike commented 1 year ago

i'm not sure what you mean, here's a video showing off the dynamic origin feature from that fork. https://youtu.be/Ogs_bKH2ntQ?t=307

apprehensions commented 1 year ago

It reloads Xresources configuration and not the configuration file...

voguelike commented 1 year ago

i take it that you didn't look at the video? it has absolutely nothing to do with xresources.

the feature is in src/dbus.c at line 555 ``` g_variant_iter_next(&i, "s", &n->appname); g_variant_iter_next(&i, "u", &n->id); g_variant_iter_next(&i, "s", &n->iconname); g_variant_iter_next(&i, "s", &n->summary); g_variant_iter_next(&i, "s", &n->body); g_variant_iter_next(&i, "^a&s", &actions); g_variant_iter_next(&i, "@a{?*}", &hints); g_variant_iter_next(&i, "i", &timeout); /* Change notification position */ if (!strcmp(n->appname, "top-center")) settings.origin = ORIGIN_TOP_CENTER; else if (!strcmp(n->appname, "top-left")) settings.origin = ORIGIN_TOP_LEFT; else if (!strcmp(n->appname, "bottom-right")) settings.origin = ORIGIN_BOTTOM_RIGHT; else if (!strcmp(n->appname, "bottom-center")) settings.origin = ORIGIN_BOTTOM_CENTER; else if (!strcmp(n->appname, "bottom-left")) settings.origin = ORIGIN_BOTTOM_LEFT; else if (!strcmp(n->appname, "left-center")) settings.origin = ORIGIN_LEFT_CENTER; else if (!strcmp(n->appname, "center")) settings.origin = ORIGIN_CENTER; else settings.origin = ORIGIN_TOP_RIGHT; gsize num = 0; while (actions[num]) { if (actions[num+1]) { g_hash_table_insert(n->actions, g_strdup(actions[num]), g_strdup(actions[num+1])); num+=2; } else { LOG_W("Odd length in actions array. Ignoring element: %s", actions[num]); break; } } ```
and here is that same spot in the normal version for comparison ``` g_variant_iter_next(&i, "s", &n->appname); g_variant_iter_next(&i, "u", &n->id); g_variant_iter_next(&i, "s", &n->iconname); g_variant_iter_next(&i, "s", &n->summary); g_variant_iter_next(&i, "s", &n->body); g_variant_iter_next(&i, "^a&s", &actions); g_variant_iter_next(&i, "@a{?*}", &hints); g_variant_iter_next(&i, "i", &timeout); gsize num = 0; while (actions[num]) { if (actions[num+1]) { g_hash_table_insert(n->actions, g_strdup(actions[num]), g_strdup(actions[num+1])); num+=2; } else { LOG_W("Odd length in actions array. Ignoring element: %s", actions[num]); break; } } ```
apprehensions commented 1 year ago

https://github.com/FT-Labs/phyOS-dunst/commit/018d965231de67ce45b3b767baa299dc84e8c56d

voguelike commented 1 year ago

oh nice i didn't see that, it's a pretty neat feature but how does it relate to changing the origin of the notifications? i don't know what it has to do with this which is a completely different thing.

bynect commented 8 months ago

I think the main problem is that dunst uses a single window so you can't have multiple notifications at different origins at the same time.

1018

bynect commented 3 months ago

for future reference now dunst supports hot reloading #1350