From b5f3c709bf536f681365eeca858ca148c4dfe5d6 Mon Sep 17 00:00:00 2001 From: Jens Krause <47693+sectore@users.noreply.github.com> Date: Mon, 13 Oct 2025 12:46:32 +0200 Subject: [PATCH] (keybindings)! change keys for `screens` (#126) --- CHANGELOG.md | 1 + README.md | 9 +++++---- src/app.rs | 12 +++++------- src/event.rs | 4 ++-- src/widgets/footer.rs | 9 +++++---- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f82b07..5aa3609 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Breaking change +- (keybindings)! change keys for `screens` [#126](https://github.com/sectore/timr-tui/pull/126) - (cli)! Remove `--countdown-target` argument [#121](https://github.com/sectore/timr-tui/pull/121) diff --git a/README.md b/README.md index cbf581f..25f1606 100644 --- a/README.md +++ b/README.md @@ -121,10 +121,11 @@ Extra option (if `--features sound` is enabled by local build only): | Key | Description | | --- | --- | -| p | Pomodoro | -| c | Countdown | -| t | Timer | -| l | Local Time | +| 1 | Pomodoro | +| 2 | Countdown | +| 3 | Timer | +| 4 | Event | +| 0 | Local Time | ## Controls diff --git a/src/app.rs b/src/app.rs index 502a0b8..aec9400 100644 --- a/src/app.rs +++ b/src/app.rs @@ -242,13 +242,11 @@ impl App { debug!("Received key {:?}", key.code); match key.code { KeyCode::Char('q') => app.mode = Mode::Quit, - KeyCode::Char('c') => app.content = Content::Countdown, - KeyCode::Char('t') => app.content = Content::Timer, - KeyCode::Char('p') => app.content = Content::Pomodoro, - // TODO(#102) Before we can use `e` here - // we do need to change keybindings for editing. - KeyCode::Char('z') => app.content = Content::Event, - KeyCode::Char('l') => app.content = Content::LocalTime, + KeyCode::Char('1') | KeyCode::Char('c') /* TODO: deprecated, remove it in next verson */ => app.content = Content::Countdown, + KeyCode::Char('2') | KeyCode::Char('t') /* TODO: deprecated, remove it in next verson */ => app.content = Content::Timer, + KeyCode::Char('3') | KeyCode::Char('p') /* TODO: deprecated, remove it in next verson */ => app.content = Content::Pomodoro, + KeyCode::Char('4') => app.content = Content::Event, + KeyCode::Char('0') | KeyCode::Char('l') /* TODO: deprecated, remove it in next verson */ => app.content = Content::LocalTime, // toogle app time format KeyCode::Char(':') => { if app.content == Content::LocalTime { diff --git a/src/event.rs b/src/event.rs index 12f3aaa..93f33b0 100644 --- a/src/event.rs +++ b/src/event.rs @@ -9,13 +9,13 @@ pub struct Event { pub fn get_default_event() -> Event { Event { date_time: time::PrimitiveDateTime::parse( - // Mario Bros "...entered mass production in Japan on June 21" 1983 + // Mario Bros. "...entered mass production in Japan on June 21" 1983 // https://en.wikipedia.org/wiki/Mario_Bros.#Release "1983-06-21 00:00", format_description!("[year]-[month]-[day] [hour]:[minute]"), ) .unwrap(), - title: Some("Release date of Mario Bros in Japan".into()), + title: Some("Release date of Mario Bros. in Japan".into()), } } diff --git a/src/widgets/footer.rs b/src/widgets/footer.rs index c7c9be8..af7adbb 100644 --- a/src/widgets/footer.rs +++ b/src/widgets/footer.rs @@ -53,10 +53,11 @@ impl StatefulWidget for Footer { type State = FooterState; fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State) { let content_labels: BTreeMap = BTreeMap::from([ - (Content::Countdown, "[c]ountdown"), - (Content::Timer, "[t]imer"), - (Content::Pomodoro, "[p]omodoro"), - (Content::LocalTime, "[l]ocal time"), + (Content::Countdown, "[1]countdown"), + (Content::Timer, "[2]timer"), + (Content::Pomodoro, "[3]pomodoro"), + (Content::Event, "[4]event"), + (Content::LocalTime, "[0]local time"), ]); let [_, area] =