mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-23 19:49:43 +01:00
Update PowerDisplay hotkey and add module launch support
Updated `JSON_KEY_ACTIVATION_SHORTCUT` to use lowercase for consistency. Added `isShown` flag to `m_activation_hotkey` to indicate visibility, setting it in relevant scenarios. Added support for launching the PowerDisplay module via an IPC message in `LaunchPage.xaml.cs`. Improved robustness by adding a `default` case to handle unexpected `ModuleType` values in the switch statement.
This commit is contained in:
@@ -40,7 +40,7 @@ namespace
|
||||
const wchar_t JSON_KEY_PROPERTIES[] = L"properties";
|
||||
const wchar_t JSON_KEY_ENABLED[] = L"enabled";
|
||||
const wchar_t JSON_KEY_HOTKEY_ENABLED[] = L"hotkey_enabled";
|
||||
const wchar_t JSON_KEY_ACTIVATION_SHORTCUT[] = L"ActivationShortcut";
|
||||
const wchar_t JSON_KEY_ACTIVATION_SHORTCUT[] = L"activation_shortcut";
|
||||
const wchar_t JSON_KEY_WIN[] = L"win";
|
||||
const wchar_t JSON_KEY_ALT[] = L"alt";
|
||||
const wchar_t JSON_KEY_CTRL[] = L"ctrl";
|
||||
@@ -107,6 +107,7 @@ private:
|
||||
m_activation_hotkey.shift = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_SHIFT);
|
||||
m_activation_hotkey.ctrl = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_CTRL);
|
||||
m_activation_hotkey.key = static_cast<unsigned char>(jsonHotkeyObject.GetNamedNumber(JSON_KEY_CODE));
|
||||
m_activation_hotkey.isShown = true;
|
||||
Logger::trace(L"Parsed activation hotkey: Win={} Ctrl={} Alt={} Shift={} Key={}",
|
||||
m_activation_hotkey.win, m_activation_hotkey.ctrl, m_activation_hotkey.alt,
|
||||
m_activation_hotkey.shift, m_activation_hotkey.key);
|
||||
@@ -114,12 +115,14 @@ private:
|
||||
else
|
||||
{
|
||||
Logger::info("ActivationShortcut not found in settings, using default Win+Alt+M");
|
||||
m_activation_hotkey.isShown = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Logger::error("Failed to parse PowerDisplay activation shortcut, using default Win+Alt+M");
|
||||
m_activation_hotkey.isShown = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,6 +141,10 @@ namespace Microsoft.PowerToys.Settings.UI.Flyout
|
||||
|
||||
break;
|
||||
|
||||
case ModuleType.PowerDisplay: // Launch PowerDisplay
|
||||
Views.ShellPage.SendDefaultIPCMessage("{\"action\":{\"PowerDisplay\":{\"action_name\":\"Launch\", \"value\":\"\"}}}");
|
||||
break;
|
||||
|
||||
default:
|
||||
moduleRun = false;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user