diff options
-rw-r--r-- | contrib/pianobar.1 | 9 | ||||
-rw-r--r-- | src/main.c | 15 | ||||
-rw-r--r-- | src/settings.c | 8 | ||||
-rw-r--r-- | src/settings.h | 2 | ||||
-rw-r--r-- | src/ui_act.c | 2 |
5 files changed, 26 insertions, 10 deletions
diff --git a/contrib/pianobar.1 b/contrib/pianobar.1 index d7f9624..3c192fd 100644 --- a/contrib/pianobar.1 +++ b/contrib/pianobar.1 @@ -32,9 +32,14 @@ http://xiph.org/ao/doc/config.html The configuration file consists of simple .B key = value lines. Each terminated with a newline (\\n) character. Keys and values are both -case sensitive. act_*-keys control +case sensitive. + +act_* keys control .B pianobar's -key-bindings. +key-bindings. Every one-byte character except for \\x00 and the +special value +.B disabled +are allowed here. .TP .B act_help = ? @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2010 +Copyright (c) 2008-2011 Lars-Dominik Braun <lars@6xq.net> Permission is hereby granted, free of charge, to any person obtaining a copy @@ -174,7 +174,8 @@ static void BarMainHandleUserInput (BarApp_t *app) { size_t i; for (i = 0; i < BAR_KS_COUNT; i++) { - if (app->settings.keys[i] == buf) { + if (app->settings.keys[i] != BAR_KS_DISABLED && + app->settings.keys[i] == buf) { static const BarKeyShortcutFunc_t idToF[] = {BarUiActHelp, BarUiActLoveSong, BarUiActBanSong, BarUiActAddMusic, BarUiActCreateStation, @@ -425,9 +426,13 @@ int main (int argc, char **argv) { BarSettingsInit (&app.settings); BarSettingsRead (&app.settings); - BarUiMsg (MSG_NONE, "Welcome to " PACKAGE " (" VERSION ")! " - "Press %c for a list of commands.\n", - app.settings.keys[BAR_KS_HELP]); + BarUiMsg (MSG_NONE, "Welcome to " PACKAGE " (" VERSION ")! "); + if (app.settings.keys[BAR_KS_HELP] == BAR_KS_DISABLED) { + BarUiMsg (MSG_NONE, "\n"); + } else { + BarUiMsg (MSG_NONE, "Press %c for a list of commands.\n", + app.settings.keys[BAR_KS_HELP]); + } /* init fds */ FD_ZERO(&app.readSet); diff --git a/src/settings.c b/src/settings.c index 9955d2e..a7a26a6 100644 --- a/src/settings.c +++ b/src/settings.c @@ -1,5 +1,5 @@ /* -Copyright (c) 2008-2010 +Copyright (c) 2008-2011 Lars-Dominik Braun <lars@6xq.net> Permission is hereby granted, free of charge, to any person obtaining a copy @@ -150,7 +150,11 @@ void BarSettingsRead (BarSettings_t *settings) { /* keyboard shortcuts */ for (i = 0; i < BAR_KS_COUNT; i++) { if (streq (shortcutFileKeys[i], key)) { - settings->keys[i] = val[0]; + if (streq (val, "disabled")) { + settings->keys[i] = BAR_KS_DISABLED; + } else { + settings->keys[i] = val[0]; + } break; } } diff --git a/src/settings.h b/src/settings.h index a186282..f529a81 100644 --- a/src/settings.h +++ b/src/settings.h @@ -58,6 +58,8 @@ typedef enum { BAR_KS_COUNT = 24, } BarKeyShortcutId_t; +#define BAR_KS_DISABLED '\x00' + typedef enum { BAR_SORT_NAME_AZ = 0, BAR_SORT_NAME_ZA = 1, diff --git a/src/ui_act.c b/src/ui_act.c index 76f4fee..dac104a 100644 --- a/src/ui_act.c +++ b/src/ui_act.c @@ -111,7 +111,7 @@ BarUiActCallback(BarUiActHelp) { BarUiMsg (MSG_NONE, "\r"); for (i = 0; i < BAR_KS_COUNT; i++) { - if (idToDesc[i] != NULL) { + if (idToDesc[i] != NULL && app->settings.keys[i] != BAR_KS_DISABLED) { BarUiMsg (MSG_LIST, "%c %s\n", app->settings.keys[i], idToDesc[i]); } } |