diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Classes/WindowsSetting.cs b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Classes/WindowsSetting.cs index be7cd44d3..35eb8cb45 100644 --- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Classes/WindowsSetting.cs +++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Classes/WindowsSetting.cs @@ -37,10 +37,16 @@ namespace Flow.Plugin.WindowsSettings.Classes /// public string Command { get; set; } + private string type = string.Empty; + /// /// Gets or sets the type of the windows setting. /// public string Type { get; set; } + /// + /// Gets or sets the type display name of this setting. + /// + public string? DisplayType { get; set; } /// /// Gets or sets the alternative names of this setting. @@ -73,4 +79,4 @@ namespace Flow.Plugin.WindowsSettings.Classes /// public uint? DeprecatedInBuild { get; set; } } -} +} \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Flow.Plugin.WindowsSettings.csproj b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Flow.Plugin.WindowsSettings.csproj index e65a4c62e..d6dc20dd4 100644 --- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Flow.Plugin.WindowsSettings.csproj +++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Flow.Plugin.WindowsSettings.csproj @@ -70,12 +70,9 @@ - + PreserveNewest - - - PreserveNewest - + diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs index c5fd287bd..a273ea75d 100644 --- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs +++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs @@ -27,12 +27,13 @@ namespace Flow.Plugin.WindowsSettings.Helper /// /// The original result list to convert. /// Query for specific result List - /// The path to the icon of each entry. + /// The path to the icon of each entry. /// A list with . internal static List GetResultList( in IEnumerable list, Query query, - string iconPath) + string windowsSettingIconPath, + string controlPanelIconPath) { var resultList = new List(); foreach (var entry in list) @@ -47,7 +48,7 @@ namespace Flow.Plugin.WindowsSettings.Helper if (nameMatch.IsSearchPrecisionScoreMet()) { - var settingResult = NewSettingResult(nameMatch.Score + highScore); + var settingResult = NewSettingResult(nameMatch.Score + highScore, entry.Type); settingResult.TitleHighlightData = nameMatch.MatchData; result = settingResult; } @@ -56,7 +57,7 @@ namespace Flow.Plugin.WindowsSettings.Helper var areaMatch = _api.FuzzySearch(query.Search, entry.Area); if (areaMatch.IsSearchPrecisionScoreMet()) { - var settingResult = NewSettingResult(areaMatch.Score + midScore); + var settingResult = NewSettingResult(areaMatch.Score + midScore, entry.Type); settingResult.SubTitleHighlightData = areaMatch.MatchData.Select(x => x + 6).ToList(); result = settingResult; } @@ -65,7 +66,7 @@ namespace Flow.Plugin.WindowsSettings.Helper result = entry.AltNames? .Select(altName => _api.FuzzySearch(query.Search, altName)) .Where(match => match.IsSearchPrecisionScoreMet()) - .Select(altNameMatch => NewSettingResult(altNameMatch.Score + midScore)) + .Select(altNameMatch => NewSettingResult(altNameMatch.Score + midScore, entry.Type)) .FirstOrDefault(); } @@ -79,7 +80,7 @@ namespace Flow.Plugin.WindowsSettings.Helper .SelectMany(x => x) .Contains(x, StringComparer.CurrentCultureIgnoreCase)) ) - result = NewSettingResult(midScore); + result = NewSettingResult(midScore, entry.Type); } } @@ -90,10 +91,10 @@ namespace Flow.Plugin.WindowsSettings.Helper resultList.Add(result); - Result NewSettingResult(int score) => new() + Result NewSettingResult(int score, string type) => new() { Action = _ => DoOpenSettingsAction(entry), - IcoPath = iconPath, + IcoPath = type == "AppSettingsApp" ? windowsSettingIconPath : controlPanelIconPath, SubTitle = $"{Resources.Area} \"{entry.Area}\" {Resources.SubtitlePreposition} {entry.Type}", Title = entry.Name + entry.glyph, ContextData = entry, @@ -150,7 +151,7 @@ namespace Flow.Plugin.WindowsSettings.Helper ProcessStartInfo processStartInfo; var command = entry.Command; - + command = Environment.ExpandEnvironmentVariables(command); if (command.Contains(' ')) diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/TranslationHelper.cs b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/TranslationHelper.cs index 529fae0a3..73ac76bf6 100644 --- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/TranslationHelper.cs +++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/TranslationHelper.cs @@ -84,7 +84,7 @@ namespace Flow.Plugin.WindowsSettings.Helper { Area = area ?? settings.Area, Name = name ?? settings.Name, - Type = type ?? settings.Type, + DisplayType = type ?? settings.Type, AltNames = translatedAltNames }; diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Images/ControlPanel_Small.png b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Images/ControlPanel_Small.png new file mode 100644 index 000000000..8a8a41aeb Binary files /dev/null and b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Images/ControlPanel_Small.png differ diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Main.cs b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Main.cs index 491bb903f..6afb3fb09 100644 --- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Main.cs @@ -18,16 +18,6 @@ namespace Flow.Plugin.WindowsSettings /// public sealed class Main : IPlugin, IContextMenu, IPluginI18n, IDisposable { - /// - /// The path to the symbol for a light theme. - /// - private const string _lightSymbol = "Images/WindowsSettings.light.png"; - - /// - /// The path to the symbol for a dark theme. - /// - private const string _darkSymbol = "Images/WindowsSettings.dark.png"; - /// /// The name of this assembly. /// @@ -39,9 +29,14 @@ namespace Flow.Plugin.WindowsSettings private PluginInitContext? _context; /// - /// The path to the icon for each result. + /// The path to the icon for windows setting result. /// - private string _defaultIconPath; + private const string windowSettingsIconPath = "Images/WindowsSettings.light.png"; + + /// + /// The path to the icon for control panel result. + /// + private const string controlPanelIconPath = "Images/ControlPanel_Small.png"; /// /// Indicate that the plugin is disposed. @@ -64,7 +59,6 @@ namespace Flow.Plugin.WindowsSettings public Main() { _assemblyName = Assembly.GetExecutingAssembly().GetName().Name ?? Name; - _defaultIconPath = _lightSymbol; } /// @@ -101,7 +95,7 @@ namespace Flow.Plugin.WindowsSettings /// A filtered list, can be empty when nothing was found. public List Query(Query query) { - var newList = ResultHelper.GetResultList(_translatedSettingList, query, _defaultIconPath); + var newList = ResultHelper.GetResultList(_translatedSettingList, query, windowSettingsIconPath, controlPanelIconPath); return newList;