答案1
与 GNOME 3.16 和其他桌面环境一样。可以通过命令行中的通知守护程序发送通知。
该命令是包的一部分,由元包libnotify-bin
安装。*-desktop
依赖项为libc6
,,libglib2.0-0
。libnotify4
运行strace
以查看通知的方式:
% strace -e open notify-send foo bar
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/x86_64-linux-gnu/libnotify.so.4", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libglib-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/x86_64-linux-gnu/libffi.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libpcre.so.3", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
发送你自己的通知
notify-send foo bar
SYNOPSIS
notify-send [OPTIONS] <summary> [body]
OPTIONS
-u, --urgency=LEVEL Specifies the urgency level (low, normal,
critical).
-t, --expire-time=TIME
The duration, in milliseconds, for the notification to appear
on screen. (Ubuntu's Notify OSD and GNOME Shell both ignore
this parameter.)
-i, --icon=ICON[,ICON...]
Specifies an icon filename or stock icon to display.
-c, --category=TYPE[,TYPE...]
Specifies the notification category.
Help options:
-?, --help
Show this help message
-h, --hint=TYPE:NAME:VALUE
Specifies basic extra data to pass. Valid types are int,
double, string and byte.
答案2
这下列的也有效
zenity --notification --window-icon=update.png --text "System update necessary!"