fix: ignore release key events

This commit is contained in:
talwat 2024-10-17 21:33:23 +02:00
parent a64b10e20c
commit 30af38a63a

View File

@ -1,6 +1,6 @@
use std::sync::atomic::Ordering;
use crossterm::event::{self, EventStream, KeyCode, KeyModifiers};
use crossterm::event::{self, EventStream, KeyCode, KeyEventKind, KeyModifiers};
use futures::{FutureExt, StreamExt};
use tokio::sync::mpsc::Sender;
@ -17,6 +17,10 @@ pub async fn listen(sender: Sender<Messages>) -> eyre::Result<()> {
continue;
};
if event.kind == KeyEventKind::Release {
continue;
}
let messages = match event.code {
// Arrow key volume controls.
KeyCode::Up => Messages::ChangeVolume(0.1),