Merge branch 'dev' into handle-icon-urls

This commit is contained in:
Kevin Zhang 2022-10-30 14:50:31 -05:00 committed by GitHub
commit ff2ebc87a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 555 additions and 152 deletions

View file

@ -1,4 +1,6 @@
namespace Flow.Launcher.Core.ExternalPlugins
using System;
namespace Flow.Launcher.Core.ExternalPlugins
{
public record UserPlugin
{
@ -12,5 +14,8 @@
public string UrlDownload { get; set; }
public string UrlSourceCode { get; set; }
public string IcoPath { get; set; }
public DateTime LatestReleaseDate { get; set; }
public DateTime DateAdded { get; set; }
}
}

View file

@ -283,6 +283,7 @@ namespace Flow.Launcher.Infrastructure.Image
image.BeginInit();
image.CacheOption = BitmapCacheOption.OnLoad;
image.UriSource = new Uri(path);
image.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
image.EndInit();
return image;
}

View file

@ -199,7 +199,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
}
public bool LeaveCmdOpen { get; set; }
public bool HideWhenDeactive { get; set; } = true;
public bool RememberLastLaunchLocation { get; set; }
public SearchWindowPositions SearchWindowPosition { get; set; } = SearchWindowPositions.MouseScreenCenter;
public bool IgnoreHotkeysOnFullscreen { get; set; }
public HttpProxy Proxy { get; set; } = new HttpProxy();
@ -225,4 +225,12 @@ namespace Flow.Launcher.Infrastructure.UserSettings
Light,
Dark
}
public enum SearchWindowPositions
{
RememberLastLaunchLocation,
MouseScreenCenter,
MouseScreenCenterTop,
MouseScreenLeftTop,
MouseScreenRightTop
}
}

View file

@ -50,7 +50,7 @@
<ItemGroup>
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="nunit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0">
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View file

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace Flow.Launcher.Converters
{
public class BoolToVisibilityConverter : IValueConverter
{
public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture)
{
if (parameter != null)
{
if (value is true)
{
return Visibility.Collapsed;
}
else
{
return Visibility.Visible;
}
}
else {
if (value is true)
{
return Visibility.Visible;
}
else {
return Visibility.Collapsed;
}
}
}
public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException();
}
}

View file

@ -0,0 +1,32 @@
using System;
using System.Globalization;
using System.Windows.Data;
using Flow.Launcher.Core.Resource;
using Flow.Launcher.ViewModel;
namespace Flow.Launcher.Converters
{
public class TextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var ID = value.ToString();
switch(ID)
{
case PluginStoreItemViewModel.NewRelease:
return InternationalizationManager.Instance.GetTranslation("pluginStore_NewRelease");
case PluginStoreItemViewModel.RecentlyUpdated:
return InternationalizationManager.Instance.GetTranslation("pluginStore_RecentlyUpdated");
case PluginStoreItemViewModel.None:
return InternationalizationManager.Instance.GetTranslation("pluginStore_None");
case PluginStoreItemViewModel.Installed:
return InternationalizationManager.Instance.GetTranslation("pluginStore_Installed");
default:
return ID;
}
}
public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException();
}
}

View file

@ -83,6 +83,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
<PackageReference Include="Fody" Version="6.5.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@ -114,4 +115,14 @@
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="taskkill /f /fi &quot;IMAGENAME eq Flow.Launcher.exe&quot;" />
</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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">Søgetid:</system:String>
<system:String x:Key="plugin_query_version">| Version</system:String>
<system:String x:Key="plugin_query_web">Website</system:String>
<system:String x:Key="plugin_uninstall">Uninstall</system:String>
<system:String x:Key="uninstallbtn">Uninstall</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Plugin Store</system:String>
<system:String x:Key="refresh">Refresh</system:String>
<system:String x:Key="install">Install</system:String>
<system:String x:Key="installbtn">Install</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Tema</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">Abfragezeit:</system:String>
<system:String x:Key="plugin_query_version">Version</system:String>
<system:String x:Key="plugin_query_web">Webseite</system:String>
<system:String x:Key="plugin_uninstall">Deinstallieren</system:String>
<system:String x:Key="uninstallbtn">Deinstallieren</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Erweiterungen laden</system:String>
<system:String x:Key="refresh">Aktualisieren</system:String>
<system:String x:Key="install">Installieren</system:String>
<system:String x:Key="installbtn">Installieren</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Design</system:String>

View file

@ -23,6 +23,8 @@
<system:String x:Key="textTitle">Text</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="PositionReset">Position Reset</system:String>
<system:String x:Key="PositionResetToolTip">Reset search window position</system:String>
<!-- Setting General -->
<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="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="SearchWindowPosition">Search Window Position</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="lastQueryMode">Last Query Style</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="LastQueryEmpty">Empty last Query</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="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>
@ -83,13 +92,24 @@
<system:String x:Key="plugin_query_time">Query time:</system:String>
<system:String x:Key="plugin_query_version">| Version</system:String>
<system:String x:Key="plugin_query_web">Website</system:String>
<system:String x:Key="plugin_uninstall">Uninstall</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Plugin Store</system:String>
<system:String x:Key="pluginStore_NewRelease">New Release</system:String>
<system:String x:Key="pluginStore_RecentlyUpdated">Recently Updated</system:String>
<system:String x:Key="pluginStore_None">Plugins</system:String>
<system:String x:Key="pluginStore_Installed">Installed</system:String>
<system:String x:Key="refresh">Refresh</system:String>
<system:String x:Key="install">Install</system:String>
<system:String x:Key="installbtn">Install</system:String>
<system:String x:Key="uninstallbtn">Uninstall</system:String>
<system:String x:Key="updatebtn">Update</system:String>
<system:String x:Key="LabelInstalledToolTip">Plug-in already installed</system:String>
<system:String x:Key="LabelNew">New Version</system:String>
<system:String x:Key="LabelNewToolTip">This plug-in has been updated within the last 7 days</system:String>
<system:String x:Key="LabelUpdateToolTip">New Update is Available</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Theme</system:String>
@ -131,6 +151,7 @@
<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="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="useGlyphUIEffect">Use Segoe Fluent Icons for query results where supported</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">Tiempo de consulta:</system:String>
<system:String x:Key="plugin_query_version">| Versión</system:String>
<system:String x:Key="plugin_query_web">Sitio web</system:String>
<system:String x:Key="plugin_uninstall">Uninstall</system:String>
<system:String x:Key="uninstallbtn">Uninstall</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Tienda de Plugins</system:String>
<system:String x:Key="refresh">Recargar</system:String>
<system:String x:Key="install">Instalar</system:String>
<system:String x:Key="installbtn">Instalar</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Tema</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">Utilisation :</system:String>
<system:String x:Key="plugin_query_version">| Version</system:String>
<system:String x:Key="plugin_query_web">Website</system:String>
<system:String x:Key="plugin_uninstall">Désinstaller</system:String>
<system:String x:Key="uninstallbtn">Désinstaller</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Plugin Store</system:String>
<system:String x:Key="refresh">Refresh</system:String>
<system:String x:Key="install">Install</system:String>
<system:String x:Key="installbtn">Install</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Thèmes</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">Tempo ricerca:</system:String>
<system:String x:Key="plugin_query_version">| Versione</system:String>
<system:String x:Key="plugin_query_web">Sito Web</system:String>
<system:String x:Key="plugin_uninstall">Disinstalla</system:String>
<system:String x:Key="uninstallbtn">Disinstalla</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Negozio dei Plugin</system:String>
<system:String x:Key="refresh">Aggiorna</system:String>
<system:String x:Key="install">Installa</system:String>
<system:String x:Key="installbtn">Installa</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Tema</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">クエリ時間:</system:String>
<system:String x:Key="plugin_query_version">| バージョン</system:String>
<system:String x:Key="plugin_query_web">ウェブサイト</system:String>
<system:String x:Key="plugin_uninstall">アンインストール</system:String>
<system:String x:Key="uninstallbtn">アンインストール</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">プラグインストア</system:String>
<system:String x:Key="refresh">Refresh</system:String>
<system:String x:Key="install">Install</system:String>
<system:String x:Key="installbtn">Install</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">テーマ</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">쿼리 시간:</system:String>
<system:String x:Key="plugin_query_version">| 버전</system:String>
<system:String x:Key="plugin_query_web">웹사이트</system:String>
<system:String x:Key="plugin_uninstall">제거</system:String>
<system:String x:Key="uninstallbtn">제거</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">플러그인 스토어</system:String>
<system:String x:Key="refresh">새로고침</system:String>
<system:String x:Key="install">설치</system:String>
<system:String x:Key="installbtn">설치</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">테마</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">Query time:</system:String>
<system:String x:Key="plugin_query_version">| Version</system:String>
<system:String x:Key="plugin_query_web">Website</system:String>
<system:String x:Key="plugin_uninstall">Uninstall</system:String>
<system:String x:Key="uninstallbtn">Uninstall</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Plugin Store</system:String>
<system:String x:Key="refresh">Refresh</system:String>
<system:String x:Key="install">Install</system:String>
<system:String x:Key="installbtn">Install</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Theme</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">Query tijd:</system:String>
<system:String x:Key="plugin_query_version">| Versie</system:String>
<system:String x:Key="plugin_query_web">Website</system:String>
<system:String x:Key="plugin_uninstall">Uninstall</system:String>
<system:String x:Key="uninstallbtn">Uninstall</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Plugin Winkel</system:String>
<system:String x:Key="refresh">Vernieuwen</system:String>
<system:String x:Key="install">Installeren</system:String>
<system:String x:Key="installbtn">Installeren</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Thema</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">Czas zapytania:</system:String>
<system:String x:Key="plugin_query_version">| Version</system:String>
<system:String x:Key="plugin_query_web">Website</system:String>
<system:String x:Key="plugin_uninstall">Odinstalowywanie</system:String>
<system:String x:Key="uninstallbtn">Odinstalowywanie</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Plugin Store</system:String>
<system:String x:Key="refresh">Refresh</system:String>
<system:String x:Key="install">Install</system:String>
<system:String x:Key="installbtn">Install</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Skórka</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">Tempo de consulta:</system:String>
<system:String x:Key="plugin_query_version">| Version</system:String>
<system:String x:Key="plugin_query_web">Website</system:String>
<system:String x:Key="plugin_uninstall">Desinstalar</system:String>
<system:String x:Key="uninstallbtn">Desinstalar</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Plugin Store</system:String>
<system:String x:Key="refresh">Refresh</system:String>
<system:String x:Key="install">Install</system:String>
<system:String x:Key="installbtn">Install</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Tema</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">Tempo de consulta:</system:String>
<system:String x:Key="plugin_query_version">| Versão</system:String>
<system:String x:Key="plugin_query_web">Site</system:String>
<system:String x:Key="plugin_uninstall">Desinstalar</system:String>
<system:String x:Key="uninstallbtn">Desinstalar</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Loja de plugins</system:String>
<system:String x:Key="refresh">Recarregar</system:String>
<system:String x:Key="install">Instalar</system:String>
<system:String x:Key="installbtn">Instalar</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Tema</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">Запрос:</system:String>
<system:String x:Key="plugin_query_version">| Version</system:String>
<system:String x:Key="plugin_query_web">Website</system:String>
<system:String x:Key="plugin_uninstall">Удалить</system:String>
<system:String x:Key="uninstallbtn">Удалить</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Plugin Store</system:String>
<system:String x:Key="refresh">Refresh</system:String>
<system:String x:Key="install">Install</system:String>
<system:String x:Key="installbtn">Install</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Тема</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">Trvanie dopytu:</system:String>
<system:String x:Key="plugin_query_version">| Verzia</system:String>
<system:String x:Key="plugin_query_web">Webstránka</system:String>
<system:String x:Key="plugin_uninstall">Odinštalovať</system:String>
<system:String x:Key="uninstallbtn">Odinštalovať</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Repozitár pluginov</system:String>
<system:String x:Key="refresh">Obnoviť</system:String>
<system:String x:Key="install">Inštalovať</system:String>
<system:String x:Key="installbtn">Inštalovať</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Motív</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">Vreme upita:</system:String>
<system:String x:Key="plugin_query_version">| Version</system:String>
<system:String x:Key="plugin_query_web">Website</system:String>
<system:String x:Key="plugin_uninstall">Uninstall</system:String>
<system:String x:Key="uninstallbtn">Uninstall</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Plugin Store</system:String>
<system:String x:Key="refresh">Refresh</system:String>
<system:String x:Key="install">Install</system:String>
<system:String x:Key="installbtn">Install</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Tema</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">Sorgu Süresi:</system:String>
<system:String x:Key="plugin_query_version">Sürüm</system:String>
<system:String x:Key="plugin_query_web">İnternet Sitesi</system:String>
<system:String x:Key="plugin_uninstall">Kaldır</system:String>
<system:String x:Key="uninstallbtn">Kaldır</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Eklenti Mağazası</system:String>
<system:String x:Key="refresh">Yenile</system:String>
<system:String x:Key="install">İndir</system:String>
<system:String x:Key="installbtn">İndir</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Temalar</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">Запит:</system:String>
<system:String x:Key="plugin_query_version">| Версія</system:String>
<system:String x:Key="plugin_query_web">Сайт</system:String>
<system:String x:Key="plugin_uninstall">Uninstall</system:String>
<system:String x:Key="uninstallbtn">Uninstall</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">Магазин плагінів</system:String>
<system:String x:Key="refresh">Оновити</system:String>
<system:String x:Key="install">Встановити</system:String>
<system:String x:Key="installbtn">Встановити</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">Тема</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">查询耗时:</system:String>
<system:String x:Key="plugin_query_version">| 版本</system:String>
<system:String x:Key="plugin_query_web">官方网站</system:String>
<system:String x:Key="plugin_uninstall">卸载</system:String>
<system:String x:Key="uninstallbtn">卸载</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">插件商店</system:String>
<system:String x:Key="refresh">刷新</system:String>
<system:String x:Key="install">安装</system:String>
<system:String x:Key="installbtn">安装</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">主题</system:String>

View file

@ -77,13 +77,13 @@
<system:String x:Key="plugin_query_time">查詢耗時:</system:String>
<system:String x:Key="plugin_query_version">| 版本</system:String>
<system:String x:Key="plugin_query_web">官方網站</system:String>
<system:String x:Key="plugin_uninstall">解除安裝</system:String>
<system:String x:Key="uninstallbtn">解除安裝</system:String>
<!-- Setting Plugin Store -->
<system:String x:Key="pluginStore">外掛商店</system:String>
<system:String x:Key="refresh">重新整理</system:String>
<system:String x:Key="install">安裝</system:String>
<system:String x:Key="installbtn">安裝</system:String>
<!-- Setting Theme -->
<system:String x:Key="theme">主題</system:String>

View file

@ -84,6 +84,22 @@
Modifiers="Ctrl" />
<KeyBinding Key="Right" Command="{Binding LoadContextMenuCommand}" />
<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
Key="H"
Command="{Binding LoadHistoryCommand}"
@ -177,9 +193,9 @@
AllowDrop="True"
Background="Transparent"
PreviewDragOver="OnPreviewDragOver"
PreviewKeyUp="QueryTextBox_KeyUp"
Style="{DynamicResource QueryBoxStyle}"
Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
PreviewKeyUp="QueryTextBox_KeyUp"
Visibility="Visible">
<TextBox.CommandBindings>
<CommandBinding Command="ApplicationCommands.Copy" Executed="OnCopy" />

View file

@ -91,6 +91,7 @@ namespace Flow.Launcher
InitializeColorScheme();
WindowsInteropHelper.DisableControlBox(this);
InitProgressbarAnimation();
InitializePosition();
// since the default main window visibility is visible
// so we need set focus during startup
QueryTextBox.Focus();
@ -108,7 +109,6 @@ namespace Flow.Launcher
animationSound.Position = TimeSpan.Zero;
animationSound.Play();
}
UpdatePosition();
Activate();
QueryTextBox.Focus();
@ -161,6 +161,7 @@ namespace Flow.Launcher
_viewModel.QueryTextCursorMovedToEnd = false;
}
break;
}
};
_settings.PropertyChanged += (o, e) =>
@ -176,21 +177,40 @@ namespace Flow.Launcher
case nameof(Settings.Hotkey):
UpdateNotifyIconText();
break;
case nameof(Settings.WindowLeft):
Left = _settings.WindowLeft;
break;
case nameof(Settings.WindowTop):
Top = _settings.WindowTop;
break;
}
};
}
private void InitializePosition()
{
if (_settings.RememberLastLaunchLocation)
switch (_settings.SearchWindowPosition)
{
Top = _settings.WindowTop;
Left = _settings.WindowLeft;
}
else
{
Left = WindowLeft();
Top = WindowTop();
case SearchWindowPositions.RememberLastLaunchLocation:
Top = _settings.WindowTop;
Left = _settings.WindowLeft;
break;
case SearchWindowPositions.MouseScreenCenter:
Left = HorizonCenter();
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;
((MenuItem)menu.Items[1]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" + _settings.Hotkey + ")";
((MenuItem)menu.Items[2]).Header = InternationalizationManager.Instance.GetTranslation("GameMode");
((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings");
((MenuItem)menu.Items[4]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit");
((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("PositionReset");
((MenuItem)menu.Items[4]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings");
((MenuItem)menu.Items[5]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit");
}
private void InitializeNotifyIcon()
@ -226,6 +247,10 @@ namespace Flow.Launcher
{
Header = InternationalizationManager.Instance.GetTranslation("GameMode")
};
var positionreset = new MenuItem
{
Header = InternationalizationManager.Instance.GetTranslation("PositionReset")
};
var settings = new MenuItem
{
Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings")
@ -237,12 +262,15 @@ namespace Flow.Launcher
open.Click += (o, e) => _viewModel.ToggleFlowLauncher();
gamemode.Click += (o, e) => ToggleGameMode();
positionreset.Click += (o, e) => PositionReset();
settings.Click += (o, e) => App.API.OpenSettingDialog();
exit.Click += (o, e) => Close();
contextMenu.Items.Add(header);
contextMenu.Items.Add(open);
gamemode.ToolTip = InternationalizationManager.Instance.GetTranslation("GameModeToolTip");
positionreset.ToolTip = InternationalizationManager.Instance.GetTranslation("PositionResetToolTip");
contextMenu.Items.Add(gamemode);
contextMenu.Items.Add(positionreset);
contextMenu.Items.Add(settings);
contextMenu.Items.Add(exit);
@ -289,10 +317,17 @@ namespace Flow.Launcher
_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()
{
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)));
Storyboard.SetTargetProperty(da, new PropertyPath("(Line.X2)"));
Storyboard.SetTargetProperty(da1, new PropertyPath("(Line.X1)"));
@ -396,6 +431,8 @@ namespace Flow.Launcher
private async void OnDeactivated(object sender, EventArgs e)
{
_settings.WindowLeft = Left;
_settings.WindowTop = Top;
//This condition stops extra hide call when animator is on,
// which causes the toggling to occasional hide instead of show.
if (_viewModel.MainWindowVisibilityStatus)
@ -417,24 +454,14 @@ namespace Flow.Launcher
{
if (_animating)
return;
if (_settings.RememberLastLaunchLocation)
{
Left = _settings.WindowLeft;
Top = _settings.WindowTop;
}
else
{
Left = WindowLeft();
Top = WindowTop();
}
InitializePosition();
}
private void OnLocationChanged(object sender, EventArgs e)
{
if (_animating)
return;
if (_settings.RememberLastLaunchLocation)
if (_settings.SearchWindowPosition == SearchWindowPositions.RememberLastLaunchLocation)
{
_settings.WindowLeft = Left;
_settings.WindowTop = Top;
@ -453,8 +480,8 @@ namespace Flow.Launcher
_viewModel.Show();
}
}
public double WindowLeft()
public double HorizonCenter()
{
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, screen.WorkingArea.X, 0);
@ -463,7 +490,7 @@ namespace Flow.Launcher
return left;
}
public double WindowTop()
public double VerticalCenter()
{
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
var dip1 = WindowsInteropHelper.TransformPixelsToDIP(this, 0, screen.WorkingArea.Y);
@ -472,12 +499,22 @@ namespace Flow.Launcher
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>
/// Register up and down key
/// todo: any way to put this in xaml ?
/// </summary>
private void OnKeyDown(object sender, KeyEventArgs e)
{
var specialKeyState = GlobalHotkey.CheckModifiers();
switch (e.Key)
{
case Key.Down:
@ -512,8 +549,13 @@ namespace Flow.Launcher
e.Handled = true;
}
break;
case Key.F12:
if (specialKeyState.CtrlPressed)
{
ToggleGameMode();
}
break;
case Key.Back:
var specialKeyState = GlobalHotkey.CheckModifiers();
if (specialKeyState.CtrlPressed)
{
if (_viewModel.SelectedIsFromQueryResults()

View file

@ -40,6 +40,8 @@
<Window.Resources>
<converters:BorderClipConverter x:Key="BorderClipConverter" />
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<converters:TextConverter x:Key="TextConverter" />
<CollectionViewSource x:Key="SortedFonts" Source="{Binding Source={x:Static Fonts.SystemFontFamilies}}">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="Source" />
@ -685,12 +687,25 @@
</ItemsControl>
</Border>
<Border Style="{DynamicResource SettingGroupBox}">
<Border Margin="0,30,0,0" Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource rememberLastLocation}" />
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource SearchWindowPosition}" />
</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}">
&#xe7f4;
</TextBlock>
</ItemsControl>
</Border>
@ -818,11 +833,13 @@
BorderThickness="0"
Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Style="{DynamicResource SettingTitleLabel}"
Text="{DynamicResource maxShowResults}" />
<StackPanel Grid.Column="1">
<TextBlock
VerticalAlignment="Center"
Style="{DynamicResource SettingTitleLabel}"
Text="{DynamicResource maxShowResults}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource maxShowResultsToolTip}" />
</StackPanel>
<ComboBox
Grid.Column="2"
Width="100"
@ -1315,7 +1332,7 @@
FontSize="11"
Foreground="{DynamicResource PluginInfoColor}"
MouseUp="OnExternalPluginUninstallClick"
Text="{DynamicResource plugin_uninstall}"
Text="{DynamicResource uninstallbtn}"
TextDecorations="Underline" />
<TextBlock
@ -1462,6 +1479,32 @@
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
SelectionMode="Single"
Style="{DynamicResource StoreListStyle}">
<ListBox.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<StackPanel Orientation="Vertical">
<TextBlock
Margin="0,0,0,10"
VerticalAlignment="Top"
FontSize="16"
FontWeight="Bold"
Text="{Binding Name, Converter={StaticResource TextConverter}}" />
<ItemsPresenter />
</StackPanel>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</ListBox.GroupStyle>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
@ -1518,33 +1561,16 @@
HorizontalAlignment="Right"
Orientation="Horizontal">
<Border
x:Name="LabelNew"
x:Name="LabelUpdate"
Height="12"
Margin="0,10,8,0"
Padding="6,2,6,2"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Background="#f14551"
CornerRadius="4"
Visibility="Collapsed">
<TextBlock
FontSize="11"
Foreground="White"
Text="New" />
</Border>
<Border
x:Name="Labelinstalled"
Margin="0,10,8,0"
Padding="6,2,6,2"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Background="{DynamicResource ToggleSwitchFillOn}"
CornerRadius="4"
Visibility="Collapsed">
<TextBlock
FontSize="11"
Foreground="White"
Text="Installed" />
</Border>
Background="#45BD59"
CornerRadius="36"
ToolTip="{DynamicResource LabelUpdateToolTip}"
Visibility="{Binding LabelUpdate, Converter={StaticResource BoolToVisibilityConverter}}" />
</StackPanel>
<StackPanel
@ -1603,7 +1629,7 @@
<Run
FontSize="12"
Foreground="{DynamicResource Color04B}"
Text="{Binding Description}" />
Text="{Binding Description, Mode=OneWay}" />
</TextBlock>
</StackPanel>
@ -1665,25 +1691,45 @@
Foreground="{DynamicResource Color04B}"
NavigateUri="{Binding Website}"
RequestNavigate="OnRequestNavigate">
<Run FontSize="12" Text="{Binding Author}" />
<Run FontSize="12" Text="{Binding Author, Mode=OneWay}" />
</Hyperlink>
</TextBlock>
</StackPanel>
</StackPanel>
<Border
Grid.Row="0"
Grid.Column="1"
Padding="0,0,0,0">
<Button
Name="ShortCutButtonPrev"
MinHeight="40"
<Grid Grid.Row="0" Grid.Column="1">
<StackPanel
Margin="0,70,20,0"
Padding="15,5,15,5"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Click="OnExternalPluginInstallClick"
Content="{DynamicResource install}" />
</Border>
Orientation="Horizontal">
<Button
MinHeight="40"
Padding="15,5,15,5"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Click="OnExternalPluginInstallClick"
Content="{DynamicResource installbtn}"
Visibility="{Binding LabelInstalled, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter='!'}" />
<Button
MinHeight="40"
Margin="5,0,0,0"
Padding="15,5,15,5"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Click="OnExternalPluginUninstallClick"
Content="{DynamicResource uninstallbtn}"
Visibility="{Binding LabelInstalled, Converter={StaticResource BoolToVisibilityConverter}}" />
<Button
MinHeight="40"
Margin="5,0,0,0"
Padding="15,5,15,5"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Click="OnExternalPluginUpdateClick"
Content="{DynamicResource updatebtn}"
Visibility="{Binding LabelUpdate, Converter={StaticResource BoolToVisibilityConverter}}" />
<!-- Hide Install Button when installed Item -->
</StackPanel>
</Grid>
</Grid>
</StackPanel>
</Grid>
@ -1815,6 +1861,7 @@
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource windowWidthSize}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource windowWidthSizeToolTip}" />
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal">
<TextBlock
@ -1828,6 +1875,7 @@
Name="WindowWidthValue"
Width="300"
Margin="0,0,18,0"
VerticalAlignment="Center"
IsMoveToPointEnabled="True"
IsSnapToTickEnabled="True"
Maximum="1920"

View file

@ -47,6 +47,10 @@ namespace Flow.Launcher
API = api;
InitializePosition();
InitializeComponent();
CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(StoreListBox.ItemsSource);
PropertyGroupDescription groupDescription = new PropertyGroupDescription("Category");
view.GroupDescriptions.Add(groupDescription);
}
#region General
@ -306,15 +310,34 @@ namespace Flow.Launcher
private void OnExternalPluginInstallClick(object sender, RoutedEventArgs e)
{
if (sender is Button { DataContext: UserPlugin plugin })
if (sender is Button { DataContext: PluginStoreItemViewModel plugin })
{
var pluginsManagerPlugin = PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7");
var actionKeyword = pluginsManagerPlugin.Metadata.ActionKeywords.Count == 0 ? "" : pluginsManagerPlugin.Metadata.ActionKeywords[0];
API.ChangeQuery($"{actionKeyword} install {plugin.Name}");
API.ShowMainWindow();
viewModel.DisplayPluginQuery($"install {plugin.Name}", PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7"));
}
}
private void OnExternalPluginUninstallClick(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
{
var name = viewModel.SelectedPlugin.PluginPair.Metadata.Name;
viewModel.DisplayPluginQuery($"uninstall {name}", PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7"));
}
}
private void OnExternalPluginUninstallClick(object sender, RoutedEventArgs e)
{
if (sender is Button { DataContext: PluginStoreItemViewModel plugin })
viewModel.DisplayPluginQuery($"uninstall {plugin.Name}", PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7"));
}
private void OnExternalPluginUpdateClick(object sender, RoutedEventArgs e)
{
if (sender is Button { DataContext: PluginStoreItemViewModel plugin })
viewModel.DisplayPluginQuery($"update {plugin.Name}", PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7"));
}
private void window_MouseDown(object sender, MouseButtonEventArgs e) /* for close hotkey popup */
{
if (Keyboard.FocusedElement is not TextBox textBox)
@ -388,7 +411,7 @@ namespace Flow.Launcher
{
if (string.IsNullOrEmpty(pluginStoreFilterTxb.Text))
return true;
if (item is UserPlugin model)
if (item is PluginStoreItemViewModel model)
{
return StringMatcher.FuzzySearch(pluginStoreFilterTxb.Text, model.Name).IsSearchPrecisionScoreMet()
|| StringMatcher.FuzzySearch(pluginStoreFilterTxb.Text, model.Description).IsSearchPrecisionScoreMet();
@ -473,17 +496,6 @@ namespace Flow.Launcher
var top = (dip2.Y - this.ActualHeight) / 2 + dip1.Y - 20;
return top;
}
private void OnExternalPluginUninstallClick(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
{
var id = viewModel.SelectedPlugin.PluginPair.Metadata.Name;
var pluginsManagerPlugin = PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7");
var actionKeyword = pluginsManagerPlugin.Metadata.ActionKeywords.Count == 0 ? "" : pluginsManagerPlugin.Metadata.ActionKeywords[0];
API.ChangeQuery($"{actionKeyword} uninstall {id}");
API.ShowMainWindow();
}
}
}
}

View file

@ -21,10 +21,11 @@ using System.Threading.Channels;
using ISavable = Flow.Launcher.Plugin.ISavable;
using System.IO;
using System.Collections.Specialized;
using CommunityToolkit.Mvvm.Input;
namespace Flow.Launcher.ViewModel
{
public class MainViewModel : BaseModel, ISavable
public partial class MainViewModel : BaseModel, ISavable
{
#region Private Fields
@ -82,6 +83,7 @@ namespace Flow.Launcher.ViewModel
_selectedResults = Results;
InitializeKeyCommands();
RegisterViewUpdate();
RegisterResultsUpdatedEvent();
@ -154,6 +156,8 @@ namespace Flow.Launcher.ViewModel
}
}
private void InitializeKeyCommands()
{
EscCommand = new RelayCommand(_ =>
@ -307,7 +311,7 @@ namespace Flow.Launcher.ViewModel
Notification.Show(
InternationalizationManager.Instance.GetTranslation("success"),
InternationalizationManager.Instance.GetTranslation("completedSuccessfully")
);
);
}), TaskScheduler.Default)
.ConfigureAwait(false);
});
@ -318,9 +322,9 @@ namespace Flow.Launcher.ViewModel
#region ViewModel Properties
public ResultsViewModel Results { get; private set; }
public ResultsViewModel ContextMenu { get; private set; }
public ResultsViewModel History { get; private 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>
/// 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
@ -411,7 +464,11 @@ namespace Flow.Launcher.ViewModel
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;
@ -592,7 +649,7 @@ namespace Flow.Launcher.ViewModel
PluginIconPath = null;
SearchIconVisibility = Visibility.Visible;
}
if (query.ActionKeyword == Plugin.Query.GlobalPluginWildcardSign)
{
@ -903,18 +960,18 @@ namespace Flow.Launcher.ViewModel
Clipboard.SetFileDropList(paths);
App.API.ShowMsg(
App.API.GetTranslation("copy")
+" "
+ (isFile? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle")),
App.API.GetTranslation("copy")
+ " "
+ (isFile ? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle")),
App.API.GetTranslation("completedSuccessfully"));
}
else
{
Clipboard.SetDataObject(copyText.ToString());
App.API.ShowMsg(
App.API.GetTranslation("copy")
+ " "
+ App.API.GetTranslation("textTitle"),
App.API.GetTranslation("copy")
+ " "
+ App.API.GetTranslation("textTitle"),
App.API.GetTranslation("completedSuccessfully"));
}
}

View file

@ -0,0 +1,58 @@
using System;
using Flow.Launcher.Core.ExternalPlugins;
using Flow.Launcher.Core.Plugin;
using Flow.Launcher.Plugin;
namespace Flow.Launcher.ViewModel
{
public class PluginStoreItemViewModel : BaseModel
{
public PluginStoreItemViewModel(UserPlugin plugin)
{
_plugin = plugin;
}
private UserPlugin _plugin;
public string ID => _plugin.ID;
public string Name => _plugin.Name;
public string Description => _plugin.Description;
public string Author => _plugin.Author;
public string Version => _plugin.Version;
public string Language => _plugin.Language;
public string Website => _plugin.Website;
public string UrlDownload => _plugin.UrlDownload;
public string UrlSourceCode => _plugin.UrlSourceCode;
public string IcoPath => _plugin.IcoPath;
public bool LabelInstalled => PluginManager.GetPluginForId(_plugin.ID) != null;
public bool LabelUpdate => LabelInstalled && _plugin.Version != PluginManager.GetPluginForId(_plugin.ID).Metadata.Version;
internal const string None = "None";
internal const string RecentlyUpdated = "RecentlyUpdated";
internal const string NewRelease = "NewRelease";
internal const string Installed = "Installed";
public string Category
{
get
{
string category = None;
if (DateTime.Now - _plugin.LatestReleaseDate < TimeSpan.FromDays(7))
{
category = RecentlyUpdated;
}
if (DateTime.Now - _plugin.DateAdded < TimeSpan.FromDays(7))
{
category = NewRelease;
}
if (PluginManager.GetPluginForId(_plugin.ID) != null)
{
category = Installed;
}
return category;
}
}
}
}

View file

@ -41,6 +41,9 @@ namespace Flow.Launcher.ViewModel
case nameof(Settings.ActivateTimes):
OnPropertyChanged(nameof(ActivatedTimes));
break;
case nameof(Settings.WindowSize):
OnPropertyChanged(nameof(WindowWidthSize));
break;
}
};
}
@ -278,14 +281,24 @@ namespace Flow.Launcher.ViewModel
}
}
public IList<UserPlugin> ExternalPlugins
public IList<PluginStoreItemViewModel> ExternalPlugins
{
get
{
return PluginsManifest.UserPlugins;
return LabelMaker(PluginsManifest.UserPlugins);
}
}
private IList<PluginStoreItemViewModel> LabelMaker(IList<UserPlugin> list)
{
return list.Select(p=>new PluginStoreItemViewModel(p))
.OrderByDescending(p => p.Category == PluginStoreItemViewModel.NewRelease)
.ThenByDescending(p=>p.Category == PluginStoreItemViewModel.RecentlyUpdated)
.ThenByDescending(p => p.Category == PluginStoreItemViewModel.None)
.ThenByDescending(p => p.Category == PluginStoreItemViewModel.Installed)
.ToList();
}
public Control SettingProvider
{
get
@ -311,6 +324,15 @@ namespace Flow.Launcher.ViewModel
OnPropertyChanged(nameof(ExternalPlugins));
}
internal void DisplayPluginQuery(string queryToDisplay, PluginPair plugin, int actionKeywordPosition = 0)
{
var actionKeyword = plugin.Metadata.ActionKeywords.Count == 0
? string.Empty
: plugin.Metadata.ActionKeywords[actionKeywordPosition];
App.API.ChangeQuery($"{actionKeyword} {queryToDisplay}");
App.API.ShowMainWindow();
}
#endregion
@ -382,6 +404,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
{
get => Settings.WindowSize;

View file

@ -62,7 +62,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Mages" Version="2.0.0" />
<PackageReference Include="Mages" Version="2.0.1" />
</ItemGroup>
</Project>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.100",
"rollForward": "latestFeature"
"version": "6.0.*",
"rollForward": "latestPatch"
}
}