Files
skyshift/src/action.rs
T
skkeyeandClaude Opus 5.5 49e14b820a Add paid pomodoro breaks
Some jobs pay for breaks, so a pomodoro break shouldn't take time off
the workday. By default (new setting `paid_breaks`, in [reminders]), b
on the Tracker, zb anywhere or :break starts a pomodoro break WITHOUT
pausing the shift: the break stays in your worked time and the data
file isn't touched. b (or s) brings you back to focus. With the setting
off, b pauses the shift like p. p and e always stop the clock.

For the rhythm, a paid break still counts as a break: reminders::PaidBreaks
keeps them in memory and pomodoro() cuts them out of the focus stretches,
the same way as a pause. Stopping the shift ends a paid break, and
closing the work day forgets them.

The Tracker shows "on a paid break" and the paid break's progress, and
the nudges name the right key (b or p/s).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-25 00:06:26 -04:00

89 lines
2.3 KiB
Rust

//! Everything a screen or popup can ask the app to do.
//!
//! Screens and popups never change your data themselves: they return an
//! `Action`, and the app applies it in one place (`App::apply`), saves, and
//! reports what happened. That's the only way anything changes.
use jiff::civil::Date;
use jiff::{SignedDuration, Timestamp};
use crate::domain::Segment;
use crate::export::ExportFormat;
use crate::export::timesheet::CopyPreset;
use crate::time::DateRange;
use crate::ui::{Component, Tab};
pub enum Action {
// ----- Moving around the app
GoTo(Tab),
OpenPopup(Box<dyn Component>),
ClosePopup,
/// The help popup for the current screen.
ShowHelp,
/// Show a message in the status line.
Notify(String),
Quit,
// ----- The shift
Start,
/// Start working as if you had pressed Start at this earlier moment.
StartAt(Timestamp),
Pause,
/// Pause as if you had pressed Pause at this earlier moment.
PauseAt(Timestamp),
EndDay,
EndDayAt(Timestamp),
/// Move the start of the session in progress by this much.
ShiftRunningStart(SignedDuration),
/// Correct the session in progress: when it started, and optionally
/// when it actually stopped (you forgot to pause).
FixRunning {
since: Timestamp,
stopped: Option<Timestamp>,
},
/// Start a pomodoro break, or come back from one. With paid breaks the
/// shift keeps running; without, it's the same as Pause / Start.
TakeBreak,
/// Silence the break suggestion for a while.
Snooze,
// ----- Recorded work
AddSegment {
day: Date,
segment: Segment,
},
/// Replace segment `index` of `day`, filing the new one under `new_day`.
ReplaceSegment {
day: Date,
index: usize,
segment: Segment,
new_day: Date,
},
DeleteSegment {
day: Date,
index: usize,
},
Undo,
Redo,
// ----- Getting data out
Copy {
days: Vec<Date>,
preset: CopyPreset,
},
Export {
format: ExportFormat,
range: DateRange,
},
// ----- Settings, by their key in config.toml
SetSetting {
key: &'static str,
value: String,
},
ResetSetting {
key: &'static str,
},
ToggleWhichKey,
}