mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-21 08:29:01 +08:00
[Runner]remove hotkeyEx when disabling a module (#15944)
This commit is contained in:
parent
79c13aec6e
commit
567cc50fb7
@ -149,7 +149,8 @@ void apply_general_settings(const json::JsonObject& general_configs, bool save)
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const bool module_inst_enabled = modules().at(name)->is_enabled();
|
PowertoyModule& powertoy = modules().at(name);
|
||||||
|
const bool module_inst_enabled = powertoy->is_enabled();
|
||||||
const bool target_enabled = value.GetBoolean();
|
const bool target_enabled = value.GetBoolean();
|
||||||
if (module_inst_enabled == target_enabled)
|
if (module_inst_enabled == target_enabled)
|
||||||
{
|
{
|
||||||
@ -157,12 +158,14 @@ void apply_general_settings(const json::JsonObject& general_configs, bool save)
|
|||||||
}
|
}
|
||||||
if (target_enabled)
|
if (target_enabled)
|
||||||
{
|
{
|
||||||
modules().at(name)->enable();
|
powertoy->enable();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
modules().at(name)->disable();
|
powertoy->disable();
|
||||||
}
|
}
|
||||||
|
// Sync the hotkey state with the module state, so it can be removed for disabled modules.
|
||||||
|
powertoy.UpdateHotkeyEx();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,6 +224,7 @@ void start_enabled_powertoys()
|
|||||||
if (!powertoys_to_disable.contains(name))
|
if (!powertoys_to_disable.contains(name))
|
||||||
{
|
{
|
||||||
powertoy->enable();
|
powertoy->enable();
|
||||||
|
powertoy.UpdateHotkeyEx();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,11 +74,12 @@ void PowertoyModule::UpdateHotkeyEx()
|
|||||||
{
|
{
|
||||||
CentralizedHotkeys::UnregisterHotkeysForModule(pt_module->get_key());
|
CentralizedHotkeys::UnregisterHotkeysForModule(pt_module->get_key());
|
||||||
auto container = pt_module->GetHotkeyEx();
|
auto container = pt_module->GetHotkeyEx();
|
||||||
if (container.has_value())
|
if (container.has_value() && pt_module->is_enabled())
|
||||||
{
|
{
|
||||||
auto hotkey = container.value();
|
auto hotkey = container.value();
|
||||||
auto modulePtr = pt_module.get();
|
auto modulePtr = pt_module.get();
|
||||||
auto action = [modulePtr](WORD modifiersMask, WORD vkCode) {
|
auto action = [modulePtr](WORD modifiersMask, WORD vkCode) {
|
||||||
|
Logger::trace(L"{} hotkey Ex is invoked from Centralized keyboard hook", modulePtr->get_key());
|
||||||
modulePtr->OnHotkeyEx();
|
modulePtr->OnHotkeyEx();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user