aboutsummaryrefslogtreecommitdiff
path: root/src/pomo
diff options
context:
space:
mode:
authorRanXom <saiyedshizain@gmail.com>2026-06-12 23:15:51 +0530
committerRanXom <saiyedshizain@gmail.com>2026-06-12 23:15:51 +0530
commitbb9688d43051c19cc2dc697389547470d8c18f62 (patch)
treedcd10f61a0be093e5d4c1753618b37b93170c35e /src/pomo
parentc2cd16b5993526d95d91326683f0f8338f63a9eb (diff)
downloadpomoru-bb9688d43051c19cc2dc697389547470d8c18f62.tar.xz
pomoru-bb9688d43051c19cc2dc697389547470d8c18f62.zip
Handle session switch manage on timer expiration
Diffstat (limited to 'src/pomo')
-rw-r--r--src/pomo/mod.rs3
-rw-r--r--src/pomo/state.rs19
-rw-r--r--src/pomo/ui.rs2
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(