Skip to content

Commit

Permalink
better notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
jbirnick committed Jan 4, 2025
1 parent 083b216 commit 285d5b0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::sync::{Arc, Mutex};
use time::{Duration, OffsetDateTime};

const SOCKET_PATH: &str = "/tmp/waybar_timer.sock";
//const SOCKET_PATH: &str = "mysocket";
const INTERVAL: std::time::Duration = std::time::Duration::from_secs(1);

fn send_notification(summary: String) {
Expand Down Expand Up @@ -103,6 +102,10 @@ impl Timer {

impl World for Timer {
fn cancel(&mut self) -> Result<(), WorldError> {
match self {
Self::Idle => {}
_ => send_notification("Timer canceled".into()),
};
*self = Self::Idle;
Ok(())
}
Expand Down Expand Up @@ -143,7 +146,7 @@ impl World for Timer {
match self {
Self::Running { expiry, command } => {
let time_left = *expiry - OffsetDateTime::now_local().unwrap();
send_notification(Self::tooltip(expiry));
send_notification("Timer paused".into());
*self = Self::Paused {
time_left,
command: command.take(),
Expand Down

0 comments on commit 285d5b0

Please sign in to comment.