mirror of
https://github.com/talwat/lowfi
synced 2025-01-12 19:31:54 +00:00
feat: add dynamic handling of play/pause state in bottom controls bar (#31)
This commit is contained in:
parent
8d9d003dc9
commit
b2c225256f
@ -131,7 +131,7 @@ async fn interface(player: Arc<Player>, minimalist: bool) -> eyre::Result<()> {
|
||||
VOLUME_TIMER.store(0, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
let controls = components::controls(WIDTH);
|
||||
let controls = components::controls(&player, WIDTH);
|
||||
|
||||
let menu = if minimalist {
|
||||
vec![action, middle]
|
||||
|
@ -103,8 +103,9 @@ pub fn action(player: &Player, width: usize) -> String {
|
||||
}
|
||||
|
||||
/// Creates the bottom controls bar, and also spaces it properly.
|
||||
pub fn controls(width: usize) -> String {
|
||||
let controls = [["[s]", "kip"], ["[p]", "ause"], ["[q]", "uit"]];
|
||||
pub fn controls(player: &Player, width: usize) -> String {
|
||||
let play_pause = if player.sink.is_paused() { ["[p]", "lay "] } else { ["[p]", "ause"] };
|
||||
let controls = [["[s]", "kip"], play_pause, ["[q]", "uit"]];
|
||||
let len: usize = controls.concat().iter().map(|x| x.len()).sum();
|
||||
let controls = controls.map(|x| format!("{}{}", x[0].bold(), x[1]));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user