- 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 ## 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 - `TAB` select next window
- `SHIFT+TAB` select previous window - `SHIFT+TAB` select previous window
- `ALT+~` switch to console view - `~` switch to console view
- `ALT+a` switch to library view - `a` switch to library view
- `ALT+s` switch to settings view - `s` switch to settings view
- `ALT+i` volume up 5% - `i` volume up 5%
- `ALT+k` volume down 5% - `k` volume down 5%
- `ALT+j` previous track - `j` previous track
- `ALT+l` next track - `l` next track
- `ALT+u` back 10 seconds - `u` back 10 seconds
- `ALT+o` forward 10 seconds - `o` forward 10 seconds
- `ALT+r` repaint the screen - `r` repaint the screen
- `ALT+,` toggle repeat mode (off/track/list) - `,` toggle repeat mode (off/track/list)
- `ALT+.` (un)shuffle play queue - `.` (un)shuffle play queue
- `CTRL+p` pause/resume (globally) - `CTRL+p` pause/resume (globally)
- `CTRL+x` stop (unload streams, free resources) - `CTRL+x` stop (unload streams, free resources)
- `CTRL+d` quit - `CTRL+d` quit
and a couple hotkeys that are specific to the library view: and a couple hotkeys that are specific to the library view:
- `ESC` toggle between browse and play queue - `b` show browse view
- `ALT+b` show browse view - `n` show play queue
- `ALT+n` show play queue - `f` show album/artist/genre search
- `ALT+f` show album/artist/genre search - `t` show track search
- `ALT+t` show track search - `1` browse by artist
- `ALT+1` browse by artist - `2` browse by album
- `ALT+2` browse by album - `3` browse by genre
- `ALT+3` browse by genre - `m` jump to playing artist/album/genre in browse view
- `ALT+m` jump to playing artist/album/genre in browse view
- `SPACE` pause/resume - `SPACE` pause/resume
*important*: on OSX make sure you configure your terminal emulator to treat your left alt key as "+Esc" or "Meta". *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 <core/plugin/PluginFactory.h>
#include <app/util/Hotkeys.h> #include <app/util/Hotkeys.h>
#include <app/util/Version.h>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
template <class T> template <class T>
bool tostr(T& t, const std::string& s) { bool tostr(T& t, const std::string& s) {
@ -151,6 +153,7 @@ void ConsoleLayout::SetVolume(float volume) {
void ConsoleLayout::Help() { void ConsoleLayout::Help() {
int64 s = -1; int64 s = -1;
this->output->WriteLine("help:\n", s); this->output->WriteLine("help:\n", s);
this->output->WriteLine(" <tab> to switch between windows", s); this->output->WriteLine(" <tab> to switch between windows", s);
this->output->WriteLine("", s); this->output->WriteLine("", s);
@ -168,6 +171,8 @@ void ConsoleLayout::Help() {
this->output->WriteLine("", s); this->output->WriteLine("", s);
this->output->WriteLine(" plugins: list loaded plugins", s); this->output->WriteLine(" plugins: list loaded plugins", s);
this->output->WriteLine("", 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); this->output->WriteLine(" <ctrl+d>: quit\n", s);
} }
@ -200,6 +205,10 @@ bool ConsoleLayout::ProcessCommand(const std::string& cmd) {
else if (name == "clear") { else if (name == "clear") {
this->logs->ClearContents(); 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") { else if (name == "play" || name == "pl" || name == "p") {
return this->PlayFile(args); return this->PlayFile(args);
} }

View File

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

View File

@ -248,7 +248,7 @@ void SettingsLayout::OnVisibilityChanged(bool visible) {
void SettingsLayout::LoadPreferences() { void SettingsLayout::LoadPreferences() {
this->removeCheckbox->SetChecked(this->prefs->GetBool(core::prefs::keys::RemoveMissingFiles, true)); 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)); 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 */ /* default hotkeys */
static std::unordered_map<Id, std::string, EnumHasher> ID_TO_DEFAULT = { static std::unordered_map<Id, std::string, EnumHasher> ID_TO_DEFAULT = {
{ Id::NavigateLibrary, "M-a" }, { Id::NavigateLibrary, "a" },
{ Id::NavigateLibraryBrowse, "M-b" }, { Id::NavigateLibraryBrowse, "b" },
{ Id::NavigateLibraryBrowseArtists, "M-1" }, { Id::NavigateLibraryBrowseArtists, "1" },
{ Id::NavigateLibraryBrowseAlbums, "M-2" }, { Id::NavigateLibraryBrowseAlbums, "2" },
{ Id::NavigateLibraryBrowseGenres, "M-3" }, { Id::NavigateLibraryBrowseGenres, "3" },
{ Id::NavigateLibraryFilter, "M-f" }, { Id::NavigateLibraryFilter, "f" },
{ Id::NavigateLibraryTracks, "M-t" }, { Id::NavigateLibraryTracks, "t" },
{ Id::NavigateLibraryPlayQueue, "M-n" }, { Id::NavigateLibraryPlayQueue, "n" },
{ Id::NavigateSettings, "M-s" }, { Id::NavigateSettings, "s" },
{ Id::NavigateConsole, "M-`" }, { Id::NavigateConsole, "`" },
{ Id::NavigateJumpToPlaying, "M-m" }, { Id::NavigateJumpToPlaying, "m" },
{ Id::TogglePause, "^P" }, { Id::TogglePause, "^P" },
{ Id::Next, "M-l" }, { Id::Next, "l" },
{ Id::Previous, "M-j" }, { Id::Previous, "j" },
{ Id::VolumeUp, "M-i" }, { Id::VolumeUp, "i" },
{ Id::VolumeDown, "M-k" }, { Id::VolumeDown, "k" },
{ Id::SeekForward, "M-o" }, { Id::SeekForward, "o" },
{ Id::SeekBack, "M-u" }, { Id::SeekBack, "u" },
{ Id::ToggleRepeat, "M-," }, { Id::ToggleRepeat, "," },
{ Id::ToggleShuffle, "M-." }, { Id::ToggleShuffle, "." },
{ Id::Stop, "^X" }, { Id::Stop, "^X" },
{ Id::ViewRefresh, "KEY_F(5)" }, { Id::ViewRefresh, "KEY_F(5)" },

View File

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