fix(tui): play triangle indicator, kill on Esc, popup fg colors

This commit is contained in:
objz committed 2025-11-01 15:08:44 +01:00
1 parent 46087c47a8
commit 3e7a05b6e5
6 files changed
+57 -19

No files matched your search

+25
View File
@@ -16,6 +16,9 @@ pub static RUNNING: Lazy<Arc<Mutex<HashMap<String, RunState>>>> =
pub static PENDING_LAST_PLAYED: Lazy<Arc<Mutex<Vec<(String, DateTime<Utc>)>>>> =
Lazy::new(|| Arc::new(Mutex::new(Vec::new())));
pub static KILL_SENDERS: Lazy<Arc<Mutex<HashMap<String, tokio::sync::oneshot::Sender<()>>>>> =
Lazy::new(|| Arc::new(Mutex::new(HashMap::new())));
pub fn set_state(name: &str, state: RunState) {
if let Ok(mut map) = RUNNING.lock() {
map.insert(name.to_string(), state);
@@ -53,3 +56,25 @@ pub fn drain_last_played() -> Vec<(String, DateTime<Utc>)> {
.map(|mut q| q.drain(..).collect())
.unwrap_or_default()
}
pub fn register_kill(name: &str, tx: tokio::sync::oneshot::Sender<()>) {
if let Ok(mut map) = KILL_SENDERS.lock() {
map.insert(name.to_string(), tx);
}
}
pub fn send_kill(name: &str) -> bool {
if let Ok(mut map) = KILL_SENDERS.lock() {
if let Some(tx) = map.remove(name) {
let _ = tx.send(());
return true;
}
}
false
}
pub fn cleanup_kill_sender(name: &str) {
if let Ok(mut map) = KILL_SENDERS.lock() {
map.remove(name);
}
}