go notify
1.0.0
Package Notify ให้การดำเนินการตามข้อกำหนดการแจ้งเตือน 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
}