diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index 67e536b1b87..48007e99578 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -111,7 +111,7 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () => Current.MainWindow = window; Current.MainWindow.Title = Constant.FlowLauncher; - HotKeyMapper.Initialize(mainVM); + HotKeyMapper.Initialize(); // main windows needs initialized before theme change because of blur settings // TODO: Clean ThemeManager.Instance in future diff --git a/Flow.Launcher/Helper/HotKeyMapper.cs b/Flow.Launcher/Helper/HotKeyMapper.cs index 79b524f502c..7b2fdfcf499 100644 --- a/Flow.Launcher/Helper/HotKeyMapper.cs +++ b/Flow.Launcher/Helper/HotKeyMapper.cs @@ -5,10 +5,9 @@ using NHotkey.Wpf; using Flow.Launcher.Core.Resource; using Flow.Launcher.ViewModel; -using Flow.Launcher.Core; using ChefKeys; -using System.Globalization; using Flow.Launcher.Infrastructure.Logger; +using CommunityToolkit.Mvvm.DependencyInjection; namespace Flow.Launcher.Helper; @@ -17,10 +16,10 @@ internal static class HotKeyMapper private static Settings _settings; private static MainViewModel _mainViewModel; - internal static void Initialize(MainViewModel mainVM) + internal static void Initialize() { - _mainViewModel = mainVM; - _settings = _mainViewModel.Settings; + _mainViewModel = Ioc.Default.GetRequiredService(); + _settings = Ioc.Default.GetService(); SetHotkey(_settings.Hotkey, OnToggleHotkey); LoadCustomPluginHotkey();