-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
68 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -23,7 +23,7 @@ tasks: | |
run: | ||
aliases: [ "r" ] | ||
cmds: | ||
- cargo run | ||
- cargo run {{.CLI_ARGS}} | ||
|
||
build: | ||
aliases: [ "b" ] | ||
|
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,18 @@ | ||
#[cfg(any(target_os = "windows", target_os = "macos"))] | ||
fn main() { | ||
println!("this is a xdg only feature") | ||
} | ||
|
||
#[cfg(all(unix, not(target_os = "macos")))] | ||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
use notify_rust::{Hint, Timeout}; | ||
|
||
notify_rust::Notification::new() | ||
.summary("Persistent notification") | ||
.body("This should not go away unless you want it to.") | ||
.icon("firefox") | ||
.hint(Hint::Resident(true)) // does not work on kde | ||
.timeout(Timeout::Never) // works on kde and gnome | ||
.show()?; | ||
Ok(()) | ||
} |
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,35 @@ | ||
#[cfg(target_os = "macos")] | ||
fn main() -> Result<(), String> { | ||
use notify_rust::{ | ||
error::MacOsError, get_bundle_identifier_or_default, set_application, Notification, | ||
}; | ||
|
||
let safari_id = get_bundle_identifier_or_default("Safari"); | ||
set_application(&safari_id).map_err(|f| format!("{}", f))?; | ||
|
||
match set_application(&safari_id) { | ||
Ok(_) => {}, | ||
Err(MacOsError::Application(error)) => println!("{}", error), | ||
Err(MacOsError::Notification(error)) => println!("{}", error), | ||
} | ||
|
||
Notification::new() | ||
.summary("Safari Crashed") | ||
.body("Just kidding, this is just the notify_rust example.") | ||
.appname("Safari") | ||
.icon("Safari") | ||
.show() | ||
.map_err(|f| format!("{}", f))?; | ||
|
||
Ok(()) | ||
} | ||
|
||
#[cfg(all(unix, not(target_os = "macos")))] | ||
fn main() { | ||
println!("this is a mac only feature") | ||
} | ||
|
||
#[cfg(target_os = "windows")] | ||
fn main() { | ||
println!("this is a mac only feature") | ||
} |