init launcher start shortcut with default if it does not exsist in th… (#9231)

This commit is contained in:
Mykhailo Pylyp
2021-01-22 18:13:57 +02:00
committed by GitHub
parent 2b42fb8a38
commit 016656f5e7

View File

@@ -361,10 +361,13 @@ void Microsoft_Launcher::init_settings()
}
void Microsoft_Launcher::parse_hotkey(PowerToysSettings::PowerToyValues& settings)
{
auto settingsObject = settings.get_raw_json();
if (settingsObject.GetView().Size())
{
try
{
auto jsonHotkeyObject = settings.get_raw_json().GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_OPEN_POWERLAUNCHER);
auto jsonHotkeyObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_OPEN_POWERLAUNCHER);
m_hotkey.win = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_WIN);
m_hotkey.alt = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_ALT);
m_hotkey.shift = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_SHIFT);
@@ -373,7 +376,22 @@ void Microsoft_Launcher::parse_hotkey(PowerToysSettings::PowerToyValues& setting
}
catch(...)
{
m_hotkey.key = 0;
Logger::error("Failed to initialize PT Run start shortcut");
}
}
else
{
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;
}
}