diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 211bc1798..b9735ddc2 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -199,7 +199,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings } public bool LeaveCmdOpen { get; set; } public bool HideWhenDeactive { get; set; } = true; - public bool RememberLastLaunchLocation { get; set; } + public string LauncherPosition { get; set; } = "RememberLastLaunchLocation"; public bool IgnoreHotkeysOnFullscreen { get; set; } public HttpProxy Proxy { get; set; } = new HttpProxy(); @@ -225,4 +225,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings Light, Dark } + public enum LauncherPositions + { + RememberLastLaunchLocation, + MouseScreenCenter, + MouseScreenCenterTop + } } diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 2019c1b66..ff6af2f3d 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -33,7 +33,11 @@ Error setting launch on startup Hide Flow Launcher when focus is lost Do not show new version notifications + Launcher Position Remember last launch location + Remember Last Launch Location + Mouse Screen Center + Mouse Screen Center Top Language Last Query Style Show/Hide previous results when Flow Launcher is reactivated. diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 332e0f502..2b081451e 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -182,16 +182,21 @@ namespace Flow.Launcher private void InitializePosition() { - if (_settings.RememberLastLaunchLocation) + if (_settings.LauncherPosition == "RememberLastLaunchLocation") { Top = _settings.WindowTop; Left = _settings.WindowLeft; } - else + else if(_settings.LauncherPosition == "MouseScreenCenter") { Left = WindowLeft(); Top = WindowTop(); } + else if (_settings.LauncherPosition == "MouseScreenCenterTop") + { + Left = WindowLeft(); + Top = 0; + } } private void UpdateNotifyIconText() @@ -418,23 +423,28 @@ namespace Flow.Launcher if (_animating) return; - if (_settings.RememberLastLaunchLocation) + if (_settings.LauncherPosition == "RememberLastLaunchLocation") { Left = _settings.WindowLeft; Top = _settings.WindowTop; } - else + else if (_settings.LauncherPosition == "MouseScreenCenter") { Left = WindowLeft(); Top = WindowTop(); } + else if (_settings.LauncherPosition == "MouseScreenCenterTop") + { + Left = WindowLeft(); + Top = 0; + } } private void OnLocationChanged(object sender, EventArgs e) { if (_animating) return; - if (_settings.RememberLastLaunchLocation) + if (_settings.LauncherPosition == "RememberLastLaunchLocation") { _settings.WindowLeft = Left; _settings.WindowTop = Top; diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 0a63b3a6c..11b798dae 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -685,12 +685,27 @@ - + - + - + + + +  + diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 51017b96b..42e7f7c34 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -435,6 +435,12 @@ namespace Flow.Launcher pluginFilterTxb.Focus(); } + private void LauncherPositionSelectedIndexChanged(object sender, SelectionChangedEventArgs e) + { + + } + + private void PluginStore_OnKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.F && (Keyboard.Modifiers & ModifierKeys.Control) != 0) diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 9e7ead7d0..03c31acd2 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -382,6 +382,33 @@ namespace Flow.Launcher.ViewModel } } + + + public class LauncherPosition + { + public string Display { get; set; } + public LauncherPositions Value { get; set; } + } + + public List LauncherPositions + { + get + { + List modes = new List(); + var enums = (LauncherPositions[])Enum.GetValues(typeof(LauncherPositions)); + foreach (var e in enums) + { + var key = $"LauncherPosition{e}"; + var display = _translater.GetTranslation(key); + var m = new LauncherPosition { Display = display, Value = e, }; + modes.Add(m); + } + return modes; + } + } + + + public double WindowWidthSize { get => Settings.WindowSize;