diff options
Diffstat (limited to 'src/pomo')
| -rw-r--r-- | src/pomo/mod.rs | 3 | ||||
| -rw-r--r-- | src/pomo/state.rs | 19 | ||||
| -rw-r--r-- | src/pomo/ui.rs | 2 |
3 files changed, 14 insertions, 10 deletions
diff --git a/src/pomo/mod.rs b/src/pomo/mod.rs index 42ce627..cd7a663 100644 --- a/src/pomo/mod.rs +++ b/src/pomo/mod.rs @@ -110,6 +110,9 @@ impl Pomo { } } + (AppScreen::Timer, KeyCode::Char('a')) => { + self.auto_switch_sessions = !self.auto_switch_sessions + } (AppScreen::Timer, KeyCode::Char('t')) => self.screen = AppScreen::Tasks, (AppScreen::Timer, KeyCode::Char(' ')) => self.is_running = !self.is_running, (AppScreen::Timer, KeyCode::Char('r')) => self.time_remaining = self.work_time, diff --git a/src/pomo/state.rs b/src/pomo/state.rs index 2a59042..d53bc69 100644 --- a/src/pomo/state.rs +++ b/src/pomo/state.rs @@ -158,20 +158,21 @@ impl Pomo { "Ref! Do Something! The break's over!", ]; - if self.auto_switch_sessions { - // Use the remaining duration/break count as a seed for simple 'random' selection - let idx = (self.break_count as usize) % 4; + // Use the remaining duration/break count as a seed for simple 'random' selection + let idx = (self.break_count as usize) % 4; + + let (title, msg) = match self.mode { + SessionMode::Work => ("Focus Block Complete", focus_msg[idx]), + _ => ("Break Over", break_msg[idx]), + }; - let (title, msg) = match self.mode { - SessionMode::Work => ("Focus Block Complete", focus_msg[idx]), - _ => ("Break Over", break_msg[idx]), - }; + self.send_notification(title, msg); - self.send_notification(title, msg); + if self.auto_switch_sessions { self.transition_next_session(); self.is_running = true; } else { - // TODO: Handle manual session switching + self.is_running = false; } } } diff --git a/src/pomo/ui.rs b/src/pomo/ui.rs index c893cd7..ca4eb44 100644 --- a/src/pomo/ui.rs +++ b/src/pomo/ui.rs @@ -34,7 +34,7 @@ pub fn render(f: &mut Frame, app: &mut Pomo) { }; let footer = format!( - "tab session • t tasks • e edit time • space pause • r reset • {} • q quit", + "tab session • {} • t tasks • e edit time • space pause • r reset • q quit", auto_switch ); f.render_widget( |