From a2ec1f8345b6025af7ba6e6a70e782e30cda0da9 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Fri, 26 Jan 2024 01:10:52 +0100 Subject: [PATCH 1/3] Add support for `input.text` in commands run with hotkeys --- src/widgets/splits/Split.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index eb0367209dc..780d0998d23 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -6,6 +6,7 @@ #include "common/network/NetworkResult.hpp" #include "common/QLogging.hpp" #include "controllers/accounts/AccountController.hpp" +#include "controllers/commands/Command.hpp" #include "controllers/commands/CommandController.hpp" #include "controllers/hotkeys/HotkeyController.hpp" #include "controllers/notifications/NotificationController.hpp" @@ -684,15 +685,25 @@ void Split::addShortcuts() }}, {"runCommand", [this](std::vector arguments) -> QString { - if (arguments.size() == 0) + if (arguments.empty()) { qCWarning(chatterinoHotkeys) << "runCommand hotkey called without arguments!"; return "runCommand hotkey called without arguments!"; } - QString command = getIApp()->getCommands()->execCommand( - arguments.at(0).replace('\n', ' '), this->getChannel(), false); - this->getChannel()->sendMessage(command); + QString requestedText = arguments.at(0).replace('\n', ' '); + + QString inputText = this->getInput().getInputText(); + QString message = getIApp()->getCommands()->execCustomCommand( + requestedText.split(' '), Command{"(hotkey)", requestedText}, + true, this->getChannel(), nullptr, + { + {"input.text", inputText}, + }); + + message = getIApp()->getCommands()->execCommand( + message, this->getChannel(), false); + this->getChannel()->sendMessage(message); return ""; }}, {"setChannelNotification", From 4c5c71e0c6abbc05cf278dbf98938c2e5eb0d27f Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Fri, 26 Jan 2024 01:16:46 +0100 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd5457a6ed0..639c49ec11e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ - Minor: Normalized the input padding between light & dark themes. (#5095) - Minor: Add `--activate ` (or `-a`) command line option to activate or add a Twitch channel. (#5111) - Minor: Chatters from recent-messages are now added to autocompletion. (#5116) +- Minor: Add support for input.text in commands run with hotkeys. (#5130) - Bugfix: Fixed an issue where certain emojis did not send to Twitch chat correctly. (#4840) - Bugfix: Fixed capitalized channel names in log inclusion list not being logged. (#4848) - Bugfix: Trimmed custom streamlink paths on all platforms making sure you don't accidentally add spaces at the beginning or end of its path. (#4834) From 89a7052a94831569f86b65550c653fe80ccadc85 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Fri, 26 Jan 2024 22:50:51 +0100 Subject: [PATCH 3/3] Update the changelog entry phrasing --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 840f0c50291..b91e9e3d7ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ - Minor: Normalized the input padding between light & dark themes. (#5095) - Minor: Add `--activate ` (or `-a`) command line option to activate or add a Twitch channel. (#5111) - Minor: Chatters from recent-messages are now added to autocompletion. (#5116) -- Minor: Add support for input.text in commands run with hotkeys. (#5130) +- Minor: Added support for the `{input.text}` placeholder in the **Split** -> **Run a command** hotkey. (#5130) - Bugfix: Fixed an issue where certain emojis did not send to Twitch chat correctly. (#4840) - Bugfix: Fixed capitalized channel names in log inclusion list not being logged. (#4848) - Bugfix: Trimmed custom streamlink paths on all platforms making sure you don't accidentally add spaces at the beginning or end of its path. (#4834)