add keybinding for previous track

This commit is contained in:
Henrik Friedrichsen
2019-03-11 22:36:31 +01:00
parent 778bf5f418
commit c7ebe39453
2 changed files with 15 additions and 1 deletions

View File

@@ -43,6 +43,7 @@ have them configurable.
* Tracks and playlists can be played using `Return` and queued using `Space`
* `Shift-p` toggles playback of a track
* `Shift-s` stops a track
* `<` and `>` play the previous or next track, respectively
* `q` quits ncspot
You can also open a Vim style commandprompt using `:`, the following commands
@@ -51,7 +52,7 @@ are supported:
* `quit`: Quit ncspot
* `toggle`: Toggle playback
* `stop`: Stop playback
* `next`: Play next track
* `previous`/`next`: Play previous/next track
* `clear`: Clear playlist
The screens can be opened with `queue`, `search`, `playlists` and `log`, whereas

View File

@@ -224,6 +224,18 @@ fn main() {
);
}
{
let queue = queue.clone();
cmd_manager.register(
"previous",
Vec::new(),
Box::new(move |_s, _args| {
queue.lock().expect("could not lock queue").previous();
Ok(None)
}),
);
}
{
let queue = queue.clone();
cmd_manager.register(
@@ -315,6 +327,7 @@ fn main() {
register_keybinding(&mut cursive, &event_manager, 'q', "quit");
register_keybinding(&mut cursive, &event_manager, 'P', "toggle");
register_keybinding(&mut cursive, &event_manager, 'S', "stop");
register_keybinding(&mut cursive, &event_manager, '<', "previous");
register_keybinding(&mut cursive, &event_manager, '>', "next");
register_keybinding(&mut cursive, &event_manager, 'c', "clear");