From 92aee5f3b81faba8fff5ac3007392e2215cf03ca Mon Sep 17 00:00:00 2001 From: Jeff Lord Date: Sun, 3 Dec 2023 07:40:40 -0500 Subject: [PATCH] Fixed enable/disable toogle from XAML --- src/runner/centralized_kb_hook.h | 1 + src/runner/general_settings.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/runner/centralized_kb_hook.h b/src/runner/centralized_kb_hook.h index 69a415cdfd05..6f250bf2582e 100644 --- a/src/runner/centralized_kb_hook.h +++ b/src/runner/centralized_kb_hook.h @@ -34,6 +34,7 @@ namespace CentralizedKeyboardHook void ClearModuleHotkeys(const std::wstring& moduleName) noexcept; void RegisterWindow(HWND hwnd) noexcept; void RefreshConfig(); + void SetRunProgramEnabled(bool enabled); DWORD GetProcessIdByName(const std::wstring& processName); std::wstring GetFileNameFromPath(const std::wstring& fullPath); HWND find_main_window(unsigned long process_id); diff --git a/src/runner/general_settings.cpp b/src/runner/general_settings.cpp index dccd19d167a0..0b6bf6ef8bca 100644 --- a/src/runner/general_settings.cpp +++ b/src/runner/general_settings.cpp @@ -1,5 +1,6 @@ #include "pch.h" #include "general_settings.h" +#include "centralized_kb_hook.h" #include "auto_start_helper.h" #include "Generated files/resource.h" @@ -159,6 +160,11 @@ void apply_general_settings(const json::JsonObject& general_configs, bool save) target_enabled = gpo_rule == powertoys_gpo::gpo_rule_configured_enabled; } + if (name == L"Keyboard Manager") + { + CentralizedKeyboardHook::SetRunProgramEnabled(target_enabled); + } + if (module_inst_enabled == target_enabled) { continue;