diff --git a/spotify_player/src/event/mod.rs b/spotify_player/src/event/mod.rs index f91ba040..db7867af 100644 --- a/spotify_player/src/event/mod.rs +++ b/spotify_player/src/event/mod.rs @@ -70,7 +70,17 @@ pub fn start_event_handler(state: SharedState, client_pub: flume::Sender handle_mouse_event(event, &client_pub, &state), - crossterm::event::Event::Key(event) => handle_key_event(event, &client_pub, &state), + crossterm::event::Event::Key(event) => { + if event.kind == crossterm::event::KeyEventKind::Press { + // only handle key press event to avoid handling a key event multiple times + // context: + // - https://github.com/crossterm-rs/crossterm/issues/752 + // - https://github.com/aome510/spotify-player/issues/136 + handle_key_event(event, &client_pub, &state) + } else { + Ok(()) + } + } _ => Ok(()), } { tracing::error!("Failed to handle event: {err:#}");