diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/IndexerPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/IndexerPage.cs index a62f03295a..f03452effb 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/IndexerPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Pages/IndexerPage.cs @@ -21,6 +21,8 @@ internal sealed partial class IndexerPage : DynamicListPage, IDisposable private string initialQuery = string.Empty; + private bool _isEmptyQuery = true; + public IndexerPage() { Id = "com.microsoft.indexer.fileSearch"; @@ -43,15 +45,19 @@ internal sealed partial class IndexerPage : DynamicListPage, IDisposable disposeSearchEngine = false; } + public override ICommandItem EmptyContent => GetEmptyContent(); + public override void UpdateSearchText(string oldSearch, string newSearch) { if (oldSearch != newSearch && newSearch != initialQuery) { _ = Task.Run(() => { + _isEmptyQuery = string.IsNullOrWhiteSpace(newSearch); Query(newSearch); LoadMore(); - initialQuery = string.Empty; + OnPropertyChanged(nameof(EmptyContent)); + initialQuery = null; }); } } @@ -68,6 +74,16 @@ internal sealed partial class IndexerPage : DynamicListPage, IDisposable RaiseItemsChanged(_indexerListItems.Count); } + private CommandItem GetEmptyContent() + { + return new CommandItem(new NoOpCommand()) + { + Icon = Icon, + Title = _isEmptyQuery ? Resources.Indexer_Subtitle : Resources.Indexer_NoResultsMessage, + Subtitle = Resources.Indexer_NoResultsMessageTip, + }; + } + private void Query(string query) { ++_queryCookie; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Properties/Resources.Designer.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Properties/Resources.Designer.cs index f5d1ba2d61..a78488a7f1 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Properties/Resources.Designer.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Properties/Resources.Designer.cs @@ -61,7 +61,7 @@ namespace Microsoft.CmdPal.Ext.Indexer.Properties { } /// - /// Looks up a localized string similar to Actions. + /// Looks up a localized string similar to Actions.... /// internal static string Indexer_Command_Actions { get { @@ -177,6 +177,24 @@ namespace Microsoft.CmdPal.Ext.Indexer.Properties { } } + /// + /// Looks up a localized string similar to No items found. + /// + internal static string Indexer_NoResultsMessage { + get { + return ResourceManager.GetString("Indexer_NoResultsMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Tip: Improve your search result using filters like in Windows Explorer. (For example: type:directory). + /// + internal static string Indexer_NoResultsMessageTip { + get { + return ResourceManager.GetString("Indexer_NoResultsMessageTip", resourceCulture); + } + } + /// /// Looks up a localized string similar to Search for files and folders.... /// diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Properties/Resources.resx b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Properties/Resources.resx index 61d51998b2..bbe8f0bd31 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Properties/Resources.resx +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Properties/Resources.resx @@ -180,4 +180,10 @@ Search for "{0}" in files + + No items found + + + Tip: Refine your search using filters, just like in File Explorer (e.g., type:directory). + \ No newline at end of file diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Pages/WindowWalkerListPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Pages/WindowWalkerListPage.cs index ff7217498a..f0cbc01995 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Pages/WindowWalkerListPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Pages/WindowWalkerListPage.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using Microsoft.CmdPal.Ext.WindowWalker.Components; using Microsoft.CmdPal.Ext.WindowWalker.Properties; using Microsoft.CommandPalette.Extensions; @@ -23,6 +24,13 @@ internal sealed partial class WindowWalkerListPage : DynamicListPage, IDisposabl Name = Resources.windowwalker_name; Id = "com.microsoft.cmdpal.windowwalker"; PlaceholderText = Resources.windowwalker_PlaceholderText; + + EmptyContent = new CommandItem(new NoOpCommand()) + { + Icon = Icon, + Title = Resources.window_walker_top_level_command_title, + Subtitle = Resources.windowwalker_NoResultsMessage, + }; } public override void UpdateSearchText(string oldSearch, string newSearch) => diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Properties/Resources.Designer.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Properties/Resources.Designer.cs index 1884f3b3e5..ecb09c8c38 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Properties/Resources.Designer.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Properties/Resources.Designer.cs @@ -142,7 +142,7 @@ namespace Microsoft.CmdPal.Ext.WindowWalker.Properties { } /// - /// Looks up a localized string similar to You are going to end the following process:. + /// Looks up a localized string similar to The following process will be ended:. /// public static string windowwalker_KillMessage { get { @@ -186,6 +186,15 @@ namespace Microsoft.CmdPal.Ext.WindowWalker.Properties { } } + /// + /// Looks up a localized string similar to No open windows found. + /// + public static string windowwalker_NoResultsMessage { + get { + return ResourceManager.GetString("windowwalker_NoResultsMessage", resourceCulture); + } + } + /// /// Looks up a localized string similar to Not Responding. /// diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Properties/Resources.resx b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Properties/Resources.resx index 1c4191bfee..c610b7b09c 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Properties/Resources.resx +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Properties/Resources.resx @@ -232,4 +232,7 @@ Search open windows... + + No open windows found + \ No newline at end of file diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Classes/WindowsSetting.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Classes/WindowsSetting.cs index fa6485d138..b276d3a876 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Classes/WindowsSetting.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Classes/WindowsSetting.cs @@ -19,7 +19,7 @@ internal sealed class WindowsSetting Name = string.Empty; Command = string.Empty; Type = string.Empty; - ShowAsFirstResult = false; + AppHomepageScore = 0; } /// @@ -65,9 +65,9 @@ internal sealed class WindowsSetting public uint? DeprecatedInBuild { get; set; } /// - /// Gets or sets a value indicating whether to use a higher score as normal for this setting to show it as one of the first results. + /// Gets or sets the score for entries if they are a settings app (homepage). If the score is higher 0 they are shown on empty query. /// - public bool ShowAsFirstResult { get; set; } + public int AppHomepageScore { get; set; } /// /// Gets or sets the value with the generated area path as string. diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Pages/WindowsSettingsListPage.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Pages/WindowsSettingsListPage.cs index 3c27d28537..1196de0b31 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Pages/WindowsSettingsListPage.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Pages/WindowsSettingsListPage.cs @@ -23,6 +23,13 @@ internal sealed partial class WindowsSettingsListPage : DynamicListPage Name = Resources.settings_title; Id = "com.microsoft.cmdpal.windowsSettings"; _windowsSettings = windowsSettings; + + EmptyContent = new CommandItem(new NoOpCommand()) + { + Icon = Icon, + Title = Resources.settings_subtitle, + Subtitle = Resources.PluginNoResultsMessage + "\n\n" + Resources.PluginNoResultsMessageHelp, + }; } public WindowsSettingsListPage(Classes.WindowsSettings windowsSettings, string query) @@ -38,11 +45,21 @@ internal sealed partial class WindowsSettingsListPage : DynamicListPage return new List(0); } - var filteredList = _windowsSettings.Settings - .Select(setting => ScoringHelper.SearchScoringPredicate(query, setting)) - .Where(scoredSetting => scoredSetting.Score > 0) - .OrderByDescending(scoredSetting => scoredSetting.Score) - .Select(scoredSetting => scoredSetting.Setting); + var filteredList = _windowsSettings.Settings; + if (!string.IsNullOrEmpty(query)) + { + filteredList = filteredList + .Select(setting => ScoringHelper.SearchScoringPredicate(query, setting)) + .Where(scoredSetting => scoredSetting.Score > 0) + .OrderByDescending(scoredSetting => scoredSetting.Score) + .Select(scoredSetting => scoredSetting.Setting); + } + else + { + filteredList = filteredList + .Where(s => s.AppHomepageScore > 0) + .OrderByDescending(s => s.AppHomepageScore); + } var newList = ResultHelper.GetResultList(filteredList); return newList; diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Properties/Resources.Designer.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Properties/Resources.Designer.cs index 0d5ce2cede..114ff4912a 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Properties/Resources.Designer.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Properties/Resources.Designer.cs @@ -322,7 +322,7 @@ namespace Microsoft.CmdPal.Ext.WindowsSettings.Properties { } /// - /// Looks up a localized string similar to System settings. + /// Looks up a localized string similar to Settings app. /// internal static string AppSettingsApp { get { @@ -3049,7 +3049,7 @@ namespace Microsoft.CmdPal.Ext.WindowsSettings.Properties { } /// - /// Looks up a localized string similar to Control Panel (Application homepage). + /// Looks up a localized string similar to Open Control Panel. /// internal static string OpenControlPanel { get { @@ -3058,7 +3058,16 @@ namespace Microsoft.CmdPal.Ext.WindowsSettings.Properties { } /// - /// Looks up a localized string similar to Open Settings. + /// Looks up a localized string similar to Open Microsoft Management Console. + /// + internal static string OpenMMC { + get { + return ResourceManager.GetString("OpenMMC", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Open. /// internal static string OpenSettings { get { @@ -3067,7 +3076,7 @@ namespace Microsoft.CmdPal.Ext.WindowsSettings.Properties { } /// - /// Looks up a localized string similar to Settings (Application homepage). + /// Looks up a localized string similar to Open Settings app. /// internal static string OpenSettingsApp { get { @@ -3345,6 +3354,24 @@ namespace Microsoft.CmdPal.Ext.WindowsSettings.Properties { } } + /// + /// Looks up a localized string similar to No settings found. + /// + internal static string PluginNoResultsMessage { + get { + return ResourceManager.GetString("PluginNoResultsMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Tip: Use ':' to search for setting categories (e.g., Update:), and > to search by setting path (e.g., Settings app>Apps).. + /// + internal static string PluginNoResultsMessageHelp { + get { + return ResourceManager.GetString("PluginNoResultsMessageHelp", resourceCulture); + } + } + /// /// Looks up a localized string similar to Windows settings. /// diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Properties/Resources.resx b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Properties/Resources.resx index 467defe1e8..95b4b5a174 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Properties/Resources.resx +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/Properties/Resources.resx @@ -228,7 +228,7 @@ Area Apps - System settings + Settings app Type of the setting is a "Modern Windows settings". We use the same term as used in start menu search at the moment. @@ -1319,11 +1319,11 @@ On-Screen - Control Panel (Application homepage) + Open Control Panel 'Control Panel' is here the name of the legacy settings app. - Settings (Application homepage) + Open Settings app 'Settings' is here the name of the modern settings app. @@ -2080,7 +2080,8 @@ Mean zooming of things via a magnifier - Open Settings + Open + Open 'the setting' in Settings app, Control Panel or MMC. Windows Settings @@ -2097,4 +2098,13 @@ Search Windows settings for this device + + Tip: Use ':' to search for setting categories (e.g., Update:), and > to search by setting path (e.g., Settings app>Apps). + + + No settings found + + + Open Microsoft Management Console + \ No newline at end of file diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettings.json b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettings.json index 97c4d3f65c..794dbcc280 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettings.json +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettings.json @@ -6,13 +6,13 @@ "Type": "AppSettingsApp", "AltNames": [ "SettingsApp", "AppSettingsApp" ], "Command": "ms-settings:", - "ShowAsFirstResult": true + "AppHomepageScore": 30 }, { "Name": "OpenControlPanel", "Type": "AppControlPanel", "Command": "control.exe", - "ShowAsFirstResult": true + "AppHomepageScore": 20 }, { "Name": "AccessWorkOrSchool", @@ -1834,11 +1834,11 @@ "Command": "ms-settings-connectabledevices:devicediscovery" }, { - "Name": "AppMMC", + "Name": "OpenMMC", "Type": "AppMMC", "AltNames": [ "MMC_mmcexe" ], "Command": "mmc.exe", - "ShowAsFirstResult" : true + "AppHomepageScore" : 10 }, { "Name": "AuthorizationManager", diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettings.schema.json b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettings.schema.json index a60e5c5ffd..ad7f84b4bd 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettings.schema.json +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowsSettings/WindowsSettings.schema.json @@ -62,9 +62,10 @@ "minimum": 0, "maximum": 4294967295 }, - "ShowAsFirstResult": { - "description": "Use a higher score as normal for this setting to show it as one of the first results.", - "type": "boolean" + "AppHomepageScore": { + "description": "Order score for the result if it is a settings app (homepage). Use a score > 0.", + "type": "integer", + "minimum": 1 } } }