mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge branch 'dev' into dev
This commit is contained in:
commit
af7539a218
14 changed files with 246 additions and 54 deletions
|
|
@ -252,6 +252,7 @@ namespace Flow.Launcher.Infrastructure.Image
|
||||||
image.BeginInit();
|
image.BeginInit();
|
||||||
image.CacheOption = BitmapCacheOption.OnLoad;
|
image.CacheOption = BitmapCacheOption.OnLoad;
|
||||||
image.UriSource = new Uri(path);
|
image.UriSource = new Uri(path);
|
||||||
|
image.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
|
||||||
image.EndInit();
|
image.EndInit();
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
||||||
}
|
}
|
||||||
public bool LeaveCmdOpen { get; set; }
|
public bool LeaveCmdOpen { get; set; }
|
||||||
public bool HideWhenDeactive { get; set; } = true;
|
public bool HideWhenDeactive { get; set; } = true;
|
||||||
public bool RememberLastLaunchLocation { get; set; }
|
public SearchWindowPositions SearchWindowPosition { get; set; } = SearchWindowPositions.MouseScreenCenter;
|
||||||
public bool IgnoreHotkeysOnFullscreen { get; set; }
|
public bool IgnoreHotkeysOnFullscreen { get; set; }
|
||||||
|
|
||||||
public HttpProxy Proxy { get; set; } = new HttpProxy();
|
public HttpProxy Proxy { get; set; } = new HttpProxy();
|
||||||
|
|
@ -225,4 +225,12 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
||||||
Light,
|
Light,
|
||||||
Dark
|
Dark
|
||||||
}
|
}
|
||||||
|
public enum SearchWindowPositions
|
||||||
|
{
|
||||||
|
RememberLastLaunchLocation,
|
||||||
|
MouseScreenCenter,
|
||||||
|
MouseScreenCenterTop,
|
||||||
|
MouseScreenLeftTop,
|
||||||
|
MouseScreenRightTop
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Moq" Version="4.16.1" />
|
<PackageReference Include="Moq" Version="4.16.1" />
|
||||||
<PackageReference Include="nunit" Version="3.13.2" />
|
<PackageReference Include="nunit" Version="3.13.2" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0">
|
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
|
||||||
<PackageReference Include="Fody" Version="6.5.4">
|
<PackageReference Include="Fody" Version="6.5.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
|
@ -114,4 +115,14 @@
|
||||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||||
<Exec Command="taskkill /f /fi "IMAGENAME eq Flow.Launcher.exe"" />
|
<Exec Command="taskkill /f /fi "IMAGENAME eq Flow.Launcher.exe"" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="RemoveDuplicateAnalyzers" BeforeTargets="CoreCompile">
|
||||||
|
<!-- Work around https://github.com/dotnet/wpf/issues/6792 -->
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<FilteredAnalyzer Include="@(Analyzer->Distinct())" />
|
||||||
|
<Analyzer Remove="@(Analyzer)" />
|
||||||
|
<Analyzer Include="@(FilteredAnalyzer)" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.2 KiB |
|
|
@ -23,6 +23,8 @@
|
||||||
<system:String x:Key="textTitle">Text</system:String>
|
<system:String x:Key="textTitle">Text</system:String>
|
||||||
<system:String x:Key="GameMode">Game Mode</system:String>
|
<system:String x:Key="GameMode">Game Mode</system:String>
|
||||||
<system:String x:Key="GameModeToolTip">Suspend the use of Hotkeys.</system:String>
|
<system:String x:Key="GameModeToolTip">Suspend the use of Hotkeys.</system:String>
|
||||||
|
<system:String x:Key="PositionReset">Position Reset</system:String>
|
||||||
|
<system:String x:Key="PositionResetToolTip">Reset search window position</system:String>
|
||||||
|
|
||||||
<!-- Setting General -->
|
<!-- Setting General -->
|
||||||
<system:String x:Key="flowlauncher_settings">Flow Launcher Settings</system:String>
|
<system:String x:Key="flowlauncher_settings">Flow Launcher Settings</system:String>
|
||||||
|
|
@ -33,7 +35,13 @@
|
||||||
<system:String x:Key="setAutoStartFailed">Error setting launch on startup</system:String>
|
<system:String x:Key="setAutoStartFailed">Error setting launch on startup</system:String>
|
||||||
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Hide Flow Launcher when focus is lost</system:String>
|
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Hide Flow Launcher when focus is lost</system:String>
|
||||||
<system:String x:Key="dontPromptUpdateMsg">Do not show new version notifications</system:String>
|
<system:String x:Key="dontPromptUpdateMsg">Do not show new version notifications</system:String>
|
||||||
|
<system:String x:Key="SearchWindowPosition">Search Window Position</system:String>
|
||||||
<system:String x:Key="rememberLastLocation">Remember last launch location</system:String>
|
<system:String x:Key="rememberLastLocation">Remember last launch location</system:String>
|
||||||
|
<system:String x:Key="SearchWindowPositionRememberLastLaunchLocation">Remember Last Location</system:String>
|
||||||
|
<system:String x:Key="SearchWindowPositionMouseScreenCenter">Mouse Focused Screen - Center</system:String>
|
||||||
|
<system:String x:Key="SearchWindowPositionMouseScreenCenterTop">Mouse Focused Screen - Center Top</system:String>
|
||||||
|
<system:String x:Key="SearchWindowPositionMouseScreenLeftTop">Mouse Focused Screen - Left Top</system:String>
|
||||||
|
<system:String x:Key="SearchWindowPositionMouseScreenRightTop">Mouse Focused Screen - Right Top</system:String>
|
||||||
<system:String x:Key="language">Language</system:String>
|
<system:String x:Key="language">Language</system:String>
|
||||||
<system:String x:Key="lastQueryMode">Last Query Style</system:String>
|
<system:String x:Key="lastQueryMode">Last Query Style</system:String>
|
||||||
<system:String x:Key="lastQueryModeToolTip">Show/Hide previous results when Flow Launcher is reactivated.</system:String>
|
<system:String x:Key="lastQueryModeToolTip">Show/Hide previous results when Flow Launcher is reactivated.</system:String>
|
||||||
|
|
@ -41,6 +49,7 @@
|
||||||
<system:String x:Key="LastQuerySelected">Select last Query</system:String>
|
<system:String x:Key="LastQuerySelected">Select last Query</system:String>
|
||||||
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
|
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
|
||||||
<system:String x:Key="maxShowResults">Maximum results shown</system:String>
|
<system:String x:Key="maxShowResults">Maximum results shown</system:String>
|
||||||
|
<system:String x:Key="maxShowResultsToolTip">You can also quickly adjust this by using CTRL+Plus and CTRL+Minus.</system:String>
|
||||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignore hotkeys in fullscreen mode</system:String>
|
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignore hotkeys in fullscreen mode</system:String>
|
||||||
<system:String x:Key="ignoreHotkeysOnFullscreenToolTip">Disable Flow Launcher activation when a full screen application is active (Recommended for games).</system:String>
|
<system:String x:Key="ignoreHotkeysOnFullscreenToolTip">Disable Flow Launcher activation when a full screen application is active (Recommended for games).</system:String>
|
||||||
<system:String x:Key="defaultFileManager">Default File Manager</system:String>
|
<system:String x:Key="defaultFileManager">Default File Manager</system:String>
|
||||||
|
|
@ -131,6 +140,7 @@
|
||||||
<system:String x:Key="queryWindowShadowEffect">Query window shadow effect</system:String>
|
<system:String x:Key="queryWindowShadowEffect">Query window shadow effect</system:String>
|
||||||
<system:String x:Key="shadowEffectCPUUsage">Shadow effect has a substantial usage of GPU. Not recommended if your computer performance is limited.</system:String>
|
<system:String x:Key="shadowEffectCPUUsage">Shadow effect has a substantial usage of GPU. Not recommended if your computer performance is limited.</system:String>
|
||||||
<system:String x:Key="windowWidthSize">Window Width Size</system:String>
|
<system:String x:Key="windowWidthSize">Window Width Size</system:String>
|
||||||
|
<system:String x:Key="windowWidthSizeToolTip">You can also quickly adjust this by using Ctrl+[ and Ctrl+].</system:String>
|
||||||
<system:String x:Key="useGlyphUI">Use Segoe Fluent Icons</system:String>
|
<system:String x:Key="useGlyphUI">Use Segoe Fluent Icons</system:String>
|
||||||
<system:String x:Key="useGlyphUIEffect">Use Segoe Fluent Icons for query results where supported</system:String>
|
<system:String x:Key="useGlyphUIEffect">Use Segoe Fluent Icons for query results where supported</system:String>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,22 @@
|
||||||
Modifiers="Ctrl" />
|
Modifiers="Ctrl" />
|
||||||
<KeyBinding Key="Right" Command="{Binding LoadContextMenuCommand}" />
|
<KeyBinding Key="Right" Command="{Binding LoadContextMenuCommand}" />
|
||||||
<KeyBinding Key="Left" Command="{Binding EscCommand}" />
|
<KeyBinding Key="Left" Command="{Binding EscCommand}" />
|
||||||
|
<KeyBinding
|
||||||
|
Key="OemCloseBrackets"
|
||||||
|
Command="{Binding IncreaseWidthCommand}"
|
||||||
|
Modifiers="Control" />
|
||||||
|
<KeyBinding
|
||||||
|
Key="OemOpenBrackets"
|
||||||
|
Command="{Binding DecreaseWidthCommand}"
|
||||||
|
Modifiers="Control" />
|
||||||
|
<KeyBinding
|
||||||
|
Key="OemPlus"
|
||||||
|
Command="{Binding IncreaseMaxResultCommand}"
|
||||||
|
Modifiers="Control" />
|
||||||
|
<KeyBinding
|
||||||
|
Key="OemMinus"
|
||||||
|
Command="{Binding DecreaseMaxResultCommand}"
|
||||||
|
Modifiers="Control" />
|
||||||
<KeyBinding
|
<KeyBinding
|
||||||
Key="H"
|
Key="H"
|
||||||
Command="{Binding LoadHistoryCommand}"
|
Command="{Binding LoadHistoryCommand}"
|
||||||
|
|
@ -177,9 +193,9 @@
|
||||||
AllowDrop="True"
|
AllowDrop="True"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
PreviewDragOver="OnPreviewDragOver"
|
PreviewDragOver="OnPreviewDragOver"
|
||||||
|
PreviewKeyUp="QueryTextBox_KeyUp"
|
||||||
Style="{DynamicResource QueryBoxStyle}"
|
Style="{DynamicResource QueryBoxStyle}"
|
||||||
Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
PreviewKeyUp="QueryTextBox_KeyUp"
|
|
||||||
Visibility="Visible">
|
Visibility="Visible">
|
||||||
<TextBox.CommandBindings>
|
<TextBox.CommandBindings>
|
||||||
<CommandBinding Command="ApplicationCommands.Copy" Executed="OnCopy" />
|
<CommandBinding Command="ApplicationCommands.Copy" Executed="OnCopy" />
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ namespace Flow.Launcher
|
||||||
InitializeColorScheme();
|
InitializeColorScheme();
|
||||||
WindowsInteropHelper.DisableControlBox(this);
|
WindowsInteropHelper.DisableControlBox(this);
|
||||||
InitProgressbarAnimation();
|
InitProgressbarAnimation();
|
||||||
|
InitializePosition();
|
||||||
// since the default main window visibility is visible
|
// since the default main window visibility is visible
|
||||||
// so we need set focus during startup
|
// so we need set focus during startup
|
||||||
QueryTextBox.Focus();
|
QueryTextBox.Focus();
|
||||||
|
|
@ -108,7 +109,6 @@ namespace Flow.Launcher
|
||||||
animationSound.Position = TimeSpan.Zero;
|
animationSound.Position = TimeSpan.Zero;
|
||||||
animationSound.Play();
|
animationSound.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdatePosition();
|
UpdatePosition();
|
||||||
Activate();
|
Activate();
|
||||||
QueryTextBox.Focus();
|
QueryTextBox.Focus();
|
||||||
|
|
@ -161,6 +161,7 @@ namespace Flow.Launcher
|
||||||
_viewModel.QueryTextCursorMovedToEnd = false;
|
_viewModel.QueryTextCursorMovedToEnd = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
_settings.PropertyChanged += (o, e) =>
|
_settings.PropertyChanged += (o, e) =>
|
||||||
|
|
@ -176,21 +177,40 @@ namespace Flow.Launcher
|
||||||
case nameof(Settings.Hotkey):
|
case nameof(Settings.Hotkey):
|
||||||
UpdateNotifyIconText();
|
UpdateNotifyIconText();
|
||||||
break;
|
break;
|
||||||
|
case nameof(Settings.WindowLeft):
|
||||||
|
Left = _settings.WindowLeft;
|
||||||
|
break;
|
||||||
|
case nameof(Settings.WindowTop):
|
||||||
|
Top = _settings.WindowTop;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializePosition()
|
private void InitializePosition()
|
||||||
{
|
{
|
||||||
if (_settings.RememberLastLaunchLocation)
|
switch (_settings.SearchWindowPosition)
|
||||||
{
|
{
|
||||||
Top = _settings.WindowTop;
|
case SearchWindowPositions.RememberLastLaunchLocation:
|
||||||
Left = _settings.WindowLeft;
|
Top = _settings.WindowTop;
|
||||||
}
|
Left = _settings.WindowLeft;
|
||||||
else
|
break;
|
||||||
{
|
case SearchWindowPositions.MouseScreenCenter:
|
||||||
Left = WindowLeft();
|
Left = HorizonCenter();
|
||||||
Top = WindowTop();
|
Top = VerticalCenter();
|
||||||
|
break;
|
||||||
|
case SearchWindowPositions.MouseScreenCenterTop:
|
||||||
|
Left = HorizonCenter();
|
||||||
|
Top = 10;
|
||||||
|
break;
|
||||||
|
case SearchWindowPositions.MouseScreenLeftTop:
|
||||||
|
Left = 10;
|
||||||
|
Top = 10;
|
||||||
|
break;
|
||||||
|
case SearchWindowPositions.MouseScreenRightTop:
|
||||||
|
Left = HorizonRight();
|
||||||
|
Top = 10;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -199,8 +219,9 @@ namespace Flow.Launcher
|
||||||
var menu = contextMenu;
|
var menu = contextMenu;
|
||||||
((MenuItem)menu.Items[1]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" + _settings.Hotkey + ")";
|
((MenuItem)menu.Items[1]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" + _settings.Hotkey + ")";
|
||||||
((MenuItem)menu.Items[2]).Header = InternationalizationManager.Instance.GetTranslation("GameMode");
|
((MenuItem)menu.Items[2]).Header = InternationalizationManager.Instance.GetTranslation("GameMode");
|
||||||
((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings");
|
((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("PositionReset");
|
||||||
((MenuItem)menu.Items[4]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit");
|
((MenuItem)menu.Items[4]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings");
|
||||||
|
((MenuItem)menu.Items[5]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeNotifyIcon()
|
private void InitializeNotifyIcon()
|
||||||
|
|
@ -226,6 +247,10 @@ namespace Flow.Launcher
|
||||||
{
|
{
|
||||||
Header = InternationalizationManager.Instance.GetTranslation("GameMode")
|
Header = InternationalizationManager.Instance.GetTranslation("GameMode")
|
||||||
};
|
};
|
||||||
|
var positionreset = new MenuItem
|
||||||
|
{
|
||||||
|
Header = InternationalizationManager.Instance.GetTranslation("PositionReset")
|
||||||
|
};
|
||||||
var settings = new MenuItem
|
var settings = new MenuItem
|
||||||
{
|
{
|
||||||
Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings")
|
Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings")
|
||||||
|
|
@ -237,12 +262,15 @@ namespace Flow.Launcher
|
||||||
|
|
||||||
open.Click += (o, e) => _viewModel.ToggleFlowLauncher();
|
open.Click += (o, e) => _viewModel.ToggleFlowLauncher();
|
||||||
gamemode.Click += (o, e) => ToggleGameMode();
|
gamemode.Click += (o, e) => ToggleGameMode();
|
||||||
|
positionreset.Click += (o, e) => PositionReset();
|
||||||
settings.Click += (o, e) => App.API.OpenSettingDialog();
|
settings.Click += (o, e) => App.API.OpenSettingDialog();
|
||||||
exit.Click += (o, e) => Close();
|
exit.Click += (o, e) => Close();
|
||||||
contextMenu.Items.Add(header);
|
contextMenu.Items.Add(header);
|
||||||
contextMenu.Items.Add(open);
|
contextMenu.Items.Add(open);
|
||||||
gamemode.ToolTip = InternationalizationManager.Instance.GetTranslation("GameModeToolTip");
|
gamemode.ToolTip = InternationalizationManager.Instance.GetTranslation("GameModeToolTip");
|
||||||
|
positionreset.ToolTip = InternationalizationManager.Instance.GetTranslation("PositionResetToolTip");
|
||||||
contextMenu.Items.Add(gamemode);
|
contextMenu.Items.Add(gamemode);
|
||||||
|
contextMenu.Items.Add(positionreset);
|
||||||
contextMenu.Items.Add(settings);
|
contextMenu.Items.Add(settings);
|
||||||
contextMenu.Items.Add(exit);
|
contextMenu.Items.Add(exit);
|
||||||
|
|
||||||
|
|
@ -289,10 +317,17 @@ namespace Flow.Launcher
|
||||||
_viewModel.GameModeStatus = true;
|
_viewModel.GameModeStatus = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private async void PositionReset()
|
||||||
|
{
|
||||||
|
_viewModel.Show();
|
||||||
|
await Task.Delay(300); // If don't give a time, Positioning will be weird.
|
||||||
|
Left = HorizonCenter();
|
||||||
|
Top = VerticalCenter();
|
||||||
|
}
|
||||||
private void InitProgressbarAnimation()
|
private void InitProgressbarAnimation()
|
||||||
{
|
{
|
||||||
var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 150,
|
var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 150,
|
||||||
new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
|
new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
|
||||||
var da1 = new DoubleAnimation(ProgressBar.X1, ActualWidth + 50, new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
|
var da1 = new DoubleAnimation(ProgressBar.X1, ActualWidth + 50, new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
|
||||||
Storyboard.SetTargetProperty(da, new PropertyPath("(Line.X2)"));
|
Storyboard.SetTargetProperty(da, new PropertyPath("(Line.X2)"));
|
||||||
Storyboard.SetTargetProperty(da1, new PropertyPath("(Line.X1)"));
|
Storyboard.SetTargetProperty(da1, new PropertyPath("(Line.X1)"));
|
||||||
|
|
@ -396,6 +431,8 @@ namespace Flow.Launcher
|
||||||
|
|
||||||
private async void OnDeactivated(object sender, EventArgs e)
|
private async void OnDeactivated(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
_settings.WindowLeft = Left;
|
||||||
|
_settings.WindowTop = Top;
|
||||||
//This condition stops extra hide call when animator is on,
|
//This condition stops extra hide call when animator is on,
|
||||||
// which causes the toggling to occasional hide instead of show.
|
// which causes the toggling to occasional hide instead of show.
|
||||||
if (_viewModel.MainWindowVisibilityStatus)
|
if (_viewModel.MainWindowVisibilityStatus)
|
||||||
|
|
@ -417,24 +454,14 @@ namespace Flow.Launcher
|
||||||
{
|
{
|
||||||
if (_animating)
|
if (_animating)
|
||||||
return;
|
return;
|
||||||
|
InitializePosition();
|
||||||
if (_settings.RememberLastLaunchLocation)
|
|
||||||
{
|
|
||||||
Left = _settings.WindowLeft;
|
|
||||||
Top = _settings.WindowTop;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Left = WindowLeft();
|
|
||||||
Top = WindowTop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLocationChanged(object sender, EventArgs e)
|
private void OnLocationChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_animating)
|
if (_animating)
|
||||||
return;
|
return;
|
||||||
if (_settings.RememberLastLaunchLocation)
|
if (_settings.SearchWindowPosition == SearchWindowPositions.RememberLastLaunchLocation)
|
||||||
{
|
{
|
||||||
_settings.WindowLeft = Left;
|
_settings.WindowLeft = Left;
|
||||||
_settings.WindowTop = Top;
|
_settings.WindowTop = Top;
|
||||||
|
|
@ -453,8 +480,8 @@ namespace Flow.Launcher
|
||||||
_viewModel.Show();
|
_viewModel.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double WindowLeft()
|
public double HorizonCenter()
|
||||||
{
|
{
|
||||||
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
|
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
|
||||||
var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.X, 0);
|
var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.X, 0);
|
||||||
|
|
@ -463,7 +490,7 @@ namespace Flow.Launcher
|
||||||
return left;
|
return left;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double WindowTop()
|
public double VerticalCenter()
|
||||||
{
|
{
|
||||||
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
|
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
|
||||||
var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Y);
|
var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Y);
|
||||||
|
|
@ -472,12 +499,22 @@ namespace Flow.Launcher
|
||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double HorizonRight()
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register up and down key
|
/// Register up and down key
|
||||||
/// todo: any way to put this in xaml ?
|
/// todo: any way to put this in xaml ?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnKeyDown(object sender, KeyEventArgs e)
|
private void OnKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
|
var specialKeyState = GlobalHotkey.CheckModifiers();
|
||||||
switch (e.Key)
|
switch (e.Key)
|
||||||
{
|
{
|
||||||
case Key.Down:
|
case Key.Down:
|
||||||
|
|
@ -512,8 +549,13 @@ namespace Flow.Launcher
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Key.F12:
|
||||||
|
if (specialKeyState.CtrlPressed)
|
||||||
|
{
|
||||||
|
ToggleGameMode();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case Key.Back:
|
case Key.Back:
|
||||||
var specialKeyState = GlobalHotkey.CheckModifiers();
|
|
||||||
if (specialKeyState.CtrlPressed)
|
if (specialKeyState.CtrlPressed)
|
||||||
{
|
{
|
||||||
if (_viewModel.SelectedIsFromQueryResults()
|
if (_viewModel.SelectedIsFromQueryResults()
|
||||||
|
|
|
||||||
|
|
@ -685,12 +685,25 @@
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Border Style="{DynamicResource SettingGroupBox}">
|
<Border Margin="0,30,0,0" Style="{DynamicResource SettingGroupBox}">
|
||||||
<ItemsControl Style="{StaticResource SettingGrid}">
|
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||||
<StackPanel Style="{StaticResource TextPanel}">
|
<StackPanel Style="{StaticResource TextPanel}">
|
||||||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource rememberLastLocation}" />
|
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource SearchWindowPosition}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<CheckBox IsChecked="{Binding Settings.RememberLastLaunchLocation}" Style="{DynamicResource SideControlCheckBox}" />
|
<ComboBox
|
||||||
|
x:Name="SearchWindowPosition"
|
||||||
|
Grid.Column="2"
|
||||||
|
MinWidth="220"
|
||||||
|
Margin="0,0,18,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
DisplayMemberPath="Display"
|
||||||
|
FontSize="14"
|
||||||
|
ItemsSource="{Binding SearchWindowPositions}"
|
||||||
|
SelectedValue="{Binding Settings.SearchWindowPosition}"
|
||||||
|
SelectedValuePath="Value" />
|
||||||
|
<TextBlock Style="{StaticResource Glyph}">
|
||||||
|

|
||||||
|
</TextBlock>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
|
@ -818,11 +831,13 @@
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
Style="{DynamicResource SettingGroupBox}">
|
Style="{DynamicResource SettingGroupBox}">
|
||||||
<ItemsControl Style="{StaticResource SettingGrid}">
|
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||||
<TextBlock
|
<StackPanel Grid.Column="1">
|
||||||
Grid.Column="1"
|
<TextBlock
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{DynamicResource SettingTitleLabel}"
|
Style="{DynamicResource SettingTitleLabel}"
|
||||||
Text="{DynamicResource maxShowResults}" />
|
Text="{DynamicResource maxShowResults}" />
|
||||||
|
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource maxShowResultsToolTip}" />
|
||||||
|
</StackPanel>
|
||||||
<ComboBox
|
<ComboBox
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Width="100"
|
Width="100"
|
||||||
|
|
@ -1815,6 +1830,7 @@
|
||||||
<ItemsControl Style="{StaticResource SettingGrid}">
|
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||||
<StackPanel Style="{StaticResource TextPanel}">
|
<StackPanel Style="{StaticResource TextPanel}">
|
||||||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource windowWidthSize}" />
|
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource windowWidthSize}" />
|
||||||
|
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource windowWidthSizeToolTip}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
|
@ -1828,6 +1844,7 @@
|
||||||
Name="WindowWidthValue"
|
Name="WindowWidthValue"
|
||||||
Width="300"
|
Width="300"
|
||||||
Margin="0,0,18,0"
|
Margin="0,0,18,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
IsMoveToPointEnabled="True"
|
IsMoveToPointEnabled="True"
|
||||||
IsSnapToTickEnabled="True"
|
IsSnapToTickEnabled="True"
|
||||||
Maximum="1920"
|
Maximum="1920"
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,11 @@ using System.Threading.Channels;
|
||||||
using ISavable = Flow.Launcher.Plugin.ISavable;
|
using ISavable = Flow.Launcher.Plugin.ISavable;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
|
||||||
namespace Flow.Launcher.ViewModel
|
namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
public class MainViewModel : BaseModel, ISavable
|
public partial class MainViewModel : BaseModel, ISavable
|
||||||
{
|
{
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
|
|
@ -82,6 +83,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
_selectedResults = Results;
|
_selectedResults = Results;
|
||||||
|
|
||||||
InitializeKeyCommands();
|
InitializeKeyCommands();
|
||||||
|
|
||||||
RegisterViewUpdate();
|
RegisterViewUpdate();
|
||||||
RegisterResultsUpdatedEvent();
|
RegisterResultsUpdatedEvent();
|
||||||
|
|
||||||
|
|
@ -154,6 +156,8 @@ namespace Flow.Launcher.ViewModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void InitializeKeyCommands()
|
private void InitializeKeyCommands()
|
||||||
{
|
{
|
||||||
EscCommand = new RelayCommand(_ =>
|
EscCommand = new RelayCommand(_ =>
|
||||||
|
|
@ -307,7 +311,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
Notification.Show(
|
Notification.Show(
|
||||||
InternationalizationManager.Instance.GetTranslation("success"),
|
InternationalizationManager.Instance.GetTranslation("success"),
|
||||||
InternationalizationManager.Instance.GetTranslation("completedSuccessfully")
|
InternationalizationManager.Instance.GetTranslation("completedSuccessfully")
|
||||||
);
|
);
|
||||||
}), TaskScheduler.Default)
|
}), TaskScheduler.Default)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
});
|
});
|
||||||
|
|
@ -318,9 +322,9 @@ namespace Flow.Launcher.ViewModel
|
||||||
#region ViewModel Properties
|
#region ViewModel Properties
|
||||||
|
|
||||||
public ResultsViewModel Results { get; private set; }
|
public ResultsViewModel Results { get; private set; }
|
||||||
|
|
||||||
public ResultsViewModel ContextMenu { get; private set; }
|
public ResultsViewModel ContextMenu { get; private set; }
|
||||||
|
|
||||||
public ResultsViewModel History { get; private set; }
|
public ResultsViewModel History { get; private set; }
|
||||||
|
|
||||||
public bool GameModeStatus { get; set; }
|
public bool GameModeStatus { get; set; }
|
||||||
|
|
@ -336,6 +340,55 @@ namespace Flow.Launcher.ViewModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void IncreaseWidth()
|
||||||
|
{
|
||||||
|
if (MainWindowWidth + 100 > 1920 || _settings.WindowSize == 1920)
|
||||||
|
{
|
||||||
|
_settings.WindowSize = 1920;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_settings.WindowSize += 100;
|
||||||
|
_settings.WindowLeft -= 50;
|
||||||
|
}
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void DecreaseWidth()
|
||||||
|
{
|
||||||
|
if (MainWindowWidth - 100 < 400 || _settings.WindowSize == 400)
|
||||||
|
{
|
||||||
|
_settings.WindowSize = 400;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_settings.WindowLeft += 50;
|
||||||
|
_settings.WindowSize -= 100;
|
||||||
|
}
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void IncreaseMaxResult()
|
||||||
|
{
|
||||||
|
if (_settings.MaxResultsToShow == 17)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_settings.MaxResultsToShow += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void DecreaseMaxResult()
|
||||||
|
{
|
||||||
|
if (_settings.MaxResultsToShow == 2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_settings.MaxResultsToShow -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// we need move cursor to end when we manually changed query
|
/// we need move cursor to end when we manually changed query
|
||||||
/// but we don't want to move cursor to end when query is updated from TextBox
|
/// but we don't want to move cursor to end when query is updated from TextBox
|
||||||
|
|
@ -411,7 +464,11 @@ namespace Flow.Launcher.ViewModel
|
||||||
|
|
||||||
public Visibility SearchIconVisibility { get; set; }
|
public Visibility SearchIconVisibility { get; set; }
|
||||||
|
|
||||||
public double MainWindowWidth => _settings.WindowSize;
|
public double MainWindowWidth
|
||||||
|
{
|
||||||
|
get => _settings.WindowSize;
|
||||||
|
set => _settings.WindowSize = value;
|
||||||
|
}
|
||||||
|
|
||||||
public string PluginIconPath { get; set; } = null;
|
public string PluginIconPath { get; set; } = null;
|
||||||
|
|
||||||
|
|
@ -592,7 +649,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
PluginIconPath = null;
|
PluginIconPath = null;
|
||||||
SearchIconVisibility = Visibility.Visible;
|
SearchIconVisibility = Visibility.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (query.ActionKeyword == Plugin.Query.GlobalPluginWildcardSign)
|
if (query.ActionKeyword == Plugin.Query.GlobalPluginWildcardSign)
|
||||||
{
|
{
|
||||||
|
|
@ -903,18 +960,18 @@ namespace Flow.Launcher.ViewModel
|
||||||
|
|
||||||
Clipboard.SetFileDropList(paths);
|
Clipboard.SetFileDropList(paths);
|
||||||
App.API.ShowMsg(
|
App.API.ShowMsg(
|
||||||
App.API.GetTranslation("copy")
|
App.API.GetTranslation("copy")
|
||||||
+" "
|
+ " "
|
||||||
+ (isFile? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle")),
|
+ (isFile ? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle")),
|
||||||
App.API.GetTranslation("completedSuccessfully"));
|
App.API.GetTranslation("completedSuccessfully"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Clipboard.SetDataObject(copyText.ToString());
|
Clipboard.SetDataObject(copyText.ToString());
|
||||||
App.API.ShowMsg(
|
App.API.ShowMsg(
|
||||||
App.API.GetTranslation("copy")
|
App.API.GetTranslation("copy")
|
||||||
+ " "
|
+ " "
|
||||||
+ App.API.GetTranslation("textTitle"),
|
+ App.API.GetTranslation("textTitle"),
|
||||||
App.API.GetTranslation("completedSuccessfully"));
|
App.API.GetTranslation("completedSuccessfully"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,9 @@ namespace Flow.Launcher.ViewModel
|
||||||
case nameof(Settings.ActivateTimes):
|
case nameof(Settings.ActivateTimes):
|
||||||
OnPropertyChanged(nameof(ActivatedTimes));
|
OnPropertyChanged(nameof(ActivatedTimes));
|
||||||
break;
|
break;
|
||||||
|
case nameof(Settings.WindowSize):
|
||||||
|
OnPropertyChanged(nameof(WindowWidthSize));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -382,6 +385,33 @@ namespace Flow.Launcher.ViewModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class SearchWindowPosition
|
||||||
|
{
|
||||||
|
public string Display { get; set; }
|
||||||
|
public SearchWindowPositions Value { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SearchWindowPosition> SearchWindowPositions
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
List<SearchWindowPosition> modes = new List<SearchWindowPosition>();
|
||||||
|
var enums = (SearchWindowPositions[])Enum.GetValues(typeof(SearchWindowPositions));
|
||||||
|
foreach (var e in enums)
|
||||||
|
{
|
||||||
|
var key = $"SearchWindowPosition{e}";
|
||||||
|
var display = _translater.GetTranslation(key);
|
||||||
|
var m = new SearchWindowPosition { Display = display, Value = e, };
|
||||||
|
modes.Add(m);
|
||||||
|
}
|
||||||
|
return modes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public double WindowWidthSize
|
public double WindowWidthSize
|
||||||
{
|
{
|
||||||
get => Settings.WindowSize;
|
get => Settings.WindowSize;
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Mages" Version="2.0.0" />
|
<PackageReference Include="Mages" Version="2.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2 KiB |
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"sdk": {
|
"sdk": {
|
||||||
"version": "6.0.100",
|
"version": "6.0.*",
|
||||||
"rollForward": "latestFeature"
|
"rollForward": "latestPatch"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue