You are not logged in.

#1 2025-07-18 14:14:09

Akamiblade129_7
Member
Registered: 2024-12-06
Posts: 45

Editing notification body.

I want to be able to edit the notification body, before showing it to screen. For example to replace all URLs with "<URL>".
I didn't find a way to do it so far, so that's why I came her to ask if anyone have an idea how to do it.
I still didn't choose my notification daemon, so I'm opened to any suggestions about different daemons.

Info that might be usefull:

  • WM      : Hyprland 0.50.0

  • Kernel : Linux 6.15.6

Offline

#2 2025-07-18 15:11:49

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,714

Re: Editing notification body.

I severely doubt that this is frequently possible and with the

example to replace all URLs with "<URL>"

also suspect this to be some https://en.wikipedia.org/wiki/XY_problem
Why exactly do you want to edit notifications? And what sends those?

Offline

#3 2025-07-19 04:05:17

Akamiblade129_7
Member
Registered: 2024-12-06
Posts: 45

Re: Editing notification body.

seth wrote:

I severely doubt that this is frequently possible and with the

example to replace all URLs with "<URL>"

also suspect this to be some https://en.wikipedia.org/wiki/XY_problem
Why exactly do you want to edit notifications? And what sends those?

Might be. So I better explain it with example.
My friend sends me a message in discord:

Hey, bro! Check this out https:/youtube.com/sasyfiuegfyjiagdjkadfjkgfesjlaegjlsyftduysarkuafkujhkjafjkuyhdff

And the notification becomes a complete mess because link, because this link occupies almost the whole body and it's hard to read.

So instead of showing full message, I'd like to show:

Hey, bro! Check this out <URL>

It's easy to read and if it'll be possible with scripting I could even keep the domain:

Hey, bro! Check this out <URL:youtube.com>

Last edited by Akamiblade129_7 (2025-07-19 04:07:26)

Offline

#4 2025-07-19 07:06:35

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,714

Re: Editing notification body.

My friend sends me a message in discord:

Get better friends, I guess tongue
(Youtube urls don't have to be that long at all)

dunst is perhaps the most versatile notification daemon and even there my best idea would be to configure a rule that suppresses the actual message and notify-send's / dunstify's a sed-corrected version via a script hook.
But you'd also lose the ability to open the url from the notification.

Offline

#5 2025-07-19 10:22:39

Akamiblade129_7
Member
Registered: 2024-12-06
Posts: 45

Re: Editing notification body.

seth wrote:

(Youtube urls don't have to be that long at all)

It's not always about youtube urls, for example GIFs in discord are sent via tenor.com link and it's usually even longer

seth wrote:

dunst is perhaps the most versatile notification daemon and even there my best idea would be to configure a rule that suppresses the actual message and notify-send's / dunstify's a sed-corrected version via a script hook.
But you'd also lose the ability to open the url from the notification.

I've tried it, but icon isn't not showing up and there's no icon_path for some reason.
It's working tho, but I'd like to keep icons still

Last edited by Akamiblade129_7 (2025-07-19 10:23:06)

Offline

#6 2025-07-19 11:08:05

tekstryder
Member
Registered: 2013-02-14
Posts: 504

Re: Editing notification body.

Akamiblade129_7 wrote:

I'd like to show:

Hey, bro! Check this out <URL>


Similar to this issue?

https://github.com/emersion/mako/issues/590

Ah, prolly not quite what you're looking for.

Guessing you want hyperlink previews replacing the textual URLs.

Last edited by tekstryder (2025-07-19 11:12:01)

Offline

#7 2025-07-19 12:39:49

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,714

Re: Editing notification body.

https://man.archlinux.org/man/dunst.5.en#SCRIPTING you sould have access to the  $DUNST_ICON_PATH and utilize that w/ your subsequent dunstify?

Offline

#8 2025-07-20 02:09:58

Akamiblade129_7
Member
Registered: 2024-12-06
Posts: 45

Re: Editing notification body.

seth wrote:

https://man.archlinux.org/man/dunst.5.en#SCRIPTING you sould have access to the  $DUNST_ICON_PATH and utilize that w/ your subsequent dunstify?

It's empty for some reason. I don't know why. Even in the history

{
				"body" : {
					"type" : "s",
					"data" : "Ну как, желаете сегодня поболтать?"
				},
				"message" : {
					"type" : "s",
					"data" : "discord\n<b>Norf</b>\nНу как, желаете сегодня поболтать?"
				},
				"summary" : {
					"type" : "s",
					"data" : "Norf"
				},
				"appname" : {
					"type" : "s",
					"data" : "discord"
				},
				"category" : {
					"type" : "s",
					"data" : ""
				},
				"default_action_name" : {
					"type" : "s",
					"data" : "default"
				},
				"icon_path" : {
					"type" : "s",
					"data" : ""
				},
				"id" : {
					"type" : "i",
					"data" : 1303
				},
				"timestamp" : {
					"type" : "x",
					"data" : 29659920934
				},
				"timeout" : {
					"type" : "x",
					"data" : 5000000
				},
				"progress" : {
					"type" : "i",
					"data" : -1
				},
				"urgency" : {
					"type" : "s",
					"data" : "NORMAL"
				},
				"stack_tag" : {
					"type" : "s",
					"data" : ""
				},
				"urls" : {
					"type" : "s",
					"data" : ""
				}
			},

Even tho there IS an icon and I can actual see it in the notification

Offline

#9 2025-07-20 07:11:08

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,714

Re: Editing notification body.

Is it a custom icon or just the discord logo? (You could hardcode that?)

Offline

#10 2025-07-20 15:17:31

Akamiblade129_7
Member
Registered: 2024-12-06
Posts: 45

Re: Editing notification body.

seth wrote:

Is it a custom icon or just the discord logo? (You could hardcode that?)

It's User's avatar

Last edited by Akamiblade129_7 (2025-07-20 15:18:00)

Offline

#11 2025-07-20 19:23:21

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,714

Re: Editing notification body.

It's probably temporary data w/o any disk icon to use.
Luckily upstream is at least not opposed to a body editing feature: https://github.com/dunst-project/dunst/issues/1494

Offline

Board footer

Powered by FluxBB