diff --git a/Flow.Launcher.Core/Flow.Launcher.Core.csproj b/Flow.Launcher.Core/Flow.Launcher.Core.csproj
index fe2cb7e58..851541fc2 100644
--- a/Flow.Launcher.Core/Flow.Launcher.Core.csproj
+++ b/Flow.Launcher.Core/Flow.Launcher.Core.csproj
@@ -54,8 +54,8 @@
-
-
+
+
diff --git a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj
index 7d6448c43..688b40c83 100644
--- a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj
+++ b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj
@@ -49,7 +49,7 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/Flow.Launcher.Infrastructure/UserSettings/Point2D.cs b/Flow.Launcher.Infrastructure/UserSettings/Point2D.cs
new file mode 100644
index 000000000..4c47ba6c0
--- /dev/null
+++ b/Flow.Launcher.Infrastructure/UserSettings/Point2D.cs
@@ -0,0 +1,46 @@
+using System;
+
+namespace Flow.Launcher.Infrastructure.UserSettings;
+
+public record struct Point2D(double X, double Y)
+{
+ public static implicit operator Point2D((double X, double Y) point)
+ {
+ return new Point2D(point.X, point.Y);
+ }
+
+ public static Point2D operator +(Point2D point1, Point2D point2)
+ {
+ return new Point2D(point1.X + point2.X, point1.Y + point2.Y);
+ }
+
+ public static Point2D operator -(Point2D point1, Point2D point2)
+ {
+ return new Point2D(point1.X - point2.X, point1.Y - point2.Y);
+ }
+
+ public static Point2D operator *(Point2D point, double scalar)
+ {
+ return new Point2D(point.X * scalar, point.Y * scalar);
+ }
+
+ public static Point2D operator /(Point2D point, double scalar)
+ {
+ return new Point2D(point.X / scalar, point.Y / scalar);
+ }
+
+ public static Point2D operator /(Point2D point1, Point2D point2)
+ {
+ return new Point2D(point1.X / point2.X, point1.Y / point2.Y);
+ }
+
+ public static Point2D operator *(Point2D point1, Point2D point2)
+ {
+ return new Point2D(point1.X * point2.X, point1.Y * point2.Y);
+ }
+
+ public Point2D Clamp(Point2D min, Point2D max)
+ {
+ return new Point2D(Math.Clamp(X, min.X, max.X), Math.Clamp(Y, min.Y, max.Y));
+ }
+}
diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
index 0c7de10fd..125447d83 100644
--- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
+++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
@@ -205,8 +205,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public bool AutoUpdates { get; set; } = false;
- public double WindowLeft { get; set; }
- public double WindowTop { get; set; }
+
+ public Point2D WindowPosition { get; set; }
+ public Point2D PreviousScreen { get; set; }
+ public Point2D PreviousDpi { get; set; }
///
/// Custom left position on selected monitor
diff --git a/Flow.Launcher.Test/Flow.Launcher.Test.csproj b/Flow.Launcher.Test/Flow.Launcher.Test.csproj
index fd967de4a..9f2b64134 100644
--- a/Flow.Launcher.Test/Flow.Launcher.Test.csproj
+++ b/Flow.Launcher.Test/Flow.Launcher.Test.csproj
@@ -54,7 +54,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
\ No newline at end of file
diff --git a/Flow.Launcher/CustomShortcutSetting.xaml.cs b/Flow.Launcher/CustomShortcutSetting.xaml.cs
index 82efb4869..531b29d50 100644
--- a/Flow.Launcher/CustomShortcutSetting.xaml.cs
+++ b/Flow.Launcher/CustomShortcutSetting.xaml.cs
@@ -1,31 +1,34 @@
using Flow.Launcher.Core.Resource;
-using Flow.Launcher.ViewModel;
using System;
using System.Windows;
using System.Windows.Input;
+using Flow.Launcher.SettingPages.ViewModels;
namespace Flow.Launcher
{
public partial class CustomShortcutSetting : Window
{
+ private readonly SettingsPaneHotkeyViewModel _hotkeyVm;
public string Key { get; set; } = String.Empty;
public string Value { get; set; } = String.Empty;
- private string originalKey { get; init; } = null;
- private string originalValue { get; init; } = null;
- private bool update { get; init; } = false;
+ private string originalKey { get; } = null;
+ private string originalValue { get; } = null;
+ private bool update { get; } = false;
- public CustomShortcutSetting(SettingWindowViewModel vm)
+ public CustomShortcutSetting(SettingsPaneHotkeyViewModel vm)
{
+ _hotkeyVm = vm;
InitializeComponent();
}
- public CustomShortcutSetting(string key, string value)
+ public CustomShortcutSetting(string key, string value, SettingsPaneHotkeyViewModel vm)
{
Key = key;
Value = value;
originalKey = key;
originalValue = value;
update = true;
+ _hotkeyVm = vm;
InitializeComponent();
}
@@ -43,7 +46,7 @@ namespace Flow.Launcher
return;
}
// Check if key is modified or adding a new one
- if ((update && originalKey != Key) || !update)
+ if (((update && originalKey != Key) || !update) && _hotkeyVm.DoesShortcutExist(Key))
{
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("duplicateShortcut"));
return;
diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs
index 60048d070..4027e7698 100644
--- a/Flow.Launcher/MainWindow.xaml.cs
+++ b/Flow.Launcher/MainWindow.xaml.cs
@@ -72,11 +72,7 @@ namespace Flow.Launcher
};
}
- DispatcherTimer timer = new DispatcherTimer
- {
- Interval = new TimeSpan(0, 0, 0, 0, 500),
- IsEnabled = false
- };
+ DispatcherTimer timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 0, 500), IsEnabled = false };
public MainWindow()
{
@@ -87,6 +83,7 @@ namespace Flow.Launcher
private const int WM_EXITSIZEMOVE = 0x0232;
private int _initialWidth;
private int _initialHeight;
+
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
if (msg == WM_ENTERSIZEMOVE)
@@ -95,18 +92,22 @@ namespace Flow.Launcher
_initialHeight = (int)Height;
handled = true;
}
+
if (msg == WM_EXITSIZEMOVE)
{
- if ( _initialHeight != (int)Height)
+ if (_initialHeight != (int)Height)
{
OnResizeEnd();
}
+
if (_initialWidth != (int)Width)
{
FlowMainWindow.SizeToContent = SizeToContent.Height;
}
+
handled = true;
}
+
return IntPtr.Zero;
}
@@ -131,6 +132,7 @@ namespace Flow.Launcher
_settings.MaxResultsToShow = Convert.ToInt32(Math.Truncate(itemCount));
}
}
+
FlowMainWindow.SizeToContent = SizeToContent.Height;
_viewModel.MainWindowWidth = Width;
}
@@ -175,6 +177,7 @@ namespace Flow.Launcher
private void OnInitialized(object sender, EventArgs e)
{
}
+
private void OnLoaded(object sender, RoutedEventArgs _)
{
// MouseEventHandler
@@ -206,6 +209,7 @@ namespace Flow.Launcher
{
SoundPlay();
}
+
UpdatePosition();
PreviewReset();
Activate();
@@ -217,7 +221,8 @@ namespace Flow.Launcher
_viewModel.LastQuerySelected = true;
}
- if (_viewModel.ProgressBarVisibility == Visibility.Visible && isProgressBarStoryboardPaused)
+ if (_viewModel.ProgressBarVisibility == Visibility.Visible &&
+ isProgressBarStoryboardPaused)
{
_progressBarStoryboard.Begin(ProgressBar, true);
isProgressBarStoryboardPaused = false;
@@ -258,9 +263,12 @@ namespace Flow.Launcher
MoveQueryTextToEnd();
_viewModel.QueryTextCursorMovedToEnd = false;
}
+
break;
case nameof(MainViewModel.GameModeStatus):
- _notifyIcon.Icon = _viewModel.GameModeStatus ? Properties.Resources.gamemode : Properties.Resources.app;
+ _notifyIcon.Icon = _viewModel.GameModeStatus
+ ? Properties.Resources.gamemode
+ : Properties.Resources.app;
break;
}
};
@@ -278,11 +286,8 @@ namespace Flow.Launcher
case nameof(Settings.Hotkey):
UpdateNotifyIconText();
break;
- case nameof(Settings.WindowLeft):
- Left = _settings.WindowLeft;
- break;
- case nameof(Settings.WindowTop):
- Top = _settings.WindowTop;
+ case nameof(Settings.WindowPosition):
+ (Left, Top) = _settings.WindowPosition;
break;
}
};
@@ -292,8 +297,24 @@ namespace Flow.Launcher
{
if (_settings.SearchWindowScreen == SearchWindowScreens.RememberLastLaunchLocation)
{
- Top = _settings.WindowTop;
- Left = _settings.WindowLeft;
+ var previousScreen = _settings.PreviousScreen;
+
+ var previousDpi = _settings.PreviousDpi;
+
+ _settings.PreviousScreen = (SystemParameters.VirtualScreenWidth, SystemParameters.VirtualScreenHeight);
+
+ var currentDpi = GetDpi();
+
+ if (previousScreen == default ||
+ previousDpi == default ||
+ (previousScreen != (SystemParameters.VirtualScreenWidth, SystemParameters.VirtualScreenHeight) ||
+ previousDpi != currentDpi))
+ {
+ AdjustPositionForResolutionChange();
+ return;
+ }
+
+ (Left, Top) = _settings.WindowPosition;
}
else
{
@@ -306,34 +327,72 @@ namespace Flow.Launcher
break;
case SearchWindowAligns.CenterTop:
Left = HorizonCenter(screen);
- Top = 10;
+ Top = VerticalTop(screen);
break;
case SearchWindowAligns.LeftTop:
Left = HorizonLeft(screen);
- Top = 10;
+ Top = VerticalTop(screen);
break;
case SearchWindowAligns.RightTop:
Left = HorizonRight(screen);
- Top = 10;
+ Top = VerticalTop(screen);
break;
case SearchWindowAligns.Custom:
- Left = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.X + _settings.CustomWindowLeft, 0).X;
- Top = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Y + _settings.CustomWindowTop).Y;
+ var customLeft = WindowsInteropHelper.TransformPixelsToDIP(this,
+ screen.WorkingArea.X + _settings.CustomWindowLeft, 0);
+ var customTop = WindowsInteropHelper.TransformPixelsToDIP(this, 0,
+ screen.WorkingArea.Y + _settings.CustomWindowTop);
+ Left = customLeft.X;
+ Top = customTop.Y;
break;
}
}
+ }
+ private void AdjustPositionForResolutionChange()
+ {
+ Point2D screenBound = (SystemParameters.VirtualScreenWidth, SystemParameters.VirtualScreenHeight);
+
+ var currentDpi = GetDpi();
+
+ var previousPosition = _settings.WindowPosition;
+
+ var ratio = screenBound / _settings.PreviousScreen;
+
+ var dpiRatio = currentDpi / _settings.PreviousDpi;
+
+ var newPosition = previousPosition * ratio * dpiRatio;
+
+ Point2D minPosition = (SystemParameters.VirtualScreenLeft, SystemParameters.VirtualScreenTop);
+
+ var maxPosition = minPosition + screenBound - (ActualWidth, ActualHeight);
+
+ (Left, Top) = newPosition.Clamp(minPosition, maxPosition);
+ }
+
+ private Point2D GetDpi()
+ {
+ PresentationSource source = PresentationSource.FromVisual(this);
+ Point2D point = (96, 96);
+ if (source is { CompositionTarget: not null })
+ {
+ Matrix m = source.CompositionTarget.TransformToDevice;
+ point.X = 96 * m.M11;
+ point.Y = 96 * m.M22;
+ }
+
+ return point;
}
private void UpdateNotifyIconText()
{
var menu = contextMenu;
- ((MenuItem)menu.Items[0]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" + _settings.Hotkey + ")";
+ ((MenuItem)menu.Items[0]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") +
+ " (" + _settings.Hotkey + ")";
((MenuItem)menu.Items[1]).Header = InternationalizationManager.Instance.GetTranslation("GameMode");
((MenuItem)menu.Items[2]).Header = InternationalizationManager.Instance.GetTranslation("PositionReset");
((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings");
((MenuItem)menu.Items[4]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit");
-
}
private void InitializeNotifyIcon()
@@ -345,50 +404,34 @@ namespace Flow.Launcher
Visible = !_settings.HideNotifyIcon
};
- var openIcon = new FontIcon
- {
- Glyph = "\ue71e"
- };
+ var openIcon = new FontIcon { Glyph = "\ue71e" };
var open = new MenuItem
{
- Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" + _settings.Hotkey + ")",
+ Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" +
+ _settings.Hotkey + ")",
Icon = openIcon
};
- var gamemodeIcon = new FontIcon
- {
- Glyph = "\ue7fc"
- };
+ var gamemodeIcon = new FontIcon { Glyph = "\ue7fc" };
var gamemode = new MenuItem
{
- Header = InternationalizationManager.Instance.GetTranslation("GameMode"),
- Icon = gamemodeIcon
- };
- var positionresetIcon = new FontIcon
- {
- Glyph = "\ue73f"
+ Header = InternationalizationManager.Instance.GetTranslation("GameMode"), Icon = gamemodeIcon
};
+ var positionresetIcon = new FontIcon { Glyph = "\ue73f" };
var positionreset = new MenuItem
{
Header = InternationalizationManager.Instance.GetTranslation("PositionReset"),
Icon = positionresetIcon
};
- var settingsIcon = new FontIcon
- {
- Glyph = "\ue713"
- };
+ var settingsIcon = new FontIcon { Glyph = "\ue713" };
var settings = new MenuItem
{
Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings"),
Icon = settingsIcon
};
- var exitIcon = new FontIcon
- {
- Glyph = "\ue7e8"
- };
+ var exitIcon = new FontIcon { Glyph = "\ue7e8" };
var exit = new MenuItem
{
- Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit"),
- Icon = exitIcon
+ Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit"), Icon = exitIcon
};
open.Click += (o, e) => _viewModel.ToggleFlowLauncher();
@@ -421,6 +464,7 @@ namespace Flow.Launcher
{
_ = SetForegroundWindow(hwndSource.Handle);
}
+
contextMenu.Focus();
break;
}
@@ -454,8 +498,10 @@ namespace Flow.Launcher
private void InitProgressbarAnimation()
{
- var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 100, new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
- var da1 = new DoubleAnimation(ProgressBar.X1, ActualWidth + 0, new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
+ var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 100,
+ new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
+ var da1 = new DoubleAnimation(ProgressBar.X1, ActualWidth + 0,
+ new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
Storyboard.SetTargetProperty(da, new PropertyPath("(Line.X2)"));
Storyboard.SetTargetProperty(da1, new PropertyPath("(Line.X1)"));
_progressBarStoryboard.Children.Add(da);
@@ -557,14 +603,14 @@ namespace Flow.Launcher
iconsb.Children.Add(IconOpacity);
windowsb.Completed += (_, _) => _animating = false;
- _settings.WindowLeft = Left;
- _settings.WindowTop = Top;
+ _settings.WindowPosition = (Left, Top);
isArrowKeyPressed = false;
if (QueryTextBox.Text.Length == 0)
{
clocksb.Begin(ClockPanel);
}
+
iconsb.Begin(SearchIcon);
windowsb.Begin(FlowMainWindow);
}
@@ -618,8 +664,7 @@ namespace Flow.Launcher
private async void OnDeactivated(object sender, EventArgs e)
{
- _settings.WindowLeft = Left;
- _settings.WindowTop = Top;
+ _settings.WindowPosition = (Left, Top);
//This condition stops extra hide call when animator is on,
// which causes the toggling to occasional hide instead of show.
if (_viewModel.MainWindowVisibilityStatus)
@@ -650,8 +695,7 @@ namespace Flow.Launcher
return;
if (_settings.SearchWindowScreen == SearchWindowScreens.RememberLastLaunchLocation)
{
- _settings.WindowLeft = Left;
- _settings.WindowTop = Top;
+ _settings.WindowPosition = (Left, Top);
}
}
@@ -671,7 +715,7 @@ namespace Flow.Launcher
public Screen SelectedScreen()
{
Screen screen = null;
- switch(_settings.SearchWindowScreen)
+ switch (_settings.SearchWindowScreen)
{
case SearchWindowScreens.Cursor:
screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
@@ -693,6 +737,7 @@ namespace Flow.Launcher
screen = Screen.AllScreens[0];
break;
}
+
return screen ?? Screen.AllScreens[0];
}
@@ -727,6 +772,13 @@ namespace Flow.Launcher
return left;
}
+ public double VerticalTop(Screen screen)
+ {
+ var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Y);
+ var top = dip1.Y + 10;
+ return top;
+ }
+
///
/// Register up and down key
/// todo: any way to put this in xaml ?
@@ -762,6 +814,7 @@ namespace Flow.Launcher
_viewModel.LoadContextMenuCommand.Execute(null);
e.Handled = true;
}
+
break;
case Key.Left:
if (!_viewModel.SelectedIsFromQueryResults() && QueryTextBox.CaretIndex == 0)
@@ -769,6 +822,7 @@ namespace Flow.Launcher
_viewModel.EscCommand.Execute(null);
e.Handled = true;
}
+
break;
case Key.Back:
if (specialKeyState.CtrlPressed)
@@ -787,12 +841,13 @@ namespace Flow.Launcher
}
}
}
+
break;
default:
break;
-
}
}
+
private void OnKeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Up || e.Key == Key.Down)
@@ -808,6 +863,7 @@ namespace Flow.Launcher
e.Handled = true; // Ignore Mouse Hover when press Arrowkeys
}
}
+
public void PreviewReset()
{
_viewModel.ResetPreview();
diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs
index 7eb05d945..a4488a037 100644
--- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs
+++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs
@@ -1,4 +1,5 @@
-using System.Windows;
+using System.Linq;
+using System.Windows;
using CommunityToolkit.Mvvm.Input;
using Flow.Launcher.Core.Resource;
using Flow.Launcher.Helper;
@@ -114,7 +115,7 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
return;
}
- var window = new CustomShortcutSetting(item.Key, item.Value);
+ var window = new CustomShortcutSetting(item.Key, item.Value, this);
if (window.ShowDialog() is not true) return;
var index = Settings.CustomShortcuts.IndexOf(item);
@@ -124,11 +125,17 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
[RelayCommand]
private void CustomShortcutAdd()
{
- var window = new CustomShortcutSetting(null);
+ var window = new CustomShortcutSetting(this);
if (window.ShowDialog() is true)
{
var shortcut = new CustomShortcutModel(window.Key, window.Value);
Settings.CustomShortcuts.Add(shortcut);
}
}
+
+ internal bool DoesShortcutExist(string key)
+ {
+ return Settings.CustomShortcuts.Any(v => v.Key == key) ||
+ Settings.BuiltinShortcuts.Any(v => v.Key == key);
+ }
}
diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs
index de4fd1f91..99c363222 100644
--- a/Flow.Launcher/SettingWindow.xaml.cs
+++ b/Flow.Launcher/SettingWindow.xaml.cs
@@ -112,23 +112,45 @@ public partial class SettingWindow
{
if (_settings.SettingWindowTop == null || _settings.SettingWindowLeft == null)
{
- Top = WindowTop();
- Left = WindowLeft();
+ SetWindowPosition(WindowTop(), WindowLeft());
}
else
{
- Top = _settings.SettingWindowTop.Value;
- Left = _settings.SettingWindowLeft.Value;
+ double left = _settings.SettingWindowLeft.Value;
+ double top = _settings.SettingWindowTop.Value;
+ AdjustWindowPosition(ref top, ref left);
+ SetWindowPosition(top, left);
}
WindowState = _settings.SettingWindowState;
}
+ private void SetWindowPosition(double top, double left)
+ {
+ // Ensure window does not exceed screen boundaries
+ top = Math.Max(top, SystemParameters.VirtualScreenTop);
+ left = Math.Max(left, SystemParameters.VirtualScreenLeft);
+ top = Math.Min(top, SystemParameters.VirtualScreenHeight - ActualHeight);
+ left = Math.Min(left, SystemParameters.VirtualScreenWidth - ActualWidth);
+
+ Top = top;
+ Left = left;
+ }
+
+ private void AdjustWindowPosition(ref double top, ref double left)
+ {
+ // Adjust window position if it exceeds screen boundaries
+ top = Math.Max(top, SystemParameters.VirtualScreenTop);
+ left = Math.Max(left, SystemParameters.VirtualScreenLeft);
+ top = Math.Min(top, SystemParameters.VirtualScreenHeight - ActualHeight);
+ left = Math.Min(left, SystemParameters.VirtualScreenWidth - ActualWidth);
+ }
+
private double WindowLeft()
{
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 - this.ActualWidth) / 2 + dip1.X;
+ var left = (dip2.X - ActualWidth) / 2 + dip1.X;
return left;
}
@@ -137,7 +159,7 @@ public partial class SettingWindow
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Y);
var dip2 = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Height);
- var top = (dip2.Y - this.ActualHeight) / 2 + dip1.Y - 20;
+ var top = (dip2.Y - ActualHeight) / 2 + dip1.Y;
return top;
}
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index 6c17e21f0..5756e46ae 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -547,20 +547,20 @@ namespace Flow.Launcher.ViewModel
private void IncreaseWidth()
{
Settings.WindowSize += 100;
- Settings.WindowLeft -= 50;
+ Settings.WindowPosition -= (50, 0);
OnPropertyChanged(nameof(MainWindowWidth));
}
[RelayCommand]
private void DecreaseWidth()
{
- if (MainWindowWidth - 100 < 400 || Settings.WindowSize == 400)
+ if (MainWindowWidth - 100 < 400 || Math.Abs(Settings.WindowSize - 400) < 0.01)
{
Settings.WindowSize = 400;
}
else
{
- Settings.WindowLeft += 50;
+ Settings.WindowPosition += (50, 0);
Settings.WindowSize -= 100;
}
diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj
index 234afe28a..9177813f4 100644
--- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj
+++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj
@@ -95,7 +95,7 @@
-
+