diff options
author | Andrzej Rybczak <andrzej@rybczak.net> | 2020-12-23 00:17:50 +0100 |
---|---|---|
committer | Andrzej Rybczak <andrzej@rybczak.net> | 2020-12-23 00:17:50 +0100 |
commit | 7e4f3b1917f389f8769dff1cd738d93f5d365377 (patch) | |
tree | 10f75ce7709e56603012fd4383c2b09f7638a7a5 | |
parent | e0fe49e3e331536203b883844f8208da70800cbd (diff) |
Bind Play to Backspace by default
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | doc/bindings | 4 | ||||
-rw-r--r-- | src/actions.cpp | 5 | ||||
-rw-r--r-- | src/actions.h | 1 | ||||
-rw-r--r-- | src/bindings.cpp | 1 | ||||
-rw-r--r-- | src/screens/help.cpp | 2 |
6 files changed, 12 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e0d5f0c..1f89bdc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * Reduce CPU usage of the frequency spectrum visualizer. * Enable Link Time Optimization by default. * Enable full sorting of items in the local browser if it's not. +* Bind `Play` to `Backspace` by default. # ncmpcpp-0.9 (2020-12-20) * Fix various Mopidy specific bugs. diff --git a/doc/bindings b/doc/bindings index 8e75f032..874d25e4 100644 --- a/doc/bindings +++ b/doc/bindings @@ -152,7 +152,6 @@ ## ## - set_volume ## - load -## - play ## # #def_key "mouse" @@ -328,6 +327,9 @@ #def_key "backspace" # replay_song # +#def_key "backspace" +# play +# #def_key "f" # seek_forward # diff --git a/src/actions.cpp b/src/actions.cpp index 9b012228..70fb97ff 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -797,6 +797,11 @@ void DeleteStoredPlaylist::run() myPlaylistEditor->requestPlaylistsUpdate(); } +bool ReplaySong::canBeRun() +{ + return Status::State::currentSongPosition() >= 0; +} + void ReplaySong::run() { Mpd.Play(Status::State::currentSongPosition()); diff --git a/src/actions.h b/src/actions.h index ecbf16eb..8fba1890 100644 --- a/src/actions.h +++ b/src/actions.h @@ -495,6 +495,7 @@ struct ReplaySong: BaseAction ReplaySong(): BaseAction(Type::ReplaySong, "replay_song") { } private: + virtual bool canBeRun() override; virtual void run() override; }; diff --git a/src/bindings.cpp b/src/bindings.cpp index 792dd637..d4f28690 100644 --- a/src/bindings.cpp +++ b/src/bindings.cpp @@ -610,6 +610,7 @@ void BindingsConfiguration::generateDefaults() { bind(k, Actions::Type::JumpToParentDirectory); bind(k, Actions::Type::ReplaySong); + bind(k, Actions::Type::Play); } if (notBound(k = stringToKey("f"))) bind(k, Actions::Type::SeekForward); diff --git a/src/screens/help.cpp b/src/screens/help.cpp index ebaa4d68..574ac5fb 100644 --- a/src/screens/help.cpp +++ b/src/screens/help.cpp @@ -178,7 +178,7 @@ void write_bindings(NC::Scrollpad &w) key(w, Type::Pause, "Pause"); key(w, Type::Next, "Next track"); key(w, Type::Previous, "Previous track"); - key(w, Type::ReplaySong, "Replay the current song"); + key(w, Type::ReplaySong, "Replay current song"); key(w, Type::SeekForward, "Seek forward in playing song"); key(w, Type::SeekBackward, "Seek backward in playing song"); key(w, Type::VolumeDown, |