From 4b34fa72332b41d677d5ef497d70a882206b11ff Mon Sep 17 00:00:00 2001 From: chmanie Date: Tue, 13 Jun 2023 00:17:56 +0200 Subject: [PATCH] Add key command to select currently playing track --- cbd-tui/src/app/queue.rs | 3 +++ cbd-tui/src/main.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/cbd-tui/src/app/queue.rs b/cbd-tui/src/app/queue.rs index 0f48eba..4702dc0 100644 --- a/cbd-tui/src/app/queue.rs +++ b/cbd-tui/src/app/queue.rs @@ -41,6 +41,9 @@ impl Queue { self.tx.send(MessageFromUi::SetCurrentTrack(pos)); } } + pub fn select_current(&mut self) { + self.select(Some(self.current_position)); + } pub fn remove_track(&mut self) { if let Some(pos) = self.selected() { // FIXME: mark multiple tracks on queue and remove them diff --git a/cbd-tui/src/main.rs b/cbd-tui/src/main.rs index ed9c6cb..b536d30 100644 --- a/cbd-tui/src/main.rs +++ b/cbd-tui/src/main.rs @@ -303,6 +303,9 @@ fn run_ui(tx: Sender, rx: Receiver) { (UiFocus::Queue, KeyModifiers::CONTROL, KeyCode::Char('u')) => { app.queue.up(); } + (UiFocus::Queue, KeyModifiers::NONE, KeyCode::Char('o')) => { + app.queue.select_current(); + } (UiFocus::Queue, KeyModifiers::NONE, KeyCode::Enter) => { app.queue.play_selected(); }