From f09f1aa704f06472ec134b40e2f69bf3279c3f06 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 22 Mar 2025 00:51:46 +0530 Subject: Add web.keymap.set + test keymaps config.lua --- src/InputMediator.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/InputMediator.cpp') diff --git a/src/InputMediator.cpp b/src/InputMediator.cpp index f935ad2..61ef125 100644 --- a/src/InputMediator.cpp +++ b/src/InputMediator.cpp @@ -5,14 +5,24 @@ #include "CommandParser.hpp" #include "InputMediator.hpp" #include "LuaRuntime.hpp" +#include "keymap/KeymapEvaluator.hpp" #include "widgets/WebViewStack.hpp" +// TODO: Rename this InputMediator::InputMediator(WebViewStack *webViewStack, LuaRuntime *luaRuntime, KeymapEvaluator *keymapEvaluator) : QObject(), webViewStack(webViewStack), luaRuntime(luaRuntime), keymapEvaluator(keymapEvaluator) { connect(luaRuntime, &LuaRuntime::urlOpened, webViewStack, &WebViewStack::openUrl); + connect(luaRuntime, &LuaRuntime::keymapAddRequested, this, + &InputMediator::addKeymap); +} + +void InputMediator::addKeymap(QString modeString, QString keyseq, + std::function action) { + KeyMode mode = keymapEvaluator->modeFromString(modeString); + keymapEvaluator->addKeymap(mode, keyseq, action); } void InputMediator::evaluateCommand(QString command) { -- cgit v1.3.1