mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge branch 'dev' into 240514ResizableWindow
This commit is contained in:
commit
e39a7ed2be
14 changed files with 160 additions and 87 deletions
|
|
@ -139,11 +139,20 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual ValueTask DisposeAsync()
|
public virtual async ValueTask DisposeAsync()
|
||||||
{
|
{
|
||||||
RPC?.Dispose();
|
try
|
||||||
ErrorStream?.Dispose();
|
{
|
||||||
return ValueTask.CompletedTask;
|
await RPC.InvokeAsync("close");
|
||||||
|
}
|
||||||
|
catch (RemoteMethodNotFoundException e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
RPC?.Dispose();
|
||||||
|
ErrorStream?.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -188,32 +188,16 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
||||||
public bool AlwaysPreview { get; set; } = false;
|
public bool AlwaysPreview { get; set; } = false;
|
||||||
public bool AlwaysStartEn { get; set; } = false;
|
public bool AlwaysStartEn { get; set; } = false;
|
||||||
|
|
||||||
|
private SearchPrecisionScore _querySearchPrecision = SearchPrecisionScore.Regular;
|
||||||
[JsonInclude, JsonConverter(typeof(JsonStringEnumConverter))]
|
[JsonInclude, JsonConverter(typeof(JsonStringEnumConverter))]
|
||||||
public SearchPrecisionScore QuerySearchPrecision { get; private set; } = SearchPrecisionScore.Regular;
|
public SearchPrecisionScore QuerySearchPrecision
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public string QuerySearchPrecisionString
|
|
||||||
{
|
{
|
||||||
get { return QuerySearchPrecision.ToString(); }
|
get => _querySearchPrecision;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
try
|
_querySearchPrecision = value;
|
||||||
{
|
if (StringMatcher.Instance != null)
|
||||||
var precisionScore = (SearchPrecisionScore)Enum
|
StringMatcher.Instance.UserSettingSearchPrecision = value;
|
||||||
.Parse(typeof(SearchPrecisionScore), value);
|
|
||||||
|
|
||||||
QuerySearchPrecision = precisionScore;
|
|
||||||
StringMatcher.Instance.UserSettingSearchPrecision = precisionScore;
|
|
||||||
}
|
|
||||||
catch (ArgumentException e)
|
|
||||||
{
|
|
||||||
Logger.Log.Exception(nameof(Settings), "Failed to load QuerySearchPrecisionString value from Settings file", e);
|
|
||||||
|
|
||||||
QuerySearchPrecision = SearchPrecisionScore.Regular;
|
|
||||||
StringMatcher.Instance.UserSettingSearchPrecision = SearchPrecisionScore.Regular;
|
|
||||||
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,9 @@
|
||||||
<system:String x:Key="hideNotifyIconToolTip">When the icon is hidden from the tray, the Settings menu can be opened by right-clicking on the search window.</system:String>
|
<system:String x:Key="hideNotifyIconToolTip">When the icon is hidden from the tray, the Settings menu can be opened by right-clicking on the search window.</system:String>
|
||||||
<system:String x:Key="querySearchPrecision">Query Search Precision</system:String>
|
<system:String x:Key="querySearchPrecision">Query Search Precision</system:String>
|
||||||
<system:String x:Key="querySearchPrecisionToolTip">Changes minimum match score required for results.</system:String>
|
<system:String x:Key="querySearchPrecisionToolTip">Changes minimum match score required for results.</system:String>
|
||||||
|
<system:String x:Key="SearchPrecisionNone">None</system:String>
|
||||||
|
<system:String x:Key="SearchPrecisionLow">Low</system:String>
|
||||||
|
<system:String x:Key="SearchPrecisionRegular">Regular</system:String>
|
||||||
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
|
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
|
||||||
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
|
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
|
||||||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0" ?>
|
||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib">
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||||
<!-- MainWindow -->
|
<!-- MainWindow -->
|
||||||
<system:String x:Key="registerHotkeyFailed">Не удалось зарегистрировать сочетание клавиш "{0}". Возможно, оно используется другой программой. Измените сочетание клавиш или закройте другую программу.</system:String>
|
<system:String x:Key="registerHotkeyFailed">Не удалось зарегистрировать сочетание клавиш "{0}". Возможно, оно используется другой программой. Измените сочетание клавиш или закройте другую программу.</system:String>
|
||||||
<system:String x:Key="MessageBoxTitle">Flow Launcher</system:String>
|
<system:String x:Key="MessageBoxTitle">Flow Launcher</system:String>
|
||||||
|
|
@ -75,6 +78,9 @@
|
||||||
<system:String x:Key="hideNotifyIconToolTip">Когда значок скрыт в трее, меню настройки можно открыть, щёлкнув правой кнопкой мыши на окне поиска.</system:String>
|
<system:String x:Key="hideNotifyIconToolTip">Когда значок скрыт в трее, меню настройки можно открыть, щёлкнув правой кнопкой мыши на окне поиска.</system:String>
|
||||||
<system:String x:Key="querySearchPrecision">Точность поиска запросов</system:String>
|
<system:String x:Key="querySearchPrecision">Точность поиска запросов</system:String>
|
||||||
<system:String x:Key="querySearchPrecisionToolTip">Изменение минимального количества совпадений при поиске, необходимого для получения результатов.</system:String>
|
<system:String x:Key="querySearchPrecisionToolTip">Изменение минимального количества совпадений при поиске, необходимого для получения результатов.</system:String>
|
||||||
|
<system:String x:Key="SearchPrecisionNone">Нет</system:String>
|
||||||
|
<system:String x:Key="SearchPrecisionLow">Низкая</system:String>
|
||||||
|
<system:String x:Key="SearchPrecisionRegular">Обычная</system:String>
|
||||||
<system:String x:Key="ShouldUsePinyin">Поиск с использованием пиньинь</system:String>
|
<system:String x:Key="ShouldUsePinyin">Поиск с использованием пиньинь</system:String>
|
||||||
<system:String x:Key="ShouldUsePinyinToolTip">Позволяет использовать пиньинь для поиска. Пиньинь - это стандартная система латинизированной орфографии для перевода китайского языка.</system:String>
|
<system:String x:Key="ShouldUsePinyinToolTip">Позволяет использовать пиньинь для поиска. Пиньинь - это стандартная система латинизированной орфографии для перевода китайского языка.</system:String>
|
||||||
<system:String x:Key="AlwaysPreview">Всегда предпросмотр</system:String>
|
<system:String x:Key="AlwaysPreview">Всегда предпросмотр</system:String>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ namespace Flow.Launcher.SettingPages.ViewModels;
|
||||||
public class DropdownDataGeneric<TValue> : BaseModel where TValue : Enum
|
public class DropdownDataGeneric<TValue> : BaseModel where TValue : Enum
|
||||||
{
|
{
|
||||||
public string Display { get; set; }
|
public string Display { get; set; }
|
||||||
public TValue Value { get; set; }
|
public TValue Value { get; private init; }
|
||||||
|
private string LocalizationKey { get; init; }
|
||||||
|
|
||||||
public static List<TR> GetValues<TR>(string keyPrefix) where TR : DropdownDataGeneric<TValue>, new()
|
public static List<TR> GetValues<TR>(string keyPrefix) where TR : DropdownDataGeneric<TValue>, new()
|
||||||
{
|
{
|
||||||
|
|
@ -19,9 +20,17 @@ public class DropdownDataGeneric<TValue> : BaseModel where TValue : Enum
|
||||||
{
|
{
|
||||||
var key = keyPrefix + value;
|
var key = keyPrefix + value;
|
||||||
var display = InternationalizationManager.Instance.GetTranslation(key);
|
var display = InternationalizationManager.Instance.GetTranslation(key);
|
||||||
data.Add(new TR { Display = display, Value = value });
|
data.Add(new TR { Display = display, Value = value, LocalizationKey = key });
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void UpdateLabels<TR>(List<TR> options) where TR : DropdownDataGeneric<TValue>
|
||||||
|
{
|
||||||
|
foreach (var item in options)
|
||||||
|
{
|
||||||
|
item.Display = InternationalizationManager.Instance.GetTranslation(item.LocalizationKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,13 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
_updater = updater;
|
_updater = updater;
|
||||||
_portable = portable;
|
_portable = portable;
|
||||||
UpdateLastQueryModeDisplay();
|
UpdateEnumDropdownLocalizations();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SearchWindowScreen : DropdownDataGeneric<SearchWindowScreens> { }
|
public class SearchWindowScreenData : DropdownDataGeneric<SearchWindowScreens> { }
|
||||||
public class SearchWindowAlign : DropdownDataGeneric<SearchWindowAligns> { }
|
public class SearchWindowAlignData : DropdownDataGeneric<SearchWindowAligns> { }
|
||||||
// todo a better name?
|
public class SearchPrecisionData : DropdownDataGeneric<SearchPrecisionScore> { }
|
||||||
public class LastQueryMode : DropdownDataGeneric<Infrastructure.UserSettings.LastQueryMode> { }
|
public class LastQueryModeData : DropdownDataGeneric<LastQueryMode> { }
|
||||||
|
|
||||||
public bool StartFlowLauncherOnSystemStartup
|
public bool StartFlowLauncherOnSystemStartup
|
||||||
{
|
{
|
||||||
|
|
@ -55,11 +55,14 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<SearchWindowScreen> SearchWindowScreens =>
|
public List<SearchWindowScreenData> SearchWindowScreens { get; } =
|
||||||
DropdownDataGeneric<SearchWindowScreens>.GetValues<SearchWindowScreen>("SearchWindowScreen");
|
DropdownDataGeneric<SearchWindowScreens>.GetValues<SearchWindowScreenData>("SearchWindowScreen");
|
||||||
|
|
||||||
public List<SearchWindowAlign> SearchWindowAligns =>
|
public List<SearchWindowAlignData> SearchWindowAligns { get; } =
|
||||||
DropdownDataGeneric<SearchWindowAligns>.GetValues<SearchWindowAlign>("SearchWindowAlign");
|
DropdownDataGeneric<SearchWindowAligns>.GetValues<SearchWindowAlignData>("SearchWindowAlign");
|
||||||
|
|
||||||
|
public List<SearchPrecisionData> SearchPrecisionScores { get; } =
|
||||||
|
DropdownDataGeneric<SearchPrecisionScore>.GetValues<SearchPrecisionData>("SearchPrecision");
|
||||||
|
|
||||||
public List<int> ScreenNumbers
|
public List<int> ScreenNumbers
|
||||||
{
|
{
|
||||||
|
|
@ -98,29 +101,15 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<LastQueryMode> _lastQueryModes = new();
|
public List<LastQueryModeData> LastQueryModes { get; } =
|
||||||
|
DropdownDataGeneric<LastQueryMode>.GetValues<LastQueryModeData>("LastQuery");
|
||||||
|
|
||||||
public List<LastQueryMode> LastQueryModes
|
private void UpdateEnumDropdownLocalizations()
|
||||||
{
|
{
|
||||||
get
|
DropdownDataGeneric<SearchWindowScreens>.UpdateLabels(SearchWindowScreens);
|
||||||
{
|
DropdownDataGeneric<SearchWindowAligns>.UpdateLabels(SearchWindowAligns);
|
||||||
if (_lastQueryModes.Count == 0)
|
DropdownDataGeneric<SearchPrecisionScore>.UpdateLabels(SearchPrecisionScores);
|
||||||
{
|
DropdownDataGeneric<LastQueryMode>.UpdateLabels(LastQueryModes);
|
||||||
_lastQueryModes =
|
|
||||||
DropdownDataGeneric<Infrastructure.UserSettings.LastQueryMode>
|
|
||||||
.GetValues<LastQueryMode>("LastQuery");
|
|
||||||
}
|
|
||||||
|
|
||||||
return _lastQueryModes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateLastQueryModeDisplay()
|
|
||||||
{
|
|
||||||
foreach (var item in LastQueryModes)
|
|
||||||
{
|
|
||||||
item.Display = InternationalizationManager.Instance.GetTranslation($"LastQuery{item.Value}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Language
|
public string Language
|
||||||
|
|
@ -133,7 +122,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
||||||
if (InternationalizationManager.Instance.PromptShouldUsePinyin(value))
|
if (InternationalizationManager.Instance.PromptShouldUsePinyin(value))
|
||||||
ShouldUsePinyin = true;
|
ShouldUsePinyin = true;
|
||||||
|
|
||||||
UpdateLastQueryModeDisplay();
|
UpdateEnumDropdownLocalizations();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,12 +132,6 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
||||||
set => Settings.ShouldUsePinyin = value;
|
set => Settings.ShouldUsePinyin = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<string> QuerySearchPrecisionStrings => Enum
|
|
||||||
.GetValues(typeof(SearchPrecisionScore))
|
|
||||||
.Cast<SearchPrecisionScore>()
|
|
||||||
.Select(v => v.ToString())
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
public List<Language> Languages => InternationalizationManager.Instance.LoadAvailableLanguages();
|
public List<Language> Languages => InternationalizationManager.Instance.LoadAvailableLanguages();
|
||||||
|
|
||||||
public string AlwaysPreviewToolTip => string.Format(
|
public string AlwaysPreviewToolTip => string.Format(
|
||||||
|
|
|
||||||
|
|
@ -30,19 +30,31 @@
|
||||||
TextAlignment="left" />
|
TextAlignment="left" />
|
||||||
|
|
||||||
<cc:Card Title="{DynamicResource startFlowLauncherOnSystemStartup}" Icon="">
|
<cc:Card Title="{DynamicResource startFlowLauncherOnSystemStartup}" Icon="">
|
||||||
<ui:ToggleSwitch IsOn="{Binding StartFlowLauncherOnSystemStartup}" />
|
<ui:ToggleSwitch
|
||||||
|
IsOn="{Binding StartFlowLauncherOnSystemStartup}"
|
||||||
|
OffContent="{DynamicResource disable}"
|
||||||
|
OnContent="{DynamicResource enable}" />
|
||||||
</cc:Card>
|
</cc:Card>
|
||||||
|
|
||||||
<cc:Card Title="{DynamicResource hideOnStartup}" Icon="">
|
<cc:Card Title="{DynamicResource hideOnStartup}" Icon="">
|
||||||
<ui:ToggleSwitch IsOn="{Binding Settings.HideOnStartup}" />
|
<ui:ToggleSwitch
|
||||||
|
IsOn="{Binding Settings.HideOnStartup}"
|
||||||
|
OffContent="{DynamicResource disable}"
|
||||||
|
OnContent="{DynamicResource enable}" />
|
||||||
</cc:Card>
|
</cc:Card>
|
||||||
|
|
||||||
<cc:Card Title="{DynamicResource hideFlowLauncherWhenLoseFocus}" Margin="0 30 0 0">
|
<cc:Card Title="{DynamicResource hideFlowLauncherWhenLoseFocus}" Margin="0 30 0 0">
|
||||||
<ui:ToggleSwitch IsOn="{Binding Settings.HideWhenDeactivated}" />
|
<ui:ToggleSwitch
|
||||||
|
IsOn="{Binding Settings.HideWhenDeactivated}"
|
||||||
|
OffContent="{DynamicResource disable}"
|
||||||
|
OnContent="{DynamicResource enable}" />
|
||||||
</cc:Card>
|
</cc:Card>
|
||||||
|
|
||||||
<cc:Card Title="{DynamicResource hideNotifyIcon}" Sub="{DynamicResource hideNotifyIconToolTip}">
|
<cc:Card Title="{DynamicResource hideNotifyIcon}" Sub="{DynamicResource hideNotifyIconToolTip}">
|
||||||
<ui:ToggleSwitch IsOn="{Binding Settings.HideNotifyIcon}" />
|
<ui:ToggleSwitch
|
||||||
|
IsOn="{Binding Settings.HideNotifyIcon}"
|
||||||
|
OffContent="{DynamicResource disable}"
|
||||||
|
OnContent="{DynamicResource enable}" />
|
||||||
</cc:Card>
|
</cc:Card>
|
||||||
|
|
||||||
<cc:CardGroup Margin="0 30 0 0">
|
<cc:CardGroup Margin="0 30 0 0">
|
||||||
|
|
@ -111,7 +123,10 @@
|
||||||
Title="{DynamicResource ignoreHotkeysOnFullscreen}"
|
Title="{DynamicResource ignoreHotkeysOnFullscreen}"
|
||||||
Icon=""
|
Icon=""
|
||||||
Sub="{DynamicResource ignoreHotkeysOnFullscreenToolTip}">
|
Sub="{DynamicResource ignoreHotkeysOnFullscreenToolTip}">
|
||||||
<ui:ToggleSwitch IsOn="{Binding Settings.IgnoreHotkeysOnFullscreen}" />
|
<ui:ToggleSwitch
|
||||||
|
IsOn="{Binding Settings.IgnoreHotkeysOnFullscreen}"
|
||||||
|
OffContent="{DynamicResource disable}"
|
||||||
|
OnContent="{DynamicResource enable}" />
|
||||||
</cc:Card>
|
</cc:Card>
|
||||||
|
|
||||||
<cc:Card
|
<cc:Card
|
||||||
|
|
@ -119,29 +134,41 @@
|
||||||
Margin="0 30 0 0"
|
Margin="0 30 0 0"
|
||||||
Icon=""
|
Icon=""
|
||||||
Sub="{DynamicResource AlwaysPreviewToolTip}">
|
Sub="{DynamicResource AlwaysPreviewToolTip}">
|
||||||
<ui:ToggleSwitch IsOn="{Binding Settings.AlwaysPreview}" ToolTip="{Binding AlwaysPreviewToolTip}" />
|
<ui:ToggleSwitch
|
||||||
|
IsOn="{Binding Settings.AlwaysPreview}"
|
||||||
|
OffContent="{DynamicResource disable}"
|
||||||
|
OnContent="{DynamicResource enable}"
|
||||||
|
ToolTip="{Binding AlwaysPreviewToolTip}" />
|
||||||
</cc:Card>
|
</cc:Card>
|
||||||
|
|
||||||
<cc:Card
|
<cc:Card
|
||||||
Title="{DynamicResource autoUpdates}"
|
Title="{DynamicResource autoUpdates}"
|
||||||
Margin="0 30 0 0"
|
Margin="0 30 0 0"
|
||||||
Icon="">
|
Icon="">
|
||||||
<ui:ToggleSwitch IsOn="{Binding AutoUpdates}" />
|
<ui:ToggleSwitch
|
||||||
|
IsOn="{Binding AutoUpdates}"
|
||||||
|
OffContent="{DynamicResource disable}"
|
||||||
|
OnContent="{DynamicResource enable}" />
|
||||||
</cc:Card>
|
</cc:Card>
|
||||||
|
|
||||||
<cc:Card
|
<cc:Card
|
||||||
Title="{DynamicResource portableMode}"
|
Title="{DynamicResource portableMode}"
|
||||||
Icon=""
|
Icon=""
|
||||||
Sub="{DynamicResource portableModeToolTIp}">
|
Sub="{DynamicResource portableModeToolTIp}">
|
||||||
<ui:ToggleSwitch IsOn="{Binding PortableMode}" />
|
<ui:ToggleSwitch
|
||||||
|
IsOn="{Binding PortableMode}"
|
||||||
|
OffContent="{DynamicResource disable}"
|
||||||
|
OnContent="{DynamicResource enable}" />
|
||||||
</cc:Card>
|
</cc:Card>
|
||||||
|
|
||||||
<cc:CardGroup Margin="0 30 0 0">
|
<cc:CardGroup Margin="0 30 0 0">
|
||||||
<cc:Card Title="{DynamicResource querySearchPrecision}" Sub="{DynamicResource querySearchPrecisionToolTip}">
|
<cc:Card Title="{DynamicResource querySearchPrecision}" Sub="{DynamicResource querySearchPrecisionToolTip}">
|
||||||
<ComboBox
|
<ComboBox
|
||||||
MaxWidth="200"
|
MaxWidth="200"
|
||||||
ItemsSource="{Binding QuerySearchPrecisionStrings}"
|
DisplayMemberPath="Display"
|
||||||
SelectedItem="{Binding Settings.QuerySearchPrecisionString}" />
|
ItemsSource="{Binding SearchPrecisionScores}"
|
||||||
|
SelectedValue="{Binding Settings.QuerySearchPrecision}"
|
||||||
|
SelectedValuePath="Value" />
|
||||||
</cc:Card>
|
</cc:Card>
|
||||||
|
|
||||||
<cc:Card Title="{DynamicResource lastQueryMode}" Sub="{DynamicResource lastQueryModeToolTip}">
|
<cc:Card Title="{DynamicResource lastQueryMode}" Sub="{DynamicResource lastQueryModeToolTip}">
|
||||||
|
|
@ -211,14 +238,21 @@
|
||||||
Margin="0 30 0 0"
|
Margin="0 30 0 0"
|
||||||
Icon=""
|
Icon=""
|
||||||
Sub="{DynamicResource typingStartEnTooltip}">
|
Sub="{DynamicResource typingStartEnTooltip}">
|
||||||
<ui:ToggleSwitch IsOn="{Binding Settings.AlwaysStartEn}" />
|
<ui:ToggleSwitch
|
||||||
|
IsOn="{Binding Settings.AlwaysStartEn}"
|
||||||
|
OffContent="{DynamicResource disable}"
|
||||||
|
OnContent="{DynamicResource enable}" />
|
||||||
</cc:Card>
|
</cc:Card>
|
||||||
|
|
||||||
<cc:Card
|
<cc:Card
|
||||||
Title="{DynamicResource ShouldUsePinyin}"
|
Title="{DynamicResource ShouldUsePinyin}"
|
||||||
Icon=""
|
Icon=""
|
||||||
Sub="{DynamicResource ShouldUsePinyinToolTip}">
|
Sub="{DynamicResource ShouldUsePinyinToolTip}">
|
||||||
<ui:ToggleSwitch IsOn="{Binding Settings.ShouldUsePinyin}" ToolTip="{DynamicResource ShouldUsePinyinToolTip}" />
|
<ui:ToggleSwitch
|
||||||
|
IsOn="{Binding Settings.ShouldUsePinyin}"
|
||||||
|
OffContent="{DynamicResource disable}"
|
||||||
|
OnContent="{DynamicResource enable}"
|
||||||
|
ToolTip="{DynamicResource ShouldUsePinyinToolTip}" />
|
||||||
</cc:Card>
|
</cc:Card>
|
||||||
|
|
||||||
<cc:Card
|
<cc:Card
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,11 @@
|
||||||
SelectedValue="{Binding Settings.OpenResultModifiers}" />
|
SelectedValue="{Binding Settings.OpenResultModifiers}" />
|
||||||
</cc:Card>
|
</cc:Card>
|
||||||
|
|
||||||
<cc:Card
|
<cc:Card Title="{DynamicResource showOpenResultHotkey}" Sub="{DynamicResource showOpenResultHotkeyToolTip}">
|
||||||
Title="{DynamicResource showOpenResultHotkey}"
|
<ui:ToggleSwitch
|
||||||
Sub="{DynamicResource showOpenResultHotkeyToolTip}">
|
IsOn="{Binding Settings.ShowOpenResultHotkey}"
|
||||||
<ui:ToggleSwitch IsOn="{Binding Settings.ShowOpenResultHotkey}" />
|
OffContent="{DynamicResource disable}"
|
||||||
|
OnContent="{DynamicResource enable}" />
|
||||||
</cc:Card>
|
</cc:Card>
|
||||||
</cc:CardGroup>
|
</cc:CardGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,10 @@
|
||||||
|
|
||||||
<cc:CardGroup>
|
<cc:CardGroup>
|
||||||
<cc:Card Title="{DynamicResource enableProxy}">
|
<cc:Card Title="{DynamicResource enableProxy}">
|
||||||
<ui:ToggleSwitch IsOn="{Binding Settings.Proxy.Enabled}" />
|
<ui:ToggleSwitch
|
||||||
|
IsOn="{Binding Settings.Proxy.Enabled}"
|
||||||
|
OffContent="{DynamicResource disable}"
|
||||||
|
OnContent="{DynamicResource enable}" />
|
||||||
</cc:Card>
|
</cc:Card>
|
||||||
|
|
||||||
<cc:Card Title="{DynamicResource server}">
|
<cc:Card Title="{DynamicResource server}">
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@
|
||||||
<system:String x:Key="flowlauncher_plugin_program_index_PATH_tooltip">When enabled, Flow will load programs from the PATH environment variable</system:String>
|
<system:String x:Key="flowlauncher_plugin_program_index_PATH_tooltip">When enabled, Flow will load programs from the PATH environment variable</system:String>
|
||||||
<system:String x:Key="flowlauncher_plugin_program_enable_hidelnkpath">Hide app path</system:String>
|
<system:String x:Key="flowlauncher_plugin_program_enable_hidelnkpath">Hide app path</system:String>
|
||||||
<system:String x:Key="flowlauncher_plugin_program_enable_hidelnkpath_tooltip">For executable files such as UWP or lnk, hide the file path from being visible</system:String>
|
<system:String x:Key="flowlauncher_plugin_program_enable_hidelnkpath_tooltip">For executable files such as UWP or lnk, hide the file path from being visible</system:String>
|
||||||
|
<system:String x:Key="flowlauncher_plugin_program_enable_hideuninstallers">Hide uninstallers</system:String>
|
||||||
|
<system:String x:Key="flowlauncher_plugin_program_enable_hideuninstallers_tooltip">Hides programs with common uninstaller names, such as unins000.exe</system:String>
|
||||||
<system:String x:Key="flowlauncher_plugin_program_enable_description">Search in Program Description</system:String>
|
<system:String x:Key="flowlauncher_plugin_program_enable_description">Search in Program Description</system:String>
|
||||||
<system:String x:Key="flowlauncher_plugin_program_enable_description_tooltip">Flow will search program's description</system:String>
|
<system:String x:Key="flowlauncher_plugin_program_enable_description_tooltip">Flow will search program's description</system:String>
|
||||||
<system:String x:Key="flowlauncher_plugin_program_suffixes_header">Suffixes</system:String>
|
<system:String x:Key="flowlauncher_plugin_program_suffixes_header">Suffixes</system:String>
|
||||||
|
|
@ -92,4 +94,4 @@
|
||||||
<system:String x:Key="flowlauncher_plugin_program_run_as_administrator_not_supported_message">This app is not intended to be run as administrator</system:String>
|
<system:String x:Key="flowlauncher_plugin_program_run_as_administrator_not_supported_message">This app is not intended to be run as administrator</system:String>
|
||||||
<system:String x:Key="flowlauncher_plugin_program_run_failed">Unable to run {0}</system:String>
|
<system:String x:Key="flowlauncher_plugin_program_run_failed">Unable to run {0}</system:String>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ using Flow.Launcher.Plugin.Program.Programs;
|
||||||
using Flow.Launcher.Plugin.Program.Views;
|
using Flow.Launcher.Plugin.Program.Views;
|
||||||
using Flow.Launcher.Plugin.Program.Views.Models;
|
using Flow.Launcher.Plugin.Program.Views.Models;
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
|
using Path = System.IO.Path;
|
||||||
using Stopwatch = Flow.Launcher.Infrastructure.Stopwatch;
|
using Stopwatch = Flow.Launcher.Infrastructure.Stopwatch;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.Program
|
namespace Flow.Launcher.Plugin.Program
|
||||||
|
|
@ -33,6 +34,17 @@ namespace Flow.Launcher.Plugin.Program
|
||||||
private static readonly MemoryCacheOptions cacheOptions = new() { SizeLimit = 1560 };
|
private static readonly MemoryCacheOptions cacheOptions = new() { SizeLimit = 1560 };
|
||||||
private static MemoryCache cache = new(cacheOptions);
|
private static MemoryCache cache = new(cacheOptions);
|
||||||
|
|
||||||
|
private static readonly string[] commonUninstallerNames =
|
||||||
|
{
|
||||||
|
"uninst.exe",
|
||||||
|
"unins000.exe",
|
||||||
|
"uninst000.exe",
|
||||||
|
"uninstall.exe"
|
||||||
|
};
|
||||||
|
// For cases when the uninstaller is named like "Uninstall Program Name.exe"
|
||||||
|
private const string CommonUninstallerPrefix = "uninstall";
|
||||||
|
private const string CommonUninstallerSuffix = ".exe";
|
||||||
|
|
||||||
static Main()
|
static Main()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -52,6 +64,7 @@ namespace Flow.Launcher.Plugin.Program
|
||||||
.Concat(_uwps)
|
.Concat(_uwps)
|
||||||
.AsParallel()
|
.AsParallel()
|
||||||
.WithCancellation(token)
|
.WithCancellation(token)
|
||||||
|
.Where(HideUninstallersFilter)
|
||||||
.Where(p => p.Enabled)
|
.Where(p => p.Enabled)
|
||||||
.Select(p => p.Result(query.Search, Context.API))
|
.Select(p => p.Result(query.Search, Context.API))
|
||||||
.Where(r => r?.Score > 0)
|
.Where(r => r?.Score > 0)
|
||||||
|
|
@ -68,6 +81,16 @@ namespace Flow.Launcher.Plugin.Program
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool HideUninstallersFilter(IProgram program)
|
||||||
|
{
|
||||||
|
if (!_settings.HideUninstallers) return true;
|
||||||
|
if (program is not Win32 win32) return true;
|
||||||
|
var fileName = Path.GetFileName(win32.ExecutablePath);
|
||||||
|
return !commonUninstallerNames.Contains(fileName, StringComparer.OrdinalIgnoreCase) &&
|
||||||
|
!(fileName.StartsWith(CommonUninstallerPrefix, StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
fileName.EndsWith(CommonUninstallerSuffix, StringComparison.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
|
||||||
public async Task InitAsync(PluginInitContext context)
|
public async Task InitAsync(PluginInitContext context)
|
||||||
{
|
{
|
||||||
Context = context;
|
Context = context;
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ namespace Flow.Launcher.Plugin.Program
|
||||||
// CustomSuffixes no longer contains custom suffixes
|
// CustomSuffixes no longer contains custom suffixes
|
||||||
// users has tweaked the settings
|
// users has tweaked the settings
|
||||||
// or this function has been executed once
|
// or this function has been executed once
|
||||||
if (UseCustomSuffixes == true || ProgramSuffixes == null)
|
if (UseCustomSuffixes == true || ProgramSuffixes == null)
|
||||||
return;
|
return;
|
||||||
var suffixes = ProgramSuffixes.ToList();
|
var suffixes = ProgramSuffixes.ToList();
|
||||||
foreach(var item in BuiltinSuffixesStatus)
|
foreach(var item in BuiltinSuffixesStatus)
|
||||||
|
|
@ -117,6 +117,7 @@ namespace Flow.Launcher.Plugin.Program
|
||||||
public bool EnableStartMenuSource { get; set; } = true;
|
public bool EnableStartMenuSource { get; set; } = true;
|
||||||
public bool EnableDescription { get; set; } = false;
|
public bool EnableDescription { get; set; } = false;
|
||||||
public bool HideAppsPath { get; set; } = true;
|
public bool HideAppsPath { get; set; } = true;
|
||||||
|
public bool HideUninstallers { get; set; } = false;
|
||||||
public bool EnableRegistrySource { get; set; } = true;
|
public bool EnableRegistrySource { get; set; } = true;
|
||||||
public bool EnablePathSource { get; set; } = false;
|
public bool EnablePathSource { get; set; } = false;
|
||||||
public bool EnableUWP { get; set; } = true;
|
public bool EnableUWP { get; set; } = true;
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,11 @@
|
||||||
Content="{DynamicResource flowlauncher_plugin_program_enable_hidelnkpath}"
|
Content="{DynamicResource flowlauncher_plugin_program_enable_hidelnkpath}"
|
||||||
IsChecked="{Binding HideAppsPath}"
|
IsChecked="{Binding HideAppsPath}"
|
||||||
ToolTip="{DynamicResource flowlauncher_plugin_program_enable_hidelnkpath_tooltip}" />
|
ToolTip="{DynamicResource flowlauncher_plugin_program_enable_hidelnkpath_tooltip}" />
|
||||||
|
<CheckBox
|
||||||
|
Margin="12 0 12 0"
|
||||||
|
Content="{DynamicResource flowlauncher_plugin_program_enable_hideuninstallers}"
|
||||||
|
IsChecked="{Binding HideUninstallers}"
|
||||||
|
ToolTip="{DynamicResource flowlauncher_plugin_program_enable_hideuninstallers_tooltip}" />
|
||||||
<CheckBox
|
<CheckBox
|
||||||
Name="DescriptionEnabled"
|
Name="DescriptionEnabled"
|
||||||
Margin="12,0,12,0"
|
Margin="12,0,12,0"
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ namespace Flow.Launcher.Plugin.Program.Views
|
||||||
private ListSortDirection _lastDirection;
|
private ListSortDirection _lastDirection;
|
||||||
|
|
||||||
// We do not save all program sources to settings, so using
|
// We do not save all program sources to settings, so using
|
||||||
// this as temporary holder for displaying all loaded programs sources.
|
// this as temporary holder for displaying all loaded programs sources.
|
||||||
internal static List<ProgramSource> ProgramSettingDisplayList { get; set; }
|
internal static List<ProgramSource> ProgramSettingDisplayList { get; set; }
|
||||||
|
|
||||||
public bool EnableDescription
|
public bool EnableDescription
|
||||||
|
|
@ -47,6 +47,16 @@ namespace Flow.Launcher.Plugin.Program.Views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool HideUninstallers
|
||||||
|
{
|
||||||
|
get => _settings.HideUninstallers;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Main.ResetCache();
|
||||||
|
_settings.HideUninstallers = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool EnableRegistrySource
|
public bool EnableRegistrySource
|
||||||
{
|
{
|
||||||
get => _settings.EnableRegistrySource;
|
get => _settings.EnableRegistrySource;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue