mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
CmdPal: entirely redo the Run page (#39955)
This entirely rewrites the shell page. It feels a lot more like the old run dialog now. * It's got icons for files & exes * it can handle network paths * it can handle `commands /with args...` * it'll suggest files in that path as you type * it handles `%environmentVariables%` * it handles `"Paths with\spaces in them"` * it shows you the path as a suggestion, in the text box, as you move the selection References: Closes #39044 Closes #39419 Closes #38298 Closes #40311 ### Remaining todo's * [x] Remove the `GenerateAppxManifest` change, and file something to fix that. We are still generating msix's on every build, wtf * [x] Clean-up code * [x] Double-check loc * [x] Remove a bunch of debug printing that we don't need anymore * [ ] File a separate PR for moving the file (indexer) commands into a common project, and re-use those here * [x] Add history support again! I totally tore that out * did that in #40427 * [x] make `shell:` paths and weird URI's just work. Good test is `x-cmdpal://settings` ### further optimizations that probably aren't blocking * [x] Our fast up-to-date is clearly broken, but I think that's been broken since early 0.91 * [x] If the exe doesn't change, we don't need to create a new ListItem for it. We can just re-use the current one, and just change the args * [ ] if the directory hasn't changed, but we typed more chars (e.g. `c:\windows\s` -> `c:\windows\sys`), we should cache the ListItem's from the first query, and re-use them if possible.
This commit is contained in:
@@ -15,21 +15,26 @@ internal sealed partial class FallbackExecuteSearchItem : FallbackCommandItem
|
||||
{
|
||||
private readonly SearchWebCommand _executeItem;
|
||||
private static readonly CompositeFormat PluginOpen = System.Text.CompositeFormat.Parse(Properties.Resources.plugin_open);
|
||||
private static readonly CompositeFormat SubtitleText = System.Text.CompositeFormat.Parse(Properties.Resources.web_search_fallback_subtitle);
|
||||
private string _title;
|
||||
|
||||
public FallbackExecuteSearchItem(SettingsManager settings)
|
||||
: base(new SearchWebCommand(string.Empty, settings) { Id = "com.microsoft.websearch.fallback" }, Resources.command_item_title)
|
||||
{
|
||||
_executeItem = (SearchWebCommand)this.Command!;
|
||||
Title = string.Empty;
|
||||
Subtitle = string.Empty;
|
||||
_executeItem.Name = string.Empty;
|
||||
Subtitle = string.Format(CultureInfo.CurrentCulture, PluginOpen, BrowserInfo.Name ?? BrowserInfo.MSEdgeName);
|
||||
_title = string.Format(CultureInfo.CurrentCulture, PluginOpen, BrowserInfo.Name ?? BrowserInfo.MSEdgeName);
|
||||
Icon = Icons.WebSearch;
|
||||
}
|
||||
|
||||
public override void UpdateQuery(string query)
|
||||
{
|
||||
_executeItem.Arguments = query;
|
||||
_executeItem.Name = string.IsNullOrEmpty(query) ? string.Empty : Properties.Resources.open_in_default_browser;
|
||||
Title = query;
|
||||
var isEmpty = string.IsNullOrEmpty(query);
|
||||
_executeItem.Name = isEmpty ? string.Empty : Properties.Resources.open_in_default_browser;
|
||||
Title = isEmpty ? string.Empty : _title;
|
||||
Subtitle = string.Format(CultureInfo.CurrentCulture, SubtitleText, query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,5 +248,14 @@ namespace Microsoft.CmdPal.Ext.WebSearch.Properties {
|
||||
return ResourceManager.GetString("settings_page_name", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Search for "{0}".
|
||||
/// </summary>
|
||||
public static string web_search_fallback_subtitle {
|
||||
get {
|
||||
return ResourceManager.GetString("web_search_fallback_subtitle", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,6 +178,9 @@
|
||||
<data name="settings_page_name" xml:space="preserve">
|
||||
<value>Settings</value>
|
||||
</data>
|
||||
<data name="web_search_fallback_subtitle" xml:space="preserve">
|
||||
<value>Search for "{0}"</value>
|
||||
</data>
|
||||
<data name="open_url_fallback_title" xml:space="preserve">
|
||||
<value>Open URL</value>
|
||||
</data>
|
||||
|
||||
Reference in New Issue
Block a user