You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Dunst与notify-send是否违反桌面通知规范?

桌面通知规范下Dunst与notify-send的ID行为疑问

根据桌面通知规范:

若replaces_id为0,返回值应为代表通知的UINT32类型值,该值唯一,仅当生成的通知数量达到MAXINT时才可复用。可接受的实现方式可采用递增计数器生成ID。返回的ID必须大于0,服务器不得返回0作为ID。

我执行了以下操作:

  • 先杀死Dunst进程,确保它在下次收到通知时重启:
    kill $(pidof dunst)
    
    (Dunst版本1.10.0,2024-02-19)
  • 依次运行多条notify-send命令:
    notify-send 'hello' -p
    notify-send 'hello' -p
    notify-send 'hello' -p -r 5
    notify-send 'hello' -p
    notify-send 'hello' -p
    

得到的输出结果为:

2
3
5
4
5

可见ID 5被复用了,但实际观察发现,第5条通知并没有替换掉第3条通过-r 5显式指定ID的通知。

我认为作为通知服务器的Dunst是合规的,问题应该出在客户端notify-send返回了错误的ID——毕竟notify-send的ID理应由Dunst分配并返回。我推测Dunst实际为这5条通知分配了5个不同的ID,例如:

2
3
5
4
6

内容的提问来源于stack exchange,提问作者Enlico

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 20:22:32