Register the hotkey after PT Run is initialized (#11858)

This commit is contained in:
Mykhailo Pylyp 2021-06-24 17:50:34 +03:00 committed by GitHub
parent 0f32e99d88
commit d7e09e83c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -138,6 +138,7 @@ namespace PowerLauncher
bootTime.Stop();
Log.Info(textToLog.ToString(), GetType());
_mainVM.RegisterHotkey();
PowerToysTelemetry.Log.WriteEvent(new LauncherBootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds });
// [Conditional("RELEASE")]

View file

@ -74,8 +74,12 @@ namespace PowerLauncher.ViewModel
InitializeKeyCommands();
RegisterResultsUpdatedEvent();
}
if (settings != null && settings.UsePowerToysRunnerKeyboardHook)
public void RegisterHotkey()
{
Log.Info("RegisterHotkey()", GetType());
if (_settings != null && _settings.UsePowerToysRunnerKeyboardHook)
{
NativeEventWaiter.WaitForEventLoop(Constants.PowerLauncherSharedEvent(), OnHotkey);
_hotkeyHandle = 0;