9 Commits

Author SHA1 Message Date
jk
1d542799f6 start workflow by release/* branches only
but not by tags to avoid overriding releases.
2025-07-03 10:50:14 +02:00
jk
cc656b6ffe update CHANGELOG 2025-07-03 10:48:23 +02:00
jk
936d82eb94 bump v1.3.1 2025-07-03 10:48:05 +02:00
jk
5bc37f005f lint again
in addition to #88, especially 78f5269
2025-06-28 11:49:21 +02:00
Jens Krause
bfa40fd8f1 Rust 1.88.0 (#85)
* Rust 1.88.0

* nix flake update

* cargo upgrade

* lint

all `uninlined_format_args` related
@see https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
2025-06-28 11:39:22 +02:00
Jens Krause
93a3cde396 Rust 1.87.0 (#84)
* Rust 1.87.0

* nix flake update

* update CHANGELOG

* cargo upgrade

name         old req compatible latest new req
====         ======= ========== ====== =======
color-eyre   0.6.2   0.6.5      0.6.5  0.6.5
tokio        1.41.1  1.45.1     1.45.1 1.45.1
tokio-stream 0.1.16  0.1.17     0.1.17 0.1.17
tokio-util   0.7.12  0.7.15     0.7.15 0.7.15
clap         4.5.23  4.5.39     4.5.39 4.5.39
time         0.3.37  0.3.41     0.3.41 0.3.41
notify-rust  4.11.4  4.11.7     4.11.7 4.11.7
thiserror    2.0.11  2.0.12     2.0.12 2.0.12
2025-06-09 17:00:31 +02:00
Jens Krause
d27587a44a fix(pomodoro): ctrl+r resets rounds + both clocks (#83) 2025-05-20 10:01:29 +02:00
Jens Krause
5f4c5bb8ed (pomodoro) reset active clock only (#82)
It reverts changes of cc35f20f3e
2025-05-13 11:00:56 +02:00
Jens Krause
44af71c01c (args) set content by given duration (#81) 2025-05-12 12:14:27 +02:00
12 changed files with 355 additions and 252 deletions

View File

@@ -4,8 +4,6 @@ on:
push:
branches:
- "release/**"
tags:
- "v*"
jobs:
get-version:

View File

@@ -1,8 +1,23 @@
# 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
### Features
###
- (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)

477
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,10 @@
[package]
name = "timr-tui"
version = "1.3.0"
version = "1.3.1"
description = "TUI to organize your time: Pomodoro, Countdown, Timer."
edition = "2024"
# 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"
repository = "https://github.com/sectore/timr-tui"
readme = "README.md"
@@ -16,25 +16,25 @@ exclude = [".github/*", "demo/*.tape", "result/*", "*.mp3"]
[dependencies]
ratatui = "0.29.0"
crossterm = { version = "0.28.1", features = ["event-stream", "serde"] }
color-eyre = "0.6.2"
color-eyre = "0.6.5"
futures = "0.3"
serde = { version = "1", features = ["derive"] }
serde_json = "1.0"
strum = { version = "0.26.3", features = ["derive"] }
tokio = { version = "1.41.1", features = ["full"] }
tokio-stream = "0.1.16"
tokio-util = "0.7.12"
tokio = { version = "1.45.1", features = ["full"] }
tokio-stream = "0.1.17"
tokio-util = "0.7.15"
tracing = "0.1.41"
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
directories = "5.0.1"
clap = { version = "4.5.23", features = ["derive"] }
time = { version = "0.3.37", features = ["formatting", "local-offset"] }
notify-rust = "4.11.4"
clap = { version = "4.5.40", features = ["derive"] }
time = { version = "0.3.41", features = ["formatting", "local-offset"] }
notify-rust = "4.11.7"
rodio = { version = "0.20.1", features = [
"symphonia-mp3",
"symphonia-wav",
], default-features = false, optional = true }
thiserror = { version = "2.0.11", optional = true }
thiserror = { version = "2.0.12", optional = true }
[features]

24
flake.lock generated
View File

@@ -2,11 +2,11 @@
"nodes": {
"crane": {
"locked": {
"lastModified": 1745454774,
"narHash": "sha256-oLvmxOnsEKGtwczxp/CwhrfmQUG2ym24OMWowcoRhH8=",
"lastModified": 1750266157,
"narHash": "sha256-tL42YoNg9y30u7zAqtoGDNdTyXTi8EALDeCB13FtbQA=",
"owner": "ipetkov",
"repo": "crane",
"rev": "efd36682371678e2b6da3f108fdb5c613b3ec598",
"rev": "e37c943371b73ed87faf33f7583860f81f1d5a48",
"type": "github"
},
"original": {
@@ -23,11 +23,11 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1745995211,
"narHash": "sha256-hf6Xu3KS06WyE/3dqV96iLGx3jIYQq9e68iCEFHrt04=",
"lastModified": 1751092526,
"narHash": "sha256-vmbu97JXqr9/sTWR5XRh646jkp8a0J9m0o6JIQTdjE4=",
"owner": "nix-community",
"repo": "fenix",
"rev": "0db04339c4e4c0fd42dbbaebe3590a67cbd12aa3",
"rev": "6643d56d9a78afa157b577862c220298c09b891d",
"type": "github"
},
"original": {
@@ -56,11 +56,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1745930157,
"narHash": "sha256-y3h3NLnzRSiUkYpnfvnS669zWZLoqqI6NprtLQ+5dck=",
"lastModified": 1750776420,
"narHash": "sha256-/CG+w0o0oJ5itVklOoLbdn2dGB0wbZVOoDm4np6w09A=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "46e634be05ce9dc6d4db8e664515ba10b78151ae",
"rev": "30a61f056ac492e3b7cdcb69c1e6abdcf00e39cf",
"type": "github"
},
"original": {
@@ -81,11 +81,11 @@
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1745949276,
"narHash": "sha256-9ZK31t2HUiGdLLnDafrRnSrrO12JwqcAFbrJ9nRwh0Y=",
"lastModified": 1750871759,
"narHash": "sha256-hMNZXMtlhfjQdu1F4Fa/UFiMoXdZag4cider2R9a648=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "78a488dd5e7e4f17162001519665795e6e68b6f8",
"rev": "317542c1e4a3ec3467d21d1c25f6a43b80d83e7d",
"type": "github"
},
"original": {

View File

@@ -24,7 +24,7 @@
{
file = ./rust-toolchain.toml;
# sha256 = nixpkgs.lib.fakeSha256;
sha256 = "sha256-X/4ZBHO3iW0fOenQ3foEvscgAPJYl2abspaBThDOukI=";
sha256 = "sha256-Qxt8XAuaUR2OMdKbN4u8dBJOhSHxS+uS06Wl9+flVEk=";
};
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;

View File

@@ -1,6 +1,6 @@
[toolchain]
# 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"]
targets = ["x86_64-pc-windows-gnu", "x86_64-unknown-linux-musl"]
profile = "minimal"

View File

@@ -92,7 +92,22 @@ impl From<FromAppArgs> for App {
notification: args.notification.unwrap_or(stg.notification),
blink: args.blink.unwrap_or(stg.blink),
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),
pomodoro_mode: stg.pomodoro_mode,
pomodoro_round: stg.pomodoro_count,
@@ -261,7 +276,7 @@ impl App {
ClockTypeId::Timer => {
format!("{name} stopped by reaching its maximum value.")
}
_ => format!("{:?} {name} done!", type_id),
_ => format!("{type_id:?} {name} done!"),
};
// notification
let result = notify_rust::Notification::new()

View File

@@ -177,22 +177,22 @@ mod tests {
fn test_fmt() {
// hh:mm:ss
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
let ex: DurationEx = Duration::from_secs(3601).into();
assert_eq!(format!("{}", ex), "1:00:01");
assert_eq!(format!("{ex}"), "1:00:01");
// mm:ss
let ex: DurationEx = Duration::from_secs(71).into();
assert_eq!(format!("{}", ex), "1:11");
assert_eq!(format!("{ex}"), "1:11");
// m:ss
let ex: DurationEx = Duration::from_secs(61).into();
assert_eq!(format!("{}", ex), "1:01");
assert_eq!(format!("{ex}"), "1:01");
// ss
let ex: DurationEx = Duration::from_secs(11).into();
assert_eq!(format!("{}", ex), "11");
assert_eq!(format!("{ex}"), "11");
// s
let ex: DurationEx = Duration::from_secs(1).into();
assert_eq!(format!("{}", ex), "1");
assert_eq!(format!("{ex}"), "1");
}
#[test]
@@ -200,7 +200,7 @@ mod tests {
let ex: DurationEx = Duration::from_secs(10).into();
let ex2: DurationEx = Duration::from_secs(1).into();
let ex3 = ex.saturating_sub(ex2);
assert_eq!(format!("{}", ex3), "9");
assert_eq!(format!("{ex3}"), "9");
}
#[test]
@@ -208,7 +208,7 @@ mod tests {
let ex: DurationEx = Duration::from_secs(10).into();
let ex2: DurationEx = Duration::from_secs(1).into();
let ex3 = ex.saturating_add(ex2);
assert_eq!(format!("{}", ex3), "11");
assert_eq!(format!("{ex3}"), "11");
}
#[test]

View File

@@ -319,7 +319,7 @@ fn human_days_diff(a: &OffsetDateTime, b: &OffsetDateTime) -> String {
match days_diff {
0 => "today".to_owned(),
1 => "tomorrow".to_owned(),
n => format!("+{}days", n),
n => format!("+{n}days"),
}
}

View File

@@ -89,7 +89,7 @@ impl StatefulWidget for Footer {
let mut style = Style::default();
// Add space for all except last
let label = if index < content_labels.len() - 1 {
format!("{} ", label)
format!("{label} ")
} else {
label.to_string()
};
@@ -158,12 +158,12 @@ impl StatefulWidget for Footer {
}
spans.extend_from_slice(&[
Span::from(SPACE),
Span::from("[r]eset"),
Span::from("[r]eset clock"),
]);
if self.selected_content == Content::Pomodoro {
spans.extend_from_slice(&[
Span::from(SPACE),
Span::from("[^r]eset round"),
Span::from("[^r]eset clocks+rounds"),
]);
}
spans

View File

@@ -107,10 +107,18 @@ impl PomodoroState {
&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> {
&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 {
&self.mode
}
@@ -198,19 +206,19 @@ impl TuiEventHandler for PomodoroState {
KeyCode::Right => {
self.next();
}
// reset round
// reset rounds AND clocks
KeyCode::Char('r') if key.modifiers.contains(KeyModifiers::CONTROL) => {
self.round = 1;
self.get_clock_work_mut().reset();
self.get_clock_pause_mut().reset();
}
// reset values
// reset current clock
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() {
self.round += 1;
}
// reset both clocks
self.clock_map.pause.reset();
self.clock_map.work.reset();
self.get_clock_mut().reset();
}
_ => return Some(event),
},