Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d542799f6 | ||
|
|
cc656b6ffe | ||
|
|
936d82eb94 | ||
|
|
5bc37f005f | ||
|
|
bfa40fd8f1 | ||
|
|
93a3cde396 | ||
|
|
d27587a44a | ||
|
|
5f4c5bb8ed | ||
|
|
44af71c01c |
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -4,8 +4,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "release/**"
|
- "release/**"
|
||||||
tags:
|
|
||||||
- "v*"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
get-version:
|
get-version:
|
||||||
|
|||||||
17
CHANGELOG.md
17
CHANGELOG.md
@@ -1,8 +1,23 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v1.3.1 - 2025-07-03
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- (args) set `content` by given duration [#81](https://github.com/sectore/timr-tui/pull/81)
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
- (pomodoro) `ctrl+r` resets rounds AND both clocks [#83](https://github.com/sectore/timr-tui/pull/83)
|
||||||
|
- (pomodoro) reset active clock only [#82](https://github.com/sectore/timr-tui/pull/82)
|
||||||
|
|
||||||
|
### Misc.
|
||||||
|
|
||||||
|
- (deps) Rust 1.88.0 [#85](https://github.com/sectore/timr-tui/pull/85)
|
||||||
|
|
||||||
## v1.3.0 - 2025-05-06
|
## v1.3.0 - 2025-05-06
|
||||||
|
|
||||||
### Features
|
###
|
||||||
|
|
||||||
- (pomodoro) Count WORK rounds [#75](https://github.com/sectore/timr-tui/pull/75), [6b068bb](https://github.com/sectore/timr-tui/commit/6b068bbd094d9ec1a36b47598fadfc71296d9590)
|
- (pomodoro) Count WORK rounds [#75](https://github.com/sectore/timr-tui/pull/75), [6b068bb](https://github.com/sectore/timr-tui/commit/6b068bbd094d9ec1a36b47598fadfc71296d9590)
|
||||||
- (pomodoro/countdown) Change initial value [#79](https://github.com/sectore/timr-tui/pull/79), [aae5c38](https://github.com/sectore/timr-tui/commit/aae5c38cd6a666d5ba418b12fb67879a2146b9a2)
|
- (pomodoro/countdown) Change initial value [#79](https://github.com/sectore/timr-tui/pull/79), [aae5c38](https://github.com/sectore/timr-tui/commit/aae5c38cd6a666d5ba418b12fb67879a2146b9a2)
|
||||||
|
|||||||
477
Cargo.lock
generated
477
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
20
Cargo.toml
20
Cargo.toml
@@ -1,10 +1,10 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "timr-tui"
|
name = "timr-tui"
|
||||||
version = "1.3.0"
|
version = "1.3.1"
|
||||||
description = "TUI to organize your time: Pomodoro, Countdown, Timer."
|
description = "TUI to organize your time: Pomodoro, Countdown, Timer."
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
# Reminder: Always keep `channel` in `rust-toolchain.toml` in sync with `rust-version`.
|
# Reminder: Always keep `channel` in `rust-toolchain.toml` in sync with `rust-version`.
|
||||||
rust-version = "1.86.0"
|
rust-version = "1.88.0"
|
||||||
homepage = "https://github.com/sectore/timr-tui"
|
homepage = "https://github.com/sectore/timr-tui"
|
||||||
repository = "https://github.com/sectore/timr-tui"
|
repository = "https://github.com/sectore/timr-tui"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
@@ -16,25 +16,25 @@ exclude = [".github/*", "demo/*.tape", "result/*", "*.mp3"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
ratatui = "0.29.0"
|
ratatui = "0.29.0"
|
||||||
crossterm = { version = "0.28.1", features = ["event-stream", "serde"] }
|
crossterm = { version = "0.28.1", features = ["event-stream", "serde"] }
|
||||||
color-eyre = "0.6.2"
|
color-eyre = "0.6.5"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
strum = { version = "0.26.3", features = ["derive"] }
|
strum = { version = "0.26.3", features = ["derive"] }
|
||||||
tokio = { version = "1.41.1", features = ["full"] }
|
tokio = { version = "1.45.1", features = ["full"] }
|
||||||
tokio-stream = "0.1.16"
|
tokio-stream = "0.1.17"
|
||||||
tokio-util = "0.7.12"
|
tokio-util = "0.7.15"
|
||||||
tracing = "0.1.41"
|
tracing = "0.1.41"
|
||||||
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
|
||||||
directories = "5.0.1"
|
directories = "5.0.1"
|
||||||
clap = { version = "4.5.23", features = ["derive"] }
|
clap = { version = "4.5.40", features = ["derive"] }
|
||||||
time = { version = "0.3.37", features = ["formatting", "local-offset"] }
|
time = { version = "0.3.41", features = ["formatting", "local-offset"] }
|
||||||
notify-rust = "4.11.4"
|
notify-rust = "4.11.7"
|
||||||
rodio = { version = "0.20.1", features = [
|
rodio = { version = "0.20.1", features = [
|
||||||
"symphonia-mp3",
|
"symphonia-mp3",
|
||||||
"symphonia-wav",
|
"symphonia-wav",
|
||||||
], default-features = false, optional = true }
|
], default-features = false, optional = true }
|
||||||
thiserror = { version = "2.0.11", optional = true }
|
thiserror = { version = "2.0.12", optional = true }
|
||||||
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|||||||
24
flake.lock
generated
24
flake.lock
generated
@@ -2,11 +2,11 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"crane": {
|
"crane": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1745454774,
|
"lastModified": 1750266157,
|
||||||
"narHash": "sha256-oLvmxOnsEKGtwczxp/CwhrfmQUG2ym24OMWowcoRhH8=",
|
"narHash": "sha256-tL42YoNg9y30u7zAqtoGDNdTyXTi8EALDeCB13FtbQA=",
|
||||||
"owner": "ipetkov",
|
"owner": "ipetkov",
|
||||||
"repo": "crane",
|
"repo": "crane",
|
||||||
"rev": "efd36682371678e2b6da3f108fdb5c613b3ec598",
|
"rev": "e37c943371b73ed87faf33f7583860f81f1d5a48",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -23,11 +23,11 @@
|
|||||||
"rust-analyzer-src": "rust-analyzer-src"
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1745995211,
|
"lastModified": 1751092526,
|
||||||
"narHash": "sha256-hf6Xu3KS06WyE/3dqV96iLGx3jIYQq9e68iCEFHrt04=",
|
"narHash": "sha256-vmbu97JXqr9/sTWR5XRh646jkp8a0J9m0o6JIQTdjE4=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "fenix",
|
"repo": "fenix",
|
||||||
"rev": "0db04339c4e4c0fd42dbbaebe3590a67cbd12aa3",
|
"rev": "6643d56d9a78afa157b577862c220298c09b891d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -56,11 +56,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1745930157,
|
"lastModified": 1750776420,
|
||||||
"narHash": "sha256-y3h3NLnzRSiUkYpnfvnS669zWZLoqqI6NprtLQ+5dck=",
|
"narHash": "sha256-/CG+w0o0oJ5itVklOoLbdn2dGB0wbZVOoDm4np6w09A=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "46e634be05ce9dc6d4db8e664515ba10b78151ae",
|
"rev": "30a61f056ac492e3b7cdcb69c1e6abdcf00e39cf",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -81,11 +81,11 @@
|
|||||||
"rust-analyzer-src": {
|
"rust-analyzer-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1745949276,
|
"lastModified": 1750871759,
|
||||||
"narHash": "sha256-9ZK31t2HUiGdLLnDafrRnSrrO12JwqcAFbrJ9nRwh0Y=",
|
"narHash": "sha256-hMNZXMtlhfjQdu1F4Fa/UFiMoXdZag4cider2R9a648=",
|
||||||
"owner": "rust-lang",
|
"owner": "rust-lang",
|
||||||
"repo": "rust-analyzer",
|
"repo": "rust-analyzer",
|
||||||
"rev": "78a488dd5e7e4f17162001519665795e6e68b6f8",
|
"rev": "317542c1e4a3ec3467d21d1c25f6a43b80d83e7d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
{
|
{
|
||||||
file = ./rust-toolchain.toml;
|
file = ./rust-toolchain.toml;
|
||||||
# sha256 = nixpkgs.lib.fakeSha256;
|
# sha256 = nixpkgs.lib.fakeSha256;
|
||||||
sha256 = "sha256-X/4ZBHO3iW0fOenQ3foEvscgAPJYl2abspaBThDOukI=";
|
sha256 = "sha256-Qxt8XAuaUR2OMdKbN4u8dBJOhSHxS+uS06Wl9+flVEk=";
|
||||||
};
|
};
|
||||||
|
|
||||||
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
|
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
# Reminder: Always keep `rust-version` in `Cargo.toml` in sync with `channel`.
|
# Reminder: Always keep `rust-version` in `Cargo.toml` in sync with `channel`.
|
||||||
channel = "1.86.0"
|
channel = "1.88.0"
|
||||||
components = ["clippy", "rustfmt", "rust-src", "rust-analyzer"]
|
components = ["clippy", "rustfmt", "rust-src", "rust-analyzer"]
|
||||||
targets = ["x86_64-pc-windows-gnu", "x86_64-unknown-linux-musl"]
|
targets = ["x86_64-pc-windows-gnu", "x86_64-unknown-linux-musl"]
|
||||||
profile = "minimal"
|
profile = "minimal"
|
||||||
|
|||||||
19
src/app.rs
19
src/app.rs
@@ -92,7 +92,22 @@ impl From<FromAppArgs> for App {
|
|||||||
notification: args.notification.unwrap_or(stg.notification),
|
notification: args.notification.unwrap_or(stg.notification),
|
||||||
blink: args.blink.unwrap_or(stg.blink),
|
blink: args.blink.unwrap_or(stg.blink),
|
||||||
app_time_format: stg.app_time_format,
|
app_time_format: stg.app_time_format,
|
||||||
content: args.mode.unwrap_or(stg.content),
|
// Check args to set a possible mode to start with.
|
||||||
|
content: match args.mode {
|
||||||
|
Some(mode) => mode,
|
||||||
|
// check other args (especially durations)
|
||||||
|
None => {
|
||||||
|
if args.work.is_some() || args.pause.is_some() {
|
||||||
|
Content::Pomodoro
|
||||||
|
} else if args.countdown.is_some() {
|
||||||
|
Content::Countdown
|
||||||
|
}
|
||||||
|
// in other case just use latest stored state
|
||||||
|
else {
|
||||||
|
stg.content
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
style: args.style.unwrap_or(stg.style),
|
style: args.style.unwrap_or(stg.style),
|
||||||
pomodoro_mode: stg.pomodoro_mode,
|
pomodoro_mode: stg.pomodoro_mode,
|
||||||
pomodoro_round: stg.pomodoro_count,
|
pomodoro_round: stg.pomodoro_count,
|
||||||
@@ -261,7 +276,7 @@ impl App {
|
|||||||
ClockTypeId::Timer => {
|
ClockTypeId::Timer => {
|
||||||
format!("{name} stopped by reaching its maximum value.")
|
format!("{name} stopped by reaching its maximum value.")
|
||||||
}
|
}
|
||||||
_ => format!("{:?} {name} done!", type_id),
|
_ => format!("{type_id:?} {name} done!"),
|
||||||
};
|
};
|
||||||
// notification
|
// notification
|
||||||
let result = notify_rust::Notification::new()
|
let result = notify_rust::Notification::new()
|
||||||
|
|||||||
@@ -177,22 +177,22 @@ mod tests {
|
|||||||
fn test_fmt() {
|
fn test_fmt() {
|
||||||
// hh:mm:ss
|
// hh:mm:ss
|
||||||
let ex: DurationEx = Duration::from_secs(36001).into();
|
let ex: DurationEx = Duration::from_secs(36001).into();
|
||||||
assert_eq!(format!("{}", ex), "10:00:01");
|
assert_eq!(format!("{ex}"), "10:00:01");
|
||||||
// h:mm:ss
|
// h:mm:ss
|
||||||
let ex: DurationEx = Duration::from_secs(3601).into();
|
let ex: DurationEx = Duration::from_secs(3601).into();
|
||||||
assert_eq!(format!("{}", ex), "1:00:01");
|
assert_eq!(format!("{ex}"), "1:00:01");
|
||||||
// mm:ss
|
// mm:ss
|
||||||
let ex: DurationEx = Duration::from_secs(71).into();
|
let ex: DurationEx = Duration::from_secs(71).into();
|
||||||
assert_eq!(format!("{}", ex), "1:11");
|
assert_eq!(format!("{ex}"), "1:11");
|
||||||
// m:ss
|
// m:ss
|
||||||
let ex: DurationEx = Duration::from_secs(61).into();
|
let ex: DurationEx = Duration::from_secs(61).into();
|
||||||
assert_eq!(format!("{}", ex), "1:01");
|
assert_eq!(format!("{ex}"), "1:01");
|
||||||
// ss
|
// ss
|
||||||
let ex: DurationEx = Duration::from_secs(11).into();
|
let ex: DurationEx = Duration::from_secs(11).into();
|
||||||
assert_eq!(format!("{}", ex), "11");
|
assert_eq!(format!("{ex}"), "11");
|
||||||
// s
|
// s
|
||||||
let ex: DurationEx = Duration::from_secs(1).into();
|
let ex: DurationEx = Duration::from_secs(1).into();
|
||||||
assert_eq!(format!("{}", ex), "1");
|
assert_eq!(format!("{ex}"), "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -200,7 +200,7 @@ mod tests {
|
|||||||
let ex: DurationEx = Duration::from_secs(10).into();
|
let ex: DurationEx = Duration::from_secs(10).into();
|
||||||
let ex2: DurationEx = Duration::from_secs(1).into();
|
let ex2: DurationEx = Duration::from_secs(1).into();
|
||||||
let ex3 = ex.saturating_sub(ex2);
|
let ex3 = ex.saturating_sub(ex2);
|
||||||
assert_eq!(format!("{}", ex3), "9");
|
assert_eq!(format!("{ex3}"), "9");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -208,7 +208,7 @@ mod tests {
|
|||||||
let ex: DurationEx = Duration::from_secs(10).into();
|
let ex: DurationEx = Duration::from_secs(10).into();
|
||||||
let ex2: DurationEx = Duration::from_secs(1).into();
|
let ex2: DurationEx = Duration::from_secs(1).into();
|
||||||
let ex3 = ex.saturating_add(ex2);
|
let ex3 = ex.saturating_add(ex2);
|
||||||
assert_eq!(format!("{}", ex3), "11");
|
assert_eq!(format!("{ex3}"), "11");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ fn human_days_diff(a: &OffsetDateTime, b: &OffsetDateTime) -> String {
|
|||||||
match days_diff {
|
match days_diff {
|
||||||
0 => "today".to_owned(),
|
0 => "today".to_owned(),
|
||||||
1 => "tomorrow".to_owned(),
|
1 => "tomorrow".to_owned(),
|
||||||
n => format!("+{}days", n),
|
n => format!("+{n}days"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ impl StatefulWidget for Footer {
|
|||||||
let mut style = Style::default();
|
let mut style = Style::default();
|
||||||
// Add space for all except last
|
// Add space for all except last
|
||||||
let label = if index < content_labels.len() - 1 {
|
let label = if index < content_labels.len() - 1 {
|
||||||
format!("{} ", label)
|
format!("{label} ")
|
||||||
} else {
|
} else {
|
||||||
label.to_string()
|
label.to_string()
|
||||||
};
|
};
|
||||||
@@ -158,12 +158,12 @@ impl StatefulWidget for Footer {
|
|||||||
}
|
}
|
||||||
spans.extend_from_slice(&[
|
spans.extend_from_slice(&[
|
||||||
Span::from(SPACE),
|
Span::from(SPACE),
|
||||||
Span::from("[r]eset"),
|
Span::from("[r]eset clock"),
|
||||||
]);
|
]);
|
||||||
if self.selected_content == Content::Pomodoro {
|
if self.selected_content == Content::Pomodoro {
|
||||||
spans.extend_from_slice(&[
|
spans.extend_from_slice(&[
|
||||||
Span::from(SPACE),
|
Span::from(SPACE),
|
||||||
Span::from("[^r]eset round"),
|
Span::from("[^r]eset clocks+rounds"),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
spans
|
spans
|
||||||
|
|||||||
@@ -107,10 +107,18 @@ impl PomodoroState {
|
|||||||
&self.clock_map.work
|
&self.clock_map.work
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_clock_work_mut(&mut self) -> &mut ClockState<Countdown> {
|
||||||
|
self.clock_map.get_mut(&Mode::Work)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_clock_pause(&self) -> &ClockState<Countdown> {
|
pub fn get_clock_pause(&self) -> &ClockState<Countdown> {
|
||||||
&self.clock_map.pause
|
&self.clock_map.pause
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_clock_pause_mut(&mut self) -> &mut ClockState<Countdown> {
|
||||||
|
self.clock_map.get_mut(&Mode::Pause)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_mode(&self) -> &Mode {
|
pub fn get_mode(&self) -> &Mode {
|
||||||
&self.mode
|
&self.mode
|
||||||
}
|
}
|
||||||
@@ -198,19 +206,19 @@ impl TuiEventHandler for PomodoroState {
|
|||||||
KeyCode::Right => {
|
KeyCode::Right => {
|
||||||
self.next();
|
self.next();
|
||||||
}
|
}
|
||||||
// reset round
|
// reset rounds AND clocks
|
||||||
KeyCode::Char('r') if key.modifiers.contains(KeyModifiers::CONTROL) => {
|
KeyCode::Char('r') if key.modifiers.contains(KeyModifiers::CONTROL) => {
|
||||||
self.round = 1;
|
self.round = 1;
|
||||||
|
self.get_clock_work_mut().reset();
|
||||||
|
self.get_clock_pause_mut().reset();
|
||||||
}
|
}
|
||||||
// reset values
|
// reset current clock
|
||||||
KeyCode::Char('r') => {
|
KeyCode::Char('r') => {
|
||||||
// count number of finished rounds of WORK before resetting the clock
|
// increase round before (!!) resetting the clock
|
||||||
if self.get_mode() == &Mode::Work && self.get_clock().is_done() {
|
if self.get_mode() == &Mode::Work && self.get_clock().is_done() {
|
||||||
self.round += 1;
|
self.round += 1;
|
||||||
}
|
}
|
||||||
// reset both clocks
|
self.get_clock_mut().reset();
|
||||||
self.clock_map.pause.reset();
|
|
||||||
self.clock_map.work.reset();
|
|
||||||
}
|
}
|
||||||
_ => return Some(event),
|
_ => return Some(event),
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user