- Updated default hotkeys and related documentation

- Updated default "ESC" behavior to focus command bar
- Added version information to the console window
This commit is contained in:
Casey Langen 2016-08-22 21:28:56 -07:00
parent 931323e8aa
commit 8b7062be0b
6 changed files with 56 additions and 43 deletions

View File

@ -53,37 +53,38 @@ you'll need [homebrew](http://brew.sh/) to install the required dependencies.
## keyboard shortcuts
the current hotkeys are generally based around holding the alt/meta key with your left thumb, and using the home row with your right hand.
the hotkeys listed below can generally be used at any time; however, if an input field is focused some may not work. you can enter command mode by pressing `ESC`, which will highlight the bottom command bar and accept all hotkeys. command mode may be deactivated by pressing `ESC` again.
you may also change hotkeys by editing `~/.mC2/hotkeys.json` and restarting the app. a hotkey tester is provided in the settings screen.
- `TAB` select next window
- `SHIFT+TAB` select previous window
- `ALT+~` switch to console view
- `ALT+a` switch to library view
- `ALT+s` switch to settings view
- `ALT+i` volume up 5%
- `ALT+k` volume down 5%
- `ALT+j` previous track
- `ALT+l` next track
- `ALT+u` back 10 seconds
- `ALT+o` forward 10 seconds
- `ALT+r` repaint the screen
- `ALT+,` toggle repeat mode (off/track/list)
- `ALT+.` (un)shuffle play queue
- `~` switch to console view
- `a` switch to library view
- `s` switch to settings view
- `i` volume up 5%
- `k` volume down 5%
- `j` previous track
- `l` next track
- `u` back 10 seconds
- `o` forward 10 seconds
- `r` repaint the screen
- `,` toggle repeat mode (off/track/list)
- `.` (un)shuffle play queue
- `CTRL+p` pause/resume (globally)
- `CTRL+x` stop (unload streams, free resources)
- `CTRL+d` quit
and a couple hotkeys that are specific to the library view:
- `ESC` toggle between browse and play queue
- `ALT+b` show browse view
- `ALT+n` show play queue
- `ALT+f` show album/artist/genre search
- `ALT+t` show track search
- `ALT+1` browse by artist
- `ALT+2` browse by album
- `ALT+3` browse by genre
- `ALT+m` jump to playing artist/album/genre in browse view
- `b` show browse view
- `n` show play queue
- `f` show album/artist/genre search
- `t` show track search
- `1` browse by artist
- `2` browse by album
- `3` browse by genre
- `m` jump to playing artist/album/genre in browse view
- `SPACE` pause/resume
*important*: on OSX make sure you configure your terminal emulator to treat your left alt key as "+Esc" or "Meta".

View File

@ -43,8 +43,10 @@
#include <core/plugin/PluginFactory.h>
#include <app/util/Hotkeys.h>
#include <app/util/Version.h>
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
template <class T>
bool tostr(T& t, const std::string& s) {
@ -151,6 +153,7 @@ void ConsoleLayout::SetVolume(float volume) {
void ConsoleLayout::Help() {
int64 s = -1;
this->output->WriteLine("help:\n", s);
this->output->WriteLine(" <tab> to switch between windows", s);
this->output->WriteLine("", s);
@ -168,6 +171,8 @@ void ConsoleLayout::Help() {
this->output->WriteLine("", s);
this->output->WriteLine(" plugins: list loaded plugins", s);
this->output->WriteLine("", s);
this->output->WriteLine(" version: show musikbox app version", s);
this->output->WriteLine("", s);
this->output->WriteLine(" <ctrl+d>: quit\n", s);
}
@ -200,6 +205,10 @@ bool ConsoleLayout::ProcessCommand(const std::string& cmd) {
else if (name == "clear") {
this->logs->ClearContents();
}
else if (name == "version") {
const std::string v = boost::str(boost::format("build v%s") % VERSION);
this->output->WriteLine(v, -1);
}
else if (name == "play" || name == "pl" || name == "p") {
return this->PlayFile(args);
}

View File

@ -152,7 +152,7 @@ cursespp::IWindowPtr MainLayout::BlurShortcuts() {
}
bool MainLayout::KeyPress(const std::string& key) {
if (prefs->GetBool(box::prefs::keys::EscFocusesShortcuts)) {
if (prefs->GetBool(box::prefs::keys::EscFocusesShortcuts, true)) {
if (key == "^[" ||
(key == "KEY_ENTER" && this->shortcutsFocused) ||
(key == "KEY_UP" && this->shortcutsFocused))

View File

@ -248,7 +248,7 @@ void SettingsLayout::OnVisibilityChanged(bool visible) {
void SettingsLayout::LoadPreferences() {
this->removeCheckbox->SetChecked(this->prefs->GetBool(core::prefs::keys::RemoveMissingFiles, true));
this->focusShortcutsCheckbox->SetChecked(this->prefs->GetBool(box::prefs::keys::EscFocusesShortcuts));
this->focusShortcutsCheckbox->SetChecked(this->prefs->GetBool(box::prefs::keys::EscFocusesShortcuts, true));
this->customColorsCheckbox->SetChecked(this->prefs->GetBool(box::prefs::keys::DisableCustomColors));
}

View File

@ -84,27 +84,27 @@ static std::unordered_map<std::string, Id> NAME_TO_ID = {
/* default hotkeys */
static std::unordered_map<Id, std::string, EnumHasher> ID_TO_DEFAULT = {
{ Id::NavigateLibrary, "M-a" },
{ Id::NavigateLibraryBrowse, "M-b" },
{ Id::NavigateLibraryBrowseArtists, "M-1" },
{ Id::NavigateLibraryBrowseAlbums, "M-2" },
{ Id::NavigateLibraryBrowseGenres, "M-3" },
{ Id::NavigateLibraryFilter, "M-f" },
{ Id::NavigateLibraryTracks, "M-t" },
{ Id::NavigateLibraryPlayQueue, "M-n" },
{ Id::NavigateSettings, "M-s" },
{ Id::NavigateConsole, "M-`" },
{ Id::NavigateJumpToPlaying, "M-m" },
{ Id::NavigateLibrary, "a" },
{ Id::NavigateLibraryBrowse, "b" },
{ Id::NavigateLibraryBrowseArtists, "1" },
{ Id::NavigateLibraryBrowseAlbums, "2" },
{ Id::NavigateLibraryBrowseGenres, "3" },
{ Id::NavigateLibraryFilter, "f" },
{ Id::NavigateLibraryTracks, "t" },
{ Id::NavigateLibraryPlayQueue, "n" },
{ Id::NavigateSettings, "s" },
{ Id::NavigateConsole, "`" },
{ Id::NavigateJumpToPlaying, "m" },
{ Id::TogglePause, "^P" },
{ Id::Next, "M-l" },
{ Id::Previous, "M-j" },
{ Id::VolumeUp, "M-i" },
{ Id::VolumeDown, "M-k" },
{ Id::SeekForward, "M-o" },
{ Id::SeekBack, "M-u" },
{ Id::ToggleRepeat, "M-," },
{ Id::ToggleShuffle, "M-." },
{ Id::Next, "l" },
{ Id::Previous, "j" },
{ Id::VolumeUp, "i" },
{ Id::VolumeDown, "k" },
{ Id::SeekForward, "o" },
{ Id::SeekBack, "u" },
{ Id::ToggleRepeat, "," },
{ Id::ToggleShuffle, "." },
{ Id::Stop, "^X" },
{ Id::ViewRefresh, "KEY_F(5)" },

View File

@ -0,0 +1,3 @@
#pragma once
#define VERSION "0.1.0" /* todo: autogen */