diff options
author | Michał Cichoń <michcic@gmail.com> | 2019-05-03 16:57:20 +0200 |
---|---|---|
committer | Michał Cichoń <michcic@gmail.com> | 2019-05-03 17:00:30 +0200 |
commit | 166056799c20ec66cdf94124e8c8cb3ef8114c84 (patch) | |
tree | f4709c48aae471993383832c82f37a75b9f5a109 /src/settings.c | |
parent | 4d06dac5843651d755a4010691a60c68390e6ce0 (diff) | |
download | pianobar-windows-166056799c20ec66cdf94124e8c8cb3ef8114c84.tar.gz pianobar-windows-166056799c20ec66cdf94124e8c8cb3ef8114c84.tar.bz2 pianobar-windows-166056799c20ec66cdf94124e8c8cb3ef8114c84.zip |
Add support for hotkeys. #20
Hotkeys can be assigned to action in configuration file ex:
hk_<action_name> = g + shift + alt + ctrl
Diffstat (limited to 'src/settings.c')
-rw-r--r-- | src/settings.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/settings.c b/src/settings.c index affb7f2..a2ce3fb 100644 --- a/src/settings.c +++ b/src/settings.c @@ -29,6 +29,7 @@ THE SOFTWARE. #include "config.h" #include "ui.h" #include "ui_dispatch.h" +#include "hotkey.h" #include <stdlib.h> #include <assert.h> #include <memory.h> @@ -340,6 +341,20 @@ void BarSettingsRead (BarSettings_t *settings) { break; } } + } else if (memcmp ("hk_act_", key, 7) == 0) { + size_t i; + char* actionKey = key + 3; + /* keyboard shortcuts */ + for (i = 0; i < BAR_KS_COUNT; i++) { + if (streq (dispatchActions[i].configKey, actionKey)) { + BarHotKey_t hk = { 0 }; + if (BarHotKeyParse(&hk, val)) { + hk.id = i; + BarHotKeyRegister(hk); + } + break; + } + } } else if (streq ("audio_quality", key)) { if (streq (val, "low")) { settings->audioQuality = PIANO_AQ_LOW; |