Skip to content

Commit 88d84b4

Browse files
committed
Merge Dev
2 parents d1bfd1c + 4171fa1 commit 88d84b4

File tree

13 files changed

+155
-26
lines changed

13 files changed

+155
-26
lines changed

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

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

5555
<ItemGroup>
5656
<PackageReference Include="Droplex" Version="1.4.1" />
57-
<PackageReference Include="FSharp.Core" Version="5.0.2" />
57+
<PackageReference Include="FSharp.Core" Version="6.0.6" />
5858
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.1.3" />
5959
<PackageReference Include="squirrel.windows" Version="1.5.2" NoWarn="NU1701" />
6060
</ItemGroup>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<PrivateAssets>all</PrivateAssets>
5454
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5555
</PackageReference>
56-
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="16.10.56" />
56+
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.3.44" />
5757
<PackageReference Include="NLog" Version="4.7.10" />
5858
<PackageReference Include="NLog.Schema" Version="4.7.10" />
5959
<PackageReference Include="NLog.Web.AspNetCore" Version="4.13.0" />

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<ItemGroup>
5151
<PackageReference Include="Moq" Version="4.16.1" />
5252
<PackageReference Include="nunit" Version="3.13.2" />
53-
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0">
53+
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1">
5454
<PrivateAssets>all</PrivateAssets>
5555
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5656
</PackageReference>

Flow.Launcher/Flow.Launcher.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
</ItemGroup>
8484

8585
<ItemGroup>
86+
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
8687
<PackageReference Include="Fody" Version="6.5.4">
8788
<PrivateAssets>all</PrivateAssets>
8889
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -114,4 +115,14 @@
114115
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
115116
<Exec Command="taskkill /f /fi &quot;IMAGENAME eq Flow.Launcher.exe&quot;" />
116117
</Target>
118+
119+
<Target Name="RemoveDuplicateAnalyzers" BeforeTargets="CoreCompile">
120+
<!-- Work around https://github.com/dotnet/wpf/issues/6792 -->
121+
122+
<ItemGroup>
123+
<FilteredAnalyzer Include="@(Analyzer->Distinct())" />
124+
<Analyzer Remove="@(Analyzer)" />
125+
<Analyzer Include="@(FilteredAnalyzer)" />
126+
</ItemGroup>
127+
</Target>
117128
</Project>

Flow.Launcher/Languages/en.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<system:String x:Key="LastQuerySelected">Select last Query</system:String>
4949
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
5050
<system:String x:Key="maxShowResults">Maximum results shown</system:String>
51+
<system:String x:Key="maxShowResultsToolTip">You can also quickly adjust this by using CTRL+Plus and CTRL+Minus.</system:String>
5152
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignore hotkeys in fullscreen mode</system:String>
5253
<system:String x:Key="ignoreHotkeysOnFullscreenToolTip">Disable Flow Launcher activation when a full screen application is active (Recommended for games).</system:String>
5354
<system:String x:Key="defaultFileManager">Default File Manager</system:String>
@@ -138,6 +139,7 @@
138139
<system:String x:Key="queryWindowShadowEffect">Query window shadow effect</system:String>
139140
<system:String x:Key="shadowEffectCPUUsage">Shadow effect has a substantial usage of GPU. Not recommended if your computer performance is limited.</system:String>
140141
<system:String x:Key="windowWidthSize">Window Width Size</system:String>
142+
<system:String x:Key="windowWidthSizeToolTip">You can also quickly adjust this by using Ctrl+[ and Ctrl+].</system:String>
141143
<system:String x:Key="useGlyphUI">Use Segoe Fluent Icons</system:String>
142144
<system:String x:Key="useGlyphUIEffect">Use Segoe Fluent Icons for query results where supported</system:String>
143145

Flow.Launcher/MainWindow.xaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
3333
WindowStartupLocation="Manual"
3434
WindowStyle="None"
35-
mc:Ignorable="d">
35+
mc:Ignorable="d"
36+
Left="{Binding Left, Mode=TwoWay}"
37+
Top="{Binding Top, Mode=TwoWay}">
3638
<Window.Resources>
3739
<converters:QuerySuggestionBoxConverter x:Key="QuerySuggestionBoxConverter" />
3840
<converters:BorderClipConverter x:Key="BorderClipConverter" />
@@ -84,6 +86,22 @@
8486
Modifiers="Ctrl" />
8587
<KeyBinding Key="Right" Command="{Binding LoadContextMenuCommand}" />
8688
<KeyBinding Key="Left" Command="{Binding EscCommand}" />
89+
<KeyBinding
90+
Key="OemCloseBrackets"
91+
Modifiers="Control"
92+
Command="{Binding IncreaseWidthCommand}"/>
93+
<KeyBinding
94+
Key="OemOpenBrackets"
95+
Modifiers="Control"
96+
Command="{Binding DecreaseWidthCommand}"/>
97+
<KeyBinding
98+
Key="OemPlus"
99+
Modifiers="Control"
100+
Command="{Binding IncreaseMaxResultCommand}"/>
101+
<KeyBinding
102+
Key="OemMinus"
103+
Modifiers="Control"
104+
Command="{Binding DecreaseMaxResultCommand}"/>
87105
<KeyBinding
88106
Key="H"
89107
Command="{Binding LoadHistoryCommand}"

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public MainWindow(Settings settings, MainViewModel mainVM)
4646
_viewModel = mainVM;
4747
_settings = settings;
4848
InitializeComponent();
49-
InitializePosition();
5049
animationSound.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav"));
5150
}
5251

@@ -91,6 +90,7 @@ private void OnLoaded(object sender, RoutedEventArgs _)
9190
InitializeColorScheme();
9291
WindowsInteropHelper.DisableControlBox(this);
9392
InitProgressbarAnimation();
93+
InitializePosition();
9494
// since the default main window visibility is visible
9595
// so we need set focus during startup
9696
QueryTextBox.Focus();
@@ -470,6 +470,15 @@ public void HideStartup()
470470
}
471471
}
472472

473+
private void InitializePosition()
474+
{
475+
if (!_settings.RememberLastLaunchLocation)
476+
{
477+
Left = WindowLeft();
478+
Top = WindowTop();
479+
}
480+
}
481+
473482
public double WindowLeft()
474483
{
475484
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
@@ -503,6 +512,7 @@ public double WindowRight()
503512
/// </summary>
504513
private void OnKeyDown(object sender, KeyEventArgs e)
505514
{
515+
var specialKeyState = GlobalHotkey.CheckModifiers();
506516
switch (e.Key)
507517
{
508518
case Key.Down:
@@ -537,8 +547,13 @@ private void OnKeyDown(object sender, KeyEventArgs e)
537547
e.Handled = true;
538548
}
539549
break;
550+
case Key.F12:
551+
if (specialKeyState.CtrlPressed)
552+
{
553+
ToggleGameMode();
554+
}
555+
break;
540556
case Key.Back:
541-
var specialKeyState = GlobalHotkey.CheckModifiers();
542557
if (specialKeyState.CtrlPressed)
543558
{
544559
if (_viewModel.SelectedIsFromQueryResults()

Flow.Launcher/SettingWindow.xaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -832,11 +832,13 @@
832832
BorderThickness="0"
833833
Style="{DynamicResource SettingGroupBox}">
834834
<ItemsControl Style="{StaticResource SettingGrid}">
835-
<TextBlock
836-
Grid.Column="1"
837-
VerticalAlignment="Center"
838-
Style="{DynamicResource SettingTitleLabel}"
839-
Text="{DynamicResource maxShowResults}" />
835+
<StackPanel Grid.Column="1">
836+
<TextBlock
837+
VerticalAlignment="Center"
838+
Style="{DynamicResource SettingTitleLabel}"
839+
Text="{DynamicResource maxShowResults}" />
840+
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource maxShowResultsToolTip}" />
841+
</StackPanel>
840842
<ComboBox
841843
Grid.Column="2"
842844
Width="100"
@@ -1829,6 +1831,7 @@
18291831
<ItemsControl Style="{StaticResource SettingGrid}">
18301832
<StackPanel Style="{StaticResource TextPanel}">
18311833
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource windowWidthSize}" />
1834+
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource windowWidthSizeToolTip}" />
18321835
</StackPanel>
18331836
<StackPanel Grid.Column="2" Orientation="Horizontal">
18341837
<TextBlock
@@ -1842,6 +1845,7 @@
18421845
Name="WindowWidthValue"
18431846
Width="300"
18441847
Margin="0,0,18,0"
1848+
VerticalAlignment="Center"
18451849
IsMoveToPointEnabled="True"
18461850
IsSnapToTickEnabled="True"
18471851
Maximum="1920"

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 88 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
using ISavable = Flow.Launcher.Plugin.ISavable;
2222
using System.IO;
2323
using System.Collections.Specialized;
24+
using CommunityToolkit.Mvvm.Input;
2425

2526
namespace Flow.Launcher.ViewModel
2627
{
27-
public class MainViewModel : BaseModel, ISavable
28+
public partial class MainViewModel : BaseModel, ISavable
2829
{
2930
#region Private Fields
3031

@@ -82,6 +83,7 @@ public MainViewModel(Settings settings)
8283
_selectedResults = Results;
8384

8485
InitializeKeyCommands();
86+
8587
RegisterViewUpdate();
8688
RegisterResultsUpdatedEvent();
8789

@@ -154,6 +156,8 @@ private void RegisterResultsUpdatedEvent()
154156
}
155157
}
156158

159+
160+
157161
private void InitializeKeyCommands()
158162
{
159163
EscCommand = new RelayCommand(_ =>
@@ -307,7 +311,7 @@ private void InitializeKeyCommands()
307311
Notification.Show(
308312
InternationalizationManager.Instance.GetTranslation("success"),
309313
InternationalizationManager.Instance.GetTranslation("completedSuccessfully")
310-
);
314+
);
311315
}), TaskScheduler.Default)
312316
.ConfigureAwait(false);
313317
});
@@ -318,9 +322,9 @@ private void InitializeKeyCommands()
318322
#region ViewModel Properties
319323

320324
public ResultsViewModel Results { get; private set; }
321-
325+
322326
public ResultsViewModel ContextMenu { get; private set; }
323-
327+
324328
public ResultsViewModel History { get; private set; }
325329

326330
public bool GameModeStatus { get; set; }
@@ -336,6 +340,74 @@ public string QueryText
336340
}
337341
}
338342

343+
344+
public double Top
345+
{
346+
get => _settings.WindowTop;
347+
set
348+
{
349+
_settings.WindowTop = value;
350+
OnPropertyChanged();
351+
}
352+
}
353+
public double Left
354+
{
355+
get => _settings.WindowLeft;
356+
set
357+
{
358+
_settings.WindowLeft = value;
359+
OnPropertyChanged();
360+
}
361+
}
362+
363+
[RelayCommand]
364+
private void IncreaseWidth()
365+
{
366+
if (MainWindowWidth + 100 > 1920 || _settings.WindowSize == 1920)
367+
{
368+
_settings.WindowSize = 1920;
369+
}
370+
else
371+
{
372+
_settings.WindowSize += 100;
373+
Left -= 50;
374+
}
375+
OnPropertyChanged();
376+
}
377+
378+
[RelayCommand]
379+
private void DecreaseWidth()
380+
{
381+
if (MainWindowWidth - 100 < 400 || _settings.WindowSize == 400)
382+
{
383+
_settings.WindowSize = 400;
384+
}
385+
else
386+
{
387+
Left += 50;
388+
_settings.WindowSize -= 100;
389+
}
390+
OnPropertyChanged();
391+
}
392+
393+
[RelayCommand]
394+
private void IncreaseMaxResult()
395+
{
396+
if (_settings.MaxResultsToShow == 17)
397+
return;
398+
399+
_settings.MaxResultsToShow += 1;
400+
}
401+
402+
[RelayCommand]
403+
private void DecreaseMaxResult()
404+
{
405+
if (_settings.MaxResultsToShow == 2)
406+
return;
407+
408+
_settings.MaxResultsToShow -= 1;
409+
}
410+
339411
/// <summary>
340412
/// we need move cursor to end when we manually changed query
341413
/// but we don't want to move cursor to end when query is updated from TextBox
@@ -411,7 +483,11 @@ private ResultsViewModel SelectedResults
411483

412484
public Visibility SearchIconVisibility { get; set; }
413485

414-
public double MainWindowWidth => _settings.WindowSize;
486+
public double MainWindowWidth
487+
{
488+
get => _settings.WindowSize;
489+
set => _settings.WindowSize = value;
490+
}
415491

416492
public string PluginIconPath { get; set; } = null;
417493

@@ -592,7 +668,7 @@ private async void QueryResults()
592668
PluginIconPath = null;
593669
SearchIconVisibility = Visibility.Visible;
594670
}
595-
671+
596672

597673
if (query.ActionKeyword == Plugin.Query.GlobalPluginWildcardSign)
598674
{
@@ -903,18 +979,18 @@ public void ResultCopy(string stringToCopy)
903979

904980
Clipboard.SetFileDropList(paths);
905981
App.API.ShowMsg(
906-
App.API.GetTranslation("copy")
907-
+" "
908-
+ (isFile? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle")),
982+
App.API.GetTranslation("copy")
983+
+ " "
984+
+ (isFile ? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle")),
909985
App.API.GetTranslation("completedSuccessfully"));
910986
}
911987
else
912988
{
913989
Clipboard.SetDataObject(copyText.ToString());
914990
App.API.ShowMsg(
915-
App.API.GetTranslation("copy")
916-
+ " "
917-
+ App.API.GetTranslation("textTitle"),
991+
App.API.GetTranslation("copy")
992+
+ " "
993+
+ App.API.GetTranslation("textTitle"),
918994
App.API.GetTranslation("completedSuccessfully"));
919995
}
920996
}

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ public SettingWindowViewModel(Updater updater, IPortable portable)
4141
case nameof(Settings.ActivateTimes):
4242
OnPropertyChanged(nameof(ActivatedTimes));
4343
break;
44+
case nameof(Settings.WindowSize):
45+
OnPropertyChanged(nameof(WindowWidthSize));
46+
break;
4447
}
4548
};
4649
}

0 commit comments

Comments
 (0)