Bind Play to Backspace by default

This commit is contained in:
Andrzej Rybczak
2020-12-23 00:17:50 +01:00
parent e0fe49e3e3
commit 7e4f3b1917
6 changed files with 12 additions and 2 deletions

View File

@@ -10,6 +10,7 @@
* Reduce CPU usage of the frequency spectrum visualizer. * Reduce CPU usage of the frequency spectrum visualizer.
* Enable Link Time Optimization by default. * Enable Link Time Optimization by default.
* Enable full sorting of items in the local browser if it's not. * 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) # ncmpcpp-0.9 (2020-12-20)
* Fix various Mopidy specific bugs. * Fix various Mopidy specific bugs.

View File

@@ -152,7 +152,6 @@
## ##
## - set_volume ## - set_volume
## - load ## - load
## - play
## ##
# #
#def_key "mouse" #def_key "mouse"
@@ -328,6 +327,9 @@
#def_key "backspace" #def_key "backspace"
# replay_song # replay_song
# #
#def_key "backspace"
# play
#
#def_key "f" #def_key "f"
# seek_forward # seek_forward
# #

View File

@@ -797,6 +797,11 @@ void DeleteStoredPlaylist::run()
myPlaylistEditor->requestPlaylistsUpdate(); myPlaylistEditor->requestPlaylistsUpdate();
} }
bool ReplaySong::canBeRun()
{
return Status::State::currentSongPosition() >= 0;
}
void ReplaySong::run() void ReplaySong::run()
{ {
Mpd.Play(Status::State::currentSongPosition()); Mpd.Play(Status::State::currentSongPosition());

View File

@@ -495,6 +495,7 @@ struct ReplaySong: BaseAction
ReplaySong(): BaseAction(Type::ReplaySong, "replay_song") { } ReplaySong(): BaseAction(Type::ReplaySong, "replay_song") { }
private: private:
virtual bool canBeRun() override;
virtual void run() override; virtual void run() override;
}; };

View File

@@ -610,6 +610,7 @@ void BindingsConfiguration::generateDefaults()
{ {
bind(k, Actions::Type::JumpToParentDirectory); bind(k, Actions::Type::JumpToParentDirectory);
bind(k, Actions::Type::ReplaySong); bind(k, Actions::Type::ReplaySong);
bind(k, Actions::Type::Play);
} }
if (notBound(k = stringToKey("f"))) if (notBound(k = stringToKey("f")))
bind(k, Actions::Type::SeekForward); bind(k, Actions::Type::SeekForward);

View File

@@ -178,7 +178,7 @@ void write_bindings(NC::Scrollpad &w)
key(w, Type::Pause, "Pause"); key(w, Type::Pause, "Pause");
key(w, Type::Next, "Next track"); key(w, Type::Next, "Next track");
key(w, Type::Previous, "Previous 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::SeekForward, "Seek forward in playing song");
key(w, Type::SeekBackward, "Seek backward in playing song"); key(w, Type::SeekBackward, "Seek backward in playing song");
key(w, Type::VolumeDown, key(w, Type::VolumeDown,