diff --git a/src/handler.rs b/src/handler.rs index 9be3b0f..ce9d5d7 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -634,7 +634,7 @@ pub async fn handle_key_events( FocusedBlock::AccessPointInput => match key_event.code { KeyCode::Enter => { ap.start(sender.clone()).await?; - app.focused_block = FocusedBlock::Device; + app.focused_block = FocusedBlock::AccessPoint; } KeyCode::Esc => { @@ -709,6 +709,20 @@ pub async fn handle_key_events( _ => {} }, + KeyCode::Char(c) if c == config.ap.start => { + if app.focused_block == FocusedBlock::AccessPoint { + ap.ap_start + .store(true, std::sync::atomic::Ordering::Relaxed); + app.focused_block = FocusedBlock::AccessPointInput; + } + } + + KeyCode::Char(c) if c == config.ap.stop => { + if app.focused_block == FocusedBlock::AccessPoint { + ap.stop(sender.clone()).await?; + } + } + _ => { if app.focused_block == FocusedBlock::Device { match key_event.code { diff --git a/src/ui.rs b/src/ui.rs index e78de3d..a12644e 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -23,6 +23,9 @@ pub fn render(app: &mut App, frame: &mut Frame) { Mode::Ap => { if let Some(ap) = &mut app.device.ap { ap.render(frame, app.focused_block, &device, app.config.clone()); + if app.focused_block == FocusedBlock::AccessPointInput { + ap.render_input(frame); + } } } }