(keybindings)! change keys for screens (#126)

This commit is contained in:
Jens Krause 2025-10-13 12:46:32 +02:00 committed by GitHub
parent 56e6ce66fa
commit b5f3c709bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 17 deletions

View File

@ -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)

View File

@ -121,10 +121,11 @@ Extra option (if `--features sound` is enabled by local build only):
| Key | Description |
| --- | --- |
| <kbd>p</kbd> | Pomodoro |
| <kbd>c</kbd> | Countdown |
| <kbd>t</kbd> | Timer |
| <kbd>l</kbd> | Local Time |
| <kbd>1</kbd> | Pomodoro |
| <kbd>2</kbd> | Countdown |
| <kbd>3</kbd> | Timer |
| <kbd>4</kbd> | Event |
| <kbd>0</kbd> | Local Time |
## Controls

View File

@ -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 {

View File

@ -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()),
}
}

View File

@ -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<Content, &str> = 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] =