diff --git a/Cargo.lock b/Cargo.lock index 6958b2d..d15cd18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -231,7 +231,7 @@ dependencies = [ [[package]] name = "mahnung" -version = "0.4.1" +version = "0.4.2" dependencies = [ "chrono", "cron_tab", diff --git a/Cargo.toml b/Cargo.toml index 73f9bd0..11a1859 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mahnung" -version = "0.4.1" +version = "0.4.2" authors = ["Lalit Umbarkar "] edition = "2018" diff --git a/README.md b/README.md index 2c61596..1067fae 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,19 @@ to send system notifications every hour. ```bash mahnung & ``` + This would print debug messages by default, so it is better to add `2>&1 >/dev/null` in the end before `&` - You will be notified every hour. - To stop the notifications, run ```bash mahnung stop ``` +# Building + + - Clone the repo. + - Make sure Cargo and Rust are installed. + - Run ```cargo build``` + - To create a release ```cargo build --release``` diff --git a/src/main.rs b/src/main.rs index 1d386ab..8f9d1df 100644 --- a/src/main.rs +++ b/src/main.rs @@ -97,10 +97,15 @@ fn write_pid_to_file() { fn send_notification() { // Get the current time let current_hour = Local::now().hour(); - let _notification = Notification::new() - .summary(&format!("Its {} o'clock", current_hour)) - // This will auto dismiss the notification - .timeout(100) - .show(); + let current_min = Local::now().minute(); + // Only show notification if current time is around 10m, else skip + // Happens when cron could not be triggered on time + if current_min < 10 { + let _notification = Notification::new() + .summary(&format!("Its {} o'clock", current_hour)) + // This will auto dismiss the notification + .timeout(100) + .show(); + } }