mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix suffixes
This commit is contained in:
parent
d13c3817e4
commit
b77a8f755a
4 changed files with 30 additions and 13 deletions
|
|
@ -167,9 +167,9 @@
|
|||
FontSize="16"
|
||||
FontWeight="SemiBold"
|
||||
Text="{DynamicResource flowlauncher_plugin_program_suffixes_excutable_types}" />
|
||||
<CheckBox Name="apprefMS" Margin="10,0,0,0" IsChecked="{Binding _settings.BuiltinSuffixesStatus[appref-ms]}">appref-ms</CheckBox>
|
||||
<CheckBox Name="exe" Margin="10,0,0,0" IsChecked="{Binding _settings.BuiltinSuffixesStatus[exe]}">exe</CheckBox>
|
||||
<CheckBox Name="lnk" Margin="10,0,0,0" IsChecked="{Binding _settings.BuiltinSuffixesStatus[lnk]}">lnk</CheckBox>
|
||||
<CheckBox Name="apprefMS" Margin="10,0,0,0" IsChecked="{Binding SuffixesStaus[appref-ms]}">appref-ms</CheckBox>
|
||||
<CheckBox Name="exe" Margin="10,0,0,0" IsChecked="{Binding SuffixesStaus[exe]}">exe</CheckBox>
|
||||
<CheckBox Name="lnk" Margin="10,0,0,0" IsChecked="{Binding SuffixesStaus[lnk]}">lnk</CheckBox>
|
||||
<CheckBox
|
||||
Name="CustomFiles"
|
||||
Margin="10,0,0,0"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Program
|
||||
|
|
@ -7,13 +8,14 @@ namespace Flow.Launcher.Plugin.Program
|
|||
{
|
||||
private PluginInitContext context;
|
||||
private Settings _settings;
|
||||
public Dictionary<string, bool> SuffixesStaus => _settings.BuiltinSuffixesStatus;
|
||||
|
||||
public ProgramSuffixes(PluginInitContext context, Settings settings)
|
||||
{
|
||||
this.context = context;
|
||||
InitializeComponent();
|
||||
_settings = settings;
|
||||
tbSuffixes.Text = string.Join(Settings.SuffixSeperator.ToString(), _settings.CustomSuffixes);
|
||||
InitializeComponent();
|
||||
tbSuffixes.Text = string.Join(Settings.SuffixSeperator, _settings.CustomSuffixes);
|
||||
}
|
||||
|
||||
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
|
||||
|
|
@ -25,7 +27,7 @@ namespace Flow.Launcher.Plugin.Program
|
|||
{
|
||||
var suffixes = tbSuffixes.Text.Split(Settings.SuffixSeperator, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (suffixes.Length == 0)
|
||||
if (suffixes.Length == 0 && _settings.UseCustomSuffixes)
|
||||
{
|
||||
string warning = context.API.GetTranslation("flowlauncher_plugin_program_suffixes_cannot_empty");
|
||||
MessageBox.Show(warning);
|
||||
|
|
@ -34,14 +36,18 @@ namespace Flow.Launcher.Plugin.Program
|
|||
|
||||
_settings.CustomSuffixes = suffixes;
|
||||
|
||||
string msg = context.API.GetTranslation("flowlauncher_plugin_program_update_file_suffixes");
|
||||
MessageBox.Show(msg);
|
||||
//string msg = context.API.GetTranslation("flowlauncher_plugin_program_update_file_suffixes");
|
||||
//MessageBox.Show(msg);
|
||||
|
||||
DialogResult = true;
|
||||
}
|
||||
|
||||
private void BtnReset_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
apprefMS.IsChecked = true;
|
||||
exe.IsChecked = true;
|
||||
lnk.IsChecked = true;
|
||||
CustomFiles.IsChecked = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -537,7 +537,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
{
|
||||
var programs = Enumerable.Empty<Win32>();
|
||||
|
||||
var unregistered = UnregisteredPrograms(settings.ProgramSources, settings.CustomSuffixes);
|
||||
var unregistered = UnregisteredPrograms(settings.ProgramSources, settings.GetProgramExtensions());
|
||||
|
||||
programs = programs.Concat(unregistered);
|
||||
|
||||
|
|
@ -545,13 +545,13 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
|
||||
if (settings.EnableRegistrySource)
|
||||
{
|
||||
var appPaths = AppPathsPrograms(settings.CustomSuffixes);
|
||||
var appPaths = AppPathsPrograms(settings.GetProgramExtensions());
|
||||
autoIndexPrograms = autoIndexPrograms.Concat(appPaths);
|
||||
}
|
||||
|
||||
if (settings.EnableStartMenuSource)
|
||||
{
|
||||
var startMenu = StartMenuPrograms(settings.CustomSuffixes);
|
||||
var startMenu = StartMenuPrograms(settings.GetProgramExtensions());
|
||||
autoIndexPrograms = autoIndexPrograms.Concat(startMenu);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Program
|
||||
{
|
||||
|
|
@ -10,8 +11,9 @@ namespace Flow.Launcher.Plugin.Program
|
|||
public DateTime LastIndexTime { get; set; }
|
||||
public List<ProgramSource> ProgramSources { get; set; } = new List<ProgramSource>();
|
||||
public List<DisabledProgramSource> DisabledProgramSources { get; set; } = new List<DisabledProgramSource>();
|
||||
public string[] CustomSuffixes { get; set; } = { "appref-ms", "exe", "lnk" };
|
||||
public string[] CustomSuffixes { get; set; } = { };
|
||||
|
||||
[JsonIgnore]
|
||||
public Dictionary<string, bool> BuiltinSuffixesStatus { get; set; } = new Dictionary<string, bool>{
|
||||
{ "exe", true }, { "appref-ms", true }, { "lnk", true }
|
||||
};
|
||||
|
|
@ -30,7 +32,16 @@ namespace Flow.Launcher.Plugin.Program
|
|||
}
|
||||
}
|
||||
|
||||
return extensions.Concat(CustomSuffixes).DistinctBy(x => x.ToLower()).ToArray();
|
||||
// todo: url
|
||||
|
||||
if (UseCustomSuffixes)
|
||||
{
|
||||
return extensions.Concat(CustomSuffixes).DistinctBy(x => x.ToLower()).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
return extensions.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public bool EnableStartMenuSource { get; set; } = true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue