diff options
author | Michał Cichoń <michcic@gmail.com> | 2019-05-03 17:02:47 +0200 |
---|---|---|
committer | Michał Cichoń <michcic@gmail.com> | 2019-05-03 17:02:47 +0200 |
commit | eaa10a3950ccd8fa2a5acada4c82d6627b6214f7 (patch) | |
tree | 3012531b45cfbaba4b4c0c66e157ad20795e54ee /src/settings.c | |
parent | cb6789b17f81d29c6884c27715c705083e09a5db (diff) | |
parent | c4b80765185944a5b89f3cc76568ba498bf5f3f4 (diff) | |
download | pianobar-windows-eaa10a3950ccd8fa2a5acada4c82d6627b6214f7.tar.gz pianobar-windows-eaa10a3950ccd8fa2a5acada4c82d6627b6214f7.tar.bz2 pianobar-windows-eaa10a3950ccd8fa2a5acada4c82d6627b6214f7.zip |
Merge branch 'release/2019.05.03'2019.05.03
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; |