Skip to content

Commit 8ccce07

Browse files
authored
Merge branch 'dev' into localize-missing-python-js-dialog
2 parents 1c2d9e8 + 87d704d commit 8ccce07

File tree

11 files changed

+219
-83
lines changed

11 files changed

+219
-83
lines changed

Flow.Launcher.Core/Flow.Launcher.Core.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454

5555
<ItemGroup>
5656
<PackageReference Include="Droplex" Version="1.7.0" />
57-
<PackageReference Include="FSharp.Core" Version="7.0.401" />
58-
<PackageReference Include="Meziantou.Framework.Win32.Jobs" Version="3.2.1" />
57+
<PackageReference Include="FSharp.Core" Version="8.0.300" />
58+
<PackageReference Include="Meziantou.Framework.Win32.Jobs" Version="3.4.0" />
5959
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
6060
<PackageReference Include="squirrel.windows" Version="1.5.2" NoWarn="NU1701" />
6161
<PackageReference Include="StreamJsonRpc" Version="2.17.11" />

Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
<ItemGroup>
5151
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
52-
<PackageReference Include="BitFaster.Caching" Version="2.5.0" />
52+
<PackageReference Include="BitFaster.Caching" Version="2.5.1" />
5353
<PackageReference Include="Fody" Version="6.5.5">
5454
<PrivateAssets>all</PrivateAssets>
5555
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System;
2+
3+
namespace Flow.Launcher.Infrastructure.UserSettings;
4+
5+
public record struct Point2D(double X, double Y)
6+
{
7+
public static implicit operator Point2D((double X, double Y) point)
8+
{
9+
return new Point2D(point.X, point.Y);
10+
}
11+
12+
public static Point2D operator +(Point2D point1, Point2D point2)
13+
{
14+
return new Point2D(point1.X + point2.X, point1.Y + point2.Y);
15+
}
16+
17+
public static Point2D operator -(Point2D point1, Point2D point2)
18+
{
19+
return new Point2D(point1.X - point2.X, point1.Y - point2.Y);
20+
}
21+
22+
public static Point2D operator *(Point2D point, double scalar)
23+
{
24+
return new Point2D(point.X * scalar, point.Y * scalar);
25+
}
26+
27+
public static Point2D operator /(Point2D point, double scalar)
28+
{
29+
return new Point2D(point.X / scalar, point.Y / scalar);
30+
}
31+
32+
public static Point2D operator /(Point2D point1, Point2D point2)
33+
{
34+
return new Point2D(point1.X / point2.X, point1.Y / point2.Y);
35+
}
36+
37+
public static Point2D operator *(Point2D point1, Point2D point2)
38+
{
39+
return new Point2D(point1.X * point2.X, point1.Y * point2.Y);
40+
}
41+
42+
public Point2D Clamp(Point2D min, Point2D max)
43+
{
44+
return new Point2D(Math.Clamp(X, min.X, max.X), Math.Clamp(Y, min.Y, max.Y));
45+
}
46+
}

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,10 @@ public SearchPrecisionScore QuerySearchPrecision
205205

206206
public bool AutoUpdates { get; set; } = false;
207207

208-
public double WindowLeft { get; set; }
209-
public double WindowTop { get; set; }
208+
209+
public Point2D WindowPosition { get; set; }
210+
public Point2D PreviousScreen { get; set; }
211+
public Point2D PreviousDpi { get; set; }
210212

211213
/// <summary>
212214
/// Custom left position on selected monitor

Flow.Launcher.Test/Flow.Launcher.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<PrivateAssets>all</PrivateAssets>
5555
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5656
</PackageReference>
57-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
57+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
5858
</ItemGroup>
5959

6060
</Project>

Flow.Launcher/CustomShortcutSetting.xaml.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
11
using Flow.Launcher.Core.Resource;
2-
using Flow.Launcher.ViewModel;
32
using System;
43
using System.Windows;
54
using System.Windows.Input;
5+
using Flow.Launcher.SettingPages.ViewModels;
66

77
namespace Flow.Launcher
88
{
99
public partial class CustomShortcutSetting : Window
1010
{
11+
private readonly SettingsPaneHotkeyViewModel _hotkeyVm;
1112
public string Key { get; set; } = String.Empty;
1213
public string Value { get; set; } = String.Empty;
13-
private string originalKey { get; init; } = null;
14-
private string originalValue { get; init; } = null;
15-
private bool update { get; init; } = false;
14+
private string originalKey { get; } = null;
15+
private string originalValue { get; } = null;
16+
private bool update { get; } = false;
1617

17-
public CustomShortcutSetting(SettingWindowViewModel vm)
18+
public CustomShortcutSetting(SettingsPaneHotkeyViewModel vm)
1819
{
20+
_hotkeyVm = vm;
1921
InitializeComponent();
2022
}
2123

22-
public CustomShortcutSetting(string key, string value)
24+
public CustomShortcutSetting(string key, string value, SettingsPaneHotkeyViewModel vm)
2325
{
2426
Key = key;
2527
Value = value;
2628
originalKey = key;
2729
originalValue = value;
2830
update = true;
31+
_hotkeyVm = vm;
2932
InitializeComponent();
3033
}
3134

@@ -43,7 +46,7 @@ private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
4346
return;
4447
}
4548
// Check if key is modified or adding a new one
46-
if ((update && originalKey != Key) || !update)
49+
if (((update && originalKey != Key) || !update) && _hotkeyVm.DoesShortcutExist(Key))
4750
{
4851
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("duplicateShortcut"));
4952
return;

0 commit comments

Comments
 (0)