From 166056799c20ec66cdf94124e8c8cb3ef8114c84 Mon Sep 17 00:00:00 2001 From: Michał Cichoń Date: Fri, 3 May 2019 16:57:20 +0200 Subject: Add support for hotkeys. #20 Hotkeys can be assigned to action in configuration file ex: hk_ = g + shift + alt + ctrl --- src/settings.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/settings.c') 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 #include #include @@ -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; -- cgit v1.2.3