diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-11 23:31:36 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-11 23:34:20 +0300 |
| commit | fe693f613a23452e68589a4337863f217cc57930 (patch) | |
| tree | 8d60f6c5b0d8b31426c6623cc8b0c2415d481000 /src/app/input/settings.rs | |
| parent | 84c0d003ddb19a8e95e7ad5206771a663913605b (diff) | |
feat: add optional pane border labels
Diffstat (limited to 'src/app/input/settings.rs')
| -rw-r--r-- | src/app/input/settings.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/app/input/settings.rs b/src/app/input/settings.rs index 67144a28..9e89e515 100644 --- a/src/app/input/settings.rs +++ b/src/app/input/settings.rs @@ -16,6 +16,7 @@ pub(super) enum SettingsAction { SaveTheme(String), SaveSound(bool), SaveToastDelivery(ToastDelivery), + SaveAgentBorderLabels(bool), } impl App { @@ -25,6 +26,9 @@ impl App { SettingsAction::SaveTheme(name) => self.save_theme(&name), SettingsAction::SaveSound(enabled) => self.save_sound(enabled), SettingsAction::SaveToastDelivery(delivery) => self.save_toast_delivery(delivery), + SettingsAction::SaveAgentBorderLabels(enabled) => { + self.save_agent_border_labels(enabled) + } } } } @@ -157,6 +161,30 @@ pub(super) fn update_settings_state(state: &mut AppState, key: KeyEvent) -> Opti state.settings.list.selected = usize::from(!state.sound_enabled()); } KeyCode::Tab | KeyCode::Right | KeyCode::Char('l') => { + state.settings.section = SettingsSection::PaneLabels; + state.settings.list.selected = usize::from(!state.agent_border_labels_enabled()); + } + _ => { + if let Some(super::modal::ModalAction::Close) = + super::modal::modal_action_from_key(&key, super::modal::SETTINGS_ACTIONS) + { + cancel_settings(state); + } + } + }, + SettingsSection::PaneLabels => match key.code { + KeyCode::Up | KeyCode::Char('k') | KeyCode::Down | KeyCode::Char('j') => { + state.settings.list.selected = 1 - state.settings.list.selected.min(1); + } + KeyCode::Enter | KeyCode::Char(' ') => { + let enabled = state.settings.list.selected == 0; + return Some(SettingsAction::SaveAgentBorderLabels(enabled)); + } + KeyCode::BackTab | KeyCode::Left | KeyCode::Char('h') => { + state.settings.section = SettingsSection::Toast; + state.settings.list.selected = toast_delivery_index(state.toast_delivery()); + } + KeyCode::Tab | KeyCode::Right | KeyCode::Char('l') => { state.settings.section = SettingsSection::Theme; state.settings.list.selected = current_theme_index(&state.theme_name); } @@ -252,6 +280,14 @@ impl AppState { None } } + SettingsSection::PaneLabels => { + let list_y = area.y + 3; + if row >= list_y && row < list_y + 2 { + Some((row - list_y) as usize) + } else { + None + } + } } } @@ -264,6 +300,9 @@ impl AppState { SettingsSection::Theme => current_theme_index(&self.theme_name), SettingsSection::Sound => usize::from(!self.sound_enabled()), SettingsSection::Toast => toast_delivery_index(self.toast_delivery()), + SettingsSection::PaneLabels => { + usize::from(!self.agent_border_labels_enabled()) + } }); return None; } @@ -282,6 +321,10 @@ impl AppState { let delivery = toast_delivery_for_index(idx); Some(SettingsAction::SaveToastDelivery(delivery)) } + SettingsSection::PaneLabels => { + let enabled = idx == 0; + Some(SettingsAction::SaveAgentBorderLabels(enabled)) + } }; } |
