Add audio deps; extract input handling to threads

Add ALSA and Rodio crates to Cargo.toml and lockfile to enable audio
playback.
Update Nix expressions to include `alsa-lib` as a build input.
Refactor input event handling into a new `app::threads` module:
 - Define `AppEvent` enum and `handle_input_events` function there.
 - Adjust imports in `app/app.rs` and `main.rs` accordingly.
   Remove the now‑unused `handle_input_events` and `AppEvent`
   definitions from
   `app/app.rs`.
This commit is contained in:
GarandPLG committed 2026-04-06 11:47:46 +02:00
1 parent 92ace142b4
commit 30f2e17ed7
11 files changed
+954 -59

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
use ratatui::crossterm::event::KeyEvent;
pub enum AppEvent {
Input(KeyEvent),
Resize(u16, u16),
}
+24
View File
@@ -0,0 +1,24 @@
use crate::app::threads::AppEvent;
use ratatui::crossterm::event::{Event, read};
use std::sync::mpsc::Sender;
pub fn handle_input_events(tx: Sender<AppEvent>) {
loop {
match read() {
Ok(ev) => match ev {
Event::Key(key) => {
if tx.send(AppEvent::Input(key)).is_err() {
break;
}
}
Event::Resize(c, r) => {
if tx.send(AppEvent::Resize(c, r)).is_err() {
break;
}
}
_ => {}
},
Err(_) => continue,
}
}
}
+5
View File
@@ -0,0 +1,5 @@
pub mod events;
pub mod handle_input_events;
pub use events::AppEvent;
pub use handle_input_events::handle_input_events;