mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
init launcher start shortcut with default if it does not exsist in th… (#9231)
This commit is contained in:
@@ -362,18 +362,36 @@ void Microsoft_Launcher::init_settings()
|
|||||||
|
|
||||||
void Microsoft_Launcher::parse_hotkey(PowerToysSettings::PowerToyValues& settings)
|
void Microsoft_Launcher::parse_hotkey(PowerToysSettings::PowerToyValues& settings)
|
||||||
{
|
{
|
||||||
try
|
auto settingsObject = settings.get_raw_json();
|
||||||
|
if (settingsObject.GetView().Size())
|
||||||
{
|
{
|
||||||
auto jsonHotkeyObject = settings.get_raw_json().GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_OPEN_POWERLAUNCHER);
|
try
|
||||||
m_hotkey.win = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_WIN);
|
{
|
||||||
m_hotkey.alt = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_ALT);
|
auto jsonHotkeyObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_OPEN_POWERLAUNCHER);
|
||||||
m_hotkey.shift = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_SHIFT);
|
m_hotkey.win = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_WIN);
|
||||||
m_hotkey.ctrl = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_CTRL);
|
m_hotkey.alt = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_ALT);
|
||||||
m_hotkey.key = static_cast<unsigned char>(jsonHotkeyObject.GetNamedNumber(JSON_KEY_CODE));
|
m_hotkey.shift = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_SHIFT);
|
||||||
|
m_hotkey.ctrl = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_CTRL);
|
||||||
|
m_hotkey.key = static_cast<unsigned char>(jsonHotkeyObject.GetNamedNumber(JSON_KEY_CODE));
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
Logger::error("Failed to initialize PT Run start shortcut");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (...)
|
else
|
||||||
{
|
{
|
||||||
m_hotkey.key = 0;
|
Logger::info("PT Run settings are empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_hotkey.key)
|
||||||
|
{
|
||||||
|
Logger::info("PT Run is going to use default shortcut");
|
||||||
|
m_hotkey.win = false;
|
||||||
|
m_hotkey.alt = true;
|
||||||
|
m_hotkey.shift = false;
|
||||||
|
m_hotkey.ctrl = false;
|
||||||
|
m_hotkey.key = VK_SPACE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user