查看最近的 GNOME 通知

Jas*_*ter 6 notification command-line gnome-shell

是否有允许我查看最近通知的应用程序/命令?

最好是基于文本的。

我还想查看每个通知的通知超时。;)

Nyk*_*kin 5

桌面通知规范中没有任何用于检索以前发送的消息的命令,所以我的猜测是它们在检索后被丢弃。

但是,您可以使用dbus-monitor命令观察这些,如下所示:

$ dbus-monitor "interface='org.freedesktop.Notifications'"
Run Code Online (Sandbox Code Playgroud)

发送简单通知:

$ notify-send "Hello there"
Run Code Online (Sandbox Code Playgroud)

结果与以下信息:

method call time=1555095758.597788 sender=:1.385 -> destination=:1.386 serial=6 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=GetServerInformation
method call time=1555095758.601101 sender=:1.385 -> destination=:1.386 serial=7 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
   string "notify-send"
   uint32 0
   string ""
   string "Hello there"
   string ""
   array [
   ]
   array [
      dict entry(
         string "urgency"
         variant             byte 1
      )
   ]
   int32 -1
signal time=1555095765.734845 sender=:1.386 -> destination=:1.385 serial=15 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=NotificationClosed
   uint32 1
   uint32 1
Run Code Online (Sandbox Code Playgroud)

时间字段是一个 UNIX 时间戳,可以这样翻译:

$ date -d @1555095765
Fri Apr 12 21:02:45 CEST 2019
Run Code Online (Sandbox Code Playgroud)