add command/binding to jump to currently playing track

fixes #181
This commit is contained in:
Henrik Friedrichsen
2020-04-18 21:57:41 +02:00
parent 510f1ff6ad
commit 4e7af1c920
5 changed files with 20 additions and 2 deletions

View File

@@ -26,6 +26,7 @@ pub enum MoveMode {
Down,
Left,
Right,
Playing,
}
#[derive(Display, Clone, Serialize, Deserialize, Debug)]
@@ -144,8 +145,10 @@ impl fmt::Display for Command {
MoveMode::Down => "bottom",
MoveMode::Left => "leftmost",
MoveMode::Right => "rightmost",
_ => "",
}
),
Command::Move(MoveMode::Playing, _) => "move playing".to_string(),
Command::Move(mode, MoveAmount::Integer(amount)) => format!("move {} {}", mode, amount),
Command::Shift(mode, amount) => format!("shift {} {}", mode, amount.unwrap_or(1)),
Command::Search(term) => format!("search {}", term),
@@ -235,6 +238,7 @@ pub fn parse(input: &str) -> Option<Command> {
"bottom" => Some(Command::Move(MoveMode::Down, MoveAmount::Extreme)),
"leftmost" => Some(Command::Move(MoveMode::Left, MoveAmount::Extreme)),
"rightmost" => Some(Command::Move(MoveMode::Right, MoveAmount::Extreme)),
"playing" => Some(Command::Move(MoveMode::Playing, MoveAmount::default())),
_ => None,
})
};