-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from gabm/notification
Use dbus notifications instead of toast overlay
- Loading branch information
Showing
5 changed files
with
51 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use gdk_pixbuf::gio::FileIcon; | ||
use relm4::gtk::gio::{prelude::ApplicationExt, Notification}; | ||
|
||
use relm4::gtk::{IconLookupFlags, IconTheme, TextDirection}; | ||
|
||
pub fn log_result(msg: &str) { | ||
println!("{}", msg); | ||
show_notification(msg); | ||
} | ||
|
||
fn show_notification(msg: &str) { | ||
// construct | ||
let notification = Notification::new("Satty"); | ||
notification.set_body(Some(msg)); | ||
|
||
// lookup sattys icon | ||
let theme = IconTheme::default(); | ||
if theme.has_icon("satty") { | ||
if let Some(icon_file) = theme | ||
.lookup_icon( | ||
"satty", | ||
&[], | ||
96, | ||
1, | ||
TextDirection::Ltr, | ||
IconLookupFlags::empty(), | ||
) | ||
.file() | ||
{ | ||
notification.set_icon(&FileIcon::new(&icon_file)); | ||
} | ||
} | ||
|
||
// send notification | ||
relm4::main_application().send_notification(None, ¬ification); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
pub mod toast; | ||
pub mod toolbars; |
This file was deleted.
Oops, something went wrong.