go notify
1.0.0
软件包通知提供了GNOME DBUS通知规范的实现。
显示一个简单的通知。
ntf := notify . NewNotification ( "Test Notification" , "Just a test" )
if _ , err := ntf . Show (); err != nil {
return
}用图标显示通知。咨询图标命名规范。
ntf := notify . NewNotification ( "Test Notification" , "Just a test" )
ntf . AppIcon = "network-wireless"
if _ , err := ntf . Show (); err != nil {
return
}显示永不过期的通知。
ntf := notify . NewNotification ( "Test Notification" , "Just a test" )
ntf . Timeout = notify . ExpiresNever
if _ , err := ntf . Show (); err != nil {
return
}通过通知播放声音。
ntf := notify . NewNotification ( "Test Notification" , "Just a test" )
ntf . Hints = make ( map [ string ] interface {})
ntf . Hints [ notify . HintSoundFile ] = "/home/my-username/sound.oga"
if _ , err := ntf . Show (); err != nil {
return
}