使用旧的 Rust 2015
0.0.5 |
|
---|---|
0.0.4 |
|
0.0.3 |
|
0.0.2 |
|
0.0.1 |
|
#33 in #desktop-notifications
33 每月下载量
14KB
205 代码行
notify_send-rs
使用dbus-rs在纯Rust中发送DBus通知。
#Cargo.toml
[dependencies.notify_send]
git = "https://github.com/hoodie/notify_send-rs.git"
用法
extern crate notify_send;
use notify_send::Notification;
fn main()
{
// use it this way
Notification::new()
.summary("this is the summary")
.body("this is the body")
.icon("firefox")
.timeout(6000) //miliseconds
.send();
// using format!()
Notification::new()
.summary("Chromium Crashed")
.appname("chromium")
.body(&format!("This is <b>{}</b>!<br/>", "a lie"))
.icon("chromium")
.timeout(6000) //miliseconds
.send();
// possible, if you like
let mut message = Notification::new();
message.summary("invocation type 2");
message.body("your <b>body</b> is a <u>wonderland</u>");
message.send();
// also possible, if you really really want to
Notification {
appname: "foobar".to_string(),
timeout: 20,
..Notification::new()
}.send();
// can't see anything?
Notification::new().summary("this will also print to stdout").send_debug();
}
要做的事情
- 动作
- 提示
- 利用返回的ID
- GetCapabilities(), CloseNotification(), GetServerInformation()
- 足够好以至于能进入这个列表
依赖项
~455KB