diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 4c62c850b..d7b8f70d9 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -228,6 +228,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings { RememberLastLaunchLocation, MouseScreenCenter, - MouseScreenCenterTop + MouseScreenCenterTop, + MouseScreenLeftTop, + MouseScreenRightTop } } diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 1a7211bcd..8b381bab5 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -36,8 +36,10 @@ Launcher Position Remember last launch location Remember Last Launch Location - Mouse Screen Center - Mouse Screen Center Top + Mouse Focused Screen Center + Mouse Focused Screen Center Top + Mouse Focused Screen Left Top + Mouse Focused Screen Right 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 93ca33cb4..ec70fc7b6 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -239,6 +239,16 @@ namespace Flow.Launcher Left = WindowLeft(); Top = 10; } + else if (_settings.LauncherPosition == "MouseScreenLeftTop") + { + Left = 10; + Top = 10; + } + else if (_settings.LauncherPosition == "MouseScreenRightTop") + { + Left = WindowRight(); + Top = 10; + } } private void UpdateNotifyIconText() @@ -480,6 +490,16 @@ namespace Flow.Launcher Left = WindowLeft(); Top = 10; } + else if (_settings.LauncherPosition == "MouseScreenLeftTop") + { + Left = 10; + Top = 10; + } + else if (_settings.LauncherPosition == "MouseScreenRightTop") + { + Left = WindowRight(); + Top = 10; + } } private void OnLocationChanged(object sender, EventArgs e) @@ -524,6 +544,15 @@ namespace Flow.Launcher return top; } + public double WindowRight() + { + var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position); + var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.X, 0); + var dip2 = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.Width, 0); + var left = (dip2.X - ActualWidth) - 10; + return left; + } + /// /// Register up and down key /// todo: any way to put this in xaml ? diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 09757d0e2..b0e53c988 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -642,7 +642,7 @@ -