Merge branch 'dev' into LocalizedLnkName

This commit is contained in:
VictoriousRaptor 2023-01-02 14:56:37 +08:00 committed by GitHub
commit ad25879335
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 98 additions and 65 deletions

View file

@ -35,3 +35,26 @@ mscorlib
pythonw
dotnet
winget
jjw24
wolframalpha
gmail
duckduckgo
facebook
findicon
baidu
pls
websearch
qianlifeng
userdata
srchadmin
EWX
dlgtext
CMD
appref-ms
appref
TSource
runas
dpi
popup
ptr
pluginindicator

View file

@ -108,3 +108,9 @@
# Localization keys
#x:Key="[^"]+"
#{DynamicResource [^"]+}
# html tag
<\w+[^>]*>
#http/https
(?:\b(?:https?|ftp|file)://)[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]

View file

@ -82,10 +82,10 @@ jobs:
post_comment: 0
use_magic_file: 1
experimental_apply_changes_via_bot: 1
use_sarif: true # to show in pr page
use_sarif: 0 # to show in pr page
extra_dictionary_limit: 10
check_commit_messages: commits title description
only_check_changed_files: false
only_check_changed_files: 1
check_extra_dictionaries: ''
quit_without_error: true
extra_dictionaries:
@ -96,6 +96,8 @@ jobs:
cspell:csharp/csharp.txt
cspell:dotnet/dotnet.txt
cspell:python/src/python/python-lib.txt
cspell:aws/aws.txt
cspell:companies/src/companies.txt
warnings:
binary-file,deprecated-feature,large-file,limited-references,noisy-file,non-alpha-in-dictionary,unexpected-line-ending,whitespace-in-dictionary,minified-file,unsupported-configuration,unrecognized-spelling,no-newline-at-eof

View file

@ -2,7 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="flowlauncher_plugin_pluginindicator_result_subtitle">Activate {0} plugin action keyword</system:String>
<system:String x:Key="flowlauncher_plugin_pluginindicator_plugin_name">Plugin Indicator</system:String>
<system:String x:Key="flowlauncher_plugin_pluginindicator_plugin_description">Provides plugins action words suggestions</system:String>
</ResourceDictionary>
</ResourceDictionary>

View file

@ -10,28 +10,28 @@ namespace Flow.Launcher.Plugin.PluginIndicator
public List<Result> Query(Query query)
{
// if query contains more than one word, eg. github tips
// user has decided to type something else rather than wanting to see the available action keywords
if (query.SearchTerms.Length > 1)
return new List<Result>();
var results = from keyword in PluginManager.NonGlobalPlugins.Keys
where keyword.StartsWith(query.Search)
let metadata = PluginManager.NonGlobalPlugins[keyword].Metadata
where !metadata.Disabled
select new Result
{
Title = keyword,
SubTitle = $"Activate {metadata.Name} plugin",
Score = 100,
IcoPath = metadata.IcoPath,
AutoCompleteText = $"{keyword}{Plugin.Query.TermSeparator}",
Action = c =>
{
context.API.ChangeQuery($"{keyword}{Plugin.Query.TermSeparator}");
return false;
}
};
var results =
from keyword in PluginManager.NonGlobalPlugins.Keys
let plugin = PluginManager.NonGlobalPlugins[keyword].Metadata
let keywordSearchResult = context.API.FuzzySearch(query.Search, keyword)
let searchResult = keywordSearchResult.IsSearchPrecisionScoreMet() ? keywordSearchResult : context.API.FuzzySearch(query.Search, plugin.Name)
let score = searchResult.Score
where (searchResult.IsSearchPrecisionScoreMet()
|| string.IsNullOrEmpty(query.Search)) // To list all available action keywords
&& !plugin.Disabled
select new Result
{
Title = keyword,
SubTitle = string.Format(context.API.GetTranslation("flowlauncher_plugin_pluginindicator_result_subtitle"), plugin.Name),
Score = score,
IcoPath = plugin.IcoPath,
AutoCompleteText = $"{keyword}{Plugin.Query.TermSeparator}",
Action = c =>
{
context.API.ChangeQuery($"{keyword}{Plugin.Query.TermSeparator}");
return false;
}
};
return results.ToList();
}

View file

@ -2,9 +2,9 @@
"ID": "6A122269676E40EB86EB543B945932B9",
"ActionKeyword": "*",
"Name": "Plugin Indicator",
"Description": "Provide plugin actionword suggestion",
"Description": "Provides plugin action keyword suggestions",
"Author": "qianlifeng",
"Version": "2.0.0",
"Version": "2.0.1",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.PluginIndicator.dll",

View file

@ -55,7 +55,7 @@
<system:String x:Key="flowlauncher_plugin_program_suffixes_cannot_empty">File suffixes can't be empty</system:String>
<system:String x:Key="flowlauncher_plugin_protocols_cannot_empty">Protocols can't be empty</system:String>
<system:String x:Key="flowlauncher_plugin_program_suffixes_excutable_types">File Suffixes</system:String>
<system:String x:Key="flowlauncher_plugin_program_suffixes_executable_types">File Suffixes</system:String>
<system:String x:Key="flowlauncher_plugin_program_suffixes_URL_types">URL Protocols</system:String>
<system:String x:Key="flowlauncher_plugin_program_suffixes_URL_steam">Steam Games</system:String>
<system:String x:Key="flowlauncher_plugin_program_suffixes_URL_epic">Epic Games</system:String>

View file

@ -162,7 +162,7 @@
Margin="0,0,0,8"
FontSize="16"
FontWeight="SemiBold"
Text="{DynamicResource flowlauncher_plugin_program_suffixes_excutable_types}" />
Text="{DynamicResource flowlauncher_plugin_program_suffixes_executable_types}" />
<CheckBox
Name="apprefMS"
Margin="10,0,0,0"

View file

@ -38,7 +38,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
public void InitAppsInPackage(Package package)
{
var applist = new List<Application>();
var apps = new List<Application>();
// WinRT
var appListEntries = package.GetAppListEntries();
foreach (var app in appListEntries)
@ -46,7 +46,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
try
{
var tmp = new Application(app, this);
applist.Add(tmp);
apps.Add(tmp);
}
catch (Exception e)
{
@ -55,7 +55,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
+ $"{FullName} from location {Location}", e);
}
}
Apps = applist.ToArray();
Apps = apps.ToArray();
try
{
@ -147,7 +147,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
}
ProgramLogger.LogException($"|UWP|GetPackageVersionFromManifest|{Location}" +
"|Trying to get the package version of the UWP program, but an unknown UWP appmanifest version in package "
"|Trying to get the package version of the UWP program, but an unknown UWP app-manifest version in package "
+ $"{FullName} from location {Location}", new FormatException());
return PackageVersion.Unknown;
}
@ -392,14 +392,14 @@ namespace Flow.Launcher.Plugin.Program.Programs
{
title = $"{Name}: {Description}";
var nameMatch = StringMatcher.FuzzySearch(query, Name);
var desciptionMatch = StringMatcher.FuzzySearch(query, Description);
if (desciptionMatch.Score > nameMatch.Score)
var descriptionMatch = StringMatcher.FuzzySearch(query, Description);
if (descriptionMatch.Score > nameMatch.Score)
{
for (int i = 0; i < desciptionMatch.MatchData.Count; i++)
for (int i = 0; i < descriptionMatch.MatchData.Count; i++)
{
desciptionMatch.MatchData[i] += Name.Length + 2; // 2 is ": "
descriptionMatch.MatchData[i] += Name.Length + 2; // 2 is ": "
}
matchResult = desciptionMatch;
matchResult = descriptionMatch;
}
else matchResult = nameMatch;
}
@ -633,7 +633,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
// }
// else
// {
// ProgramLogger.LogException($"|UWP|ImageFromPath|{(string.IsNullOrEmpty(path) ? "Not Avaliable" : path)}" +
// ProgramLogger.LogException($"|UWP|ImageFromPath|{(string.IsNullOrEmpty(path) ? "Not Available" : path)}" +
// $"|Unable to get logo for {UserModelId} from {path} and" +
// $" located in {Location}", new FileNotFoundException());
// return new BitmapImage(new Uri(Constant.MissingImgIcon));
@ -658,8 +658,8 @@ namespace Flow.Launcher.Plugin.Program.Programs
// var brush = new SolidColorBrush(color);
// var pen = new Pen(brush, 1);
// var backgroundArea = new Rect(0, 0, width, width);
// var rectabgle = new RectangleGeometry(backgroundArea);
// var rectDrawing = new GeometryDrawing(brush, pen, rectabgle);
// var rectangle = new RectangleGeometry(backgroundArea);
// var rectDrawing = new GeometryDrawing(brush, pen, rectangle);
// group.Children.Add(rectDrawing);
// var imageArea = new Rect(x, y, image.Width, image.Height);

View file

@ -545,12 +545,12 @@ namespace Flow.Launcher.Plugin.Program.Programs
.Distinct();
}
private static string GetProgramPathFromRegistrySubKeys(RegistryKey root, string subkey)
private static string GetProgramPathFromRegistrySubKeys(RegistryKey root, string subKey)
{
var path = string.Empty;
try
{
using (var key = root.OpenSubKey(subkey))
using (var key = root.OpenSubKey(subKey))
{
if (key == null)
return string.Empty;

View file

@ -33,7 +33,7 @@ namespace Flow.Launcher.Plugin.Shell
string cmd = query.Search;
if (string.IsNullOrEmpty(cmd))
{
return ResultsFromlHistory();
return ResultsFromHistory();
}
else
{
@ -55,8 +55,8 @@ namespace Flow.Launcher.Plugin.Shell
else if (Directory.Exists(Path.GetDirectoryName(excmd) ?? string.Empty))
{
basedir = Path.GetDirectoryName(excmd);
var dirn = Path.GetDirectoryName(cmd);
dir = (dirn.EndsWith("/") || dirn.EndsWith(@"\")) ? dirn : cmd.Substring(0, dirn.Length + 1);
var dirName = Path.GetDirectoryName(cmd);
dir = (dirName.EndsWith("/") || dirName.EndsWith(@"\")) ? dirName : cmd.Substring(0, dirName.Length + 1);
}
if (basedir != null)
@ -158,7 +158,7 @@ namespace Flow.Launcher.Plugin.Shell
return result;
}
private List<Result> ResultsFromlHistory()
private List<Result> ResultsFromHistory()
{
IEnumerable<Result> history = _settings.CommandHistory.OrderByDescending(o => o.Value)
.Select(m => new Result
@ -204,7 +204,7 @@ namespace Flow.Launcher.Plugin.Shell
info.Arguments = $"{(_settings.LeaveShellOpen ? "/k" : "/c")} {command}";
//// Use info.Arguments instead of info.ArgumentList to enable users better control over the arguments they are writing.
//// Previous code using ArgumentList, commands needed to be seperated correctly:
//// Previous code using ArgumentList, commands needed to be separated correctly:
//// Incorrect:
// info.ArgumentList.Add(_settings.LeaveShellOpen ? "/k" : "/c");
// info.ArgumentList.Add(command); //<== info.ArgumentList.Add("mkdir \"c:\\test new\"");
@ -377,9 +377,9 @@ namespace Flow.Launcher.Plugin.Shell
public List<Result> LoadContextMenus(Result selectedResult)
{
var resultlist = new List<Result>
var results = new List<Result>
{
new Result
new()
{
Title = context.API.GetTranslation("flowlauncher_plugin_cmd_run_as_different_user"),
AsyncAction = async c =>
@ -390,7 +390,7 @@ namespace Flow.Launcher.Plugin.Shell
IcoPath = "Images/user.png",
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\xe7ee")
},
new Result
new()
{
Title = context.API.GetTranslation("flowlauncher_plugin_cmd_run_as_administrator"),
Action = c =>
@ -401,7 +401,7 @@ namespace Flow.Launcher.Plugin.Shell
IcoPath = "Images/admin.png",
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\xe7ef")
},
new Result
new()
{
Title = context.API.GetTranslation("flowlauncher_plugin_cmd_copy"),
Action = c =>
@ -414,7 +414,7 @@ namespace Flow.Launcher.Plugin.Shell
}
};
return resultlist;
return results;
}
}
}

View file

@ -95,11 +95,11 @@ namespace Flow.Launcher.Plugin.Sys
IcoPath = "Images\\shutdown.png",
Action = c =>
{
var reuslt = MessageBox.Show(
var result = MessageBox.Show(
context.API.GetTranslation("flowlauncher_plugin_sys_dlgtext_shutdown_computer"),
context.API.GetTranslation("flowlauncher_plugin_sys_shutdown_computer"),
MessageBoxButton.YesNo, MessageBoxImage.Warning);
if (reuslt == MessageBoxResult.Yes)
if (result == MessageBoxResult.Yes)
{
Process.Start("shutdown", "/s /t 0");
}

View file

@ -7,7 +7,7 @@
<system:String x:Key="flowlauncher_plugin_new_tab">New Tab</system:String>
<system:String x:Key="flowlauncher_plugin_url_open_url">Open url:{0}</system:String>
<system:String x:Key="flowlauncher_plugin_url_canot_open_url">Can't open url:{0}</system:String>
<system:String x:Key="flowlauncher_plugin_url_cannot_open_url">Can't open url:{0}</system:String>
<system:String x:Key="flowlauncher_plugin_url_plugin_name">URL</system:String>
<system:String x:Key="flowlauncher_plugin_url_plugin_description">Open the typed URL from Flow Launcher</system:String>

View file

@ -74,7 +74,7 @@ namespace Flow.Launcher.Plugin.Url
}
catch(Exception)
{
context.API.ShowMsg(string.Format(context.API.GetTranslation("flowlauncher_plugin_url_canot_open_url"), raw));
context.API.ShowMsg(string.Format(context.API.GetTranslation("flowlauncher_plugin_url_cannot_open_url"), raw));
return false;
}
}

View file

@ -21,16 +21,16 @@ namespace Flow.Launcher.Plugin.WebSearch
{
_oldSearchSource = old;
_viewModel = new SearchSourceViewModel {SearchSource = old.DeepCopy()};
Initilize(sources, context, Action.Edit);
Initialize(sources, context, Action.Edit);
}
public SearchSourceSettingWindow(IList<SearchSource> sources, PluginInitContext context)
{
_viewModel = new SearchSourceViewModel {SearchSource = new SearchSource()};
Initilize(sources, context, Action.Add);
Initialize(sources, context, Action.Add);
}
private async void Initilize(IList<SearchSource> sources, PluginInitContext context, Action action)
private async void Initialize(IList<SearchSource> sources, PluginInitContext context, Action action)
{
InitializeComponent();
DataContext = _viewModel;

View file

@ -18,7 +18,7 @@ namespace Flow.Launcher.Plugin.WindowsSettings.Helper
public static void Init(IPublicAPI api) => _api = api;
private static List<Result> GetDefaultReuslts(in IEnumerable<WindowsSetting> list,
private static List<Result> GetDefaultResults(in IEnumerable<WindowsSetting> list,
string windowsSettingIconPath,
string controlPanelIconPath)
{
@ -45,7 +45,7 @@ namespace Flow.Launcher.Plugin.WindowsSettings.Helper
{
if (string.IsNullOrWhiteSpace(query.Search))
{
return GetDefaultReuslts(list, windowsSettingIconPath, controlPanelIconPath);
return GetDefaultResults(list, windowsSettingIconPath, controlPanelIconPath);
}
var resultList = new List<Result>();
@ -110,7 +110,7 @@ namespace Flow.Launcher.Plugin.WindowsSettings.Helper
return resultList;
}
private const int TaskLinkScorePanelty = 50;
private const int TaskLinkScorePenalty = 50;
private static Result NewSettingResult(int score, string type, string windowsSettingIconPath, string controlPanelIconPath, WindowsSetting entry) => new()
{
@ -120,7 +120,7 @@ namespace Flow.Launcher.Plugin.WindowsSettings.Helper
SubTitle = GetSubtitle(entry.Area, type),
Title = entry.Name,
ContextData = entry,
Score = score - (type == "TaskLink" ? TaskLinkScorePanelty : 0),
Score = score - (type == "TaskLink" ? TaskLinkScorePenalty : 0),
};
private static string GetSubtitle(string section, string entryType)