mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
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.
46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
// Copyright (c) Microsoft Corporation
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
using Microsoft.CmdPal.Ext.Shell.Helpers;
|
|
using Microsoft.CmdPal.Ext.Shell.Pages;
|
|
using Microsoft.CmdPal.Ext.Shell.Properties;
|
|
using Microsoft.CommandPalette.Extensions;
|
|
using Microsoft.CommandPalette.Extensions.Toolkit;
|
|
|
|
namespace Microsoft.CmdPal.Ext.Shell;
|
|
|
|
public partial class ShellCommandsProvider : CommandProvider
|
|
{
|
|
private readonly CommandItem _shellPageItem;
|
|
|
|
private readonly SettingsManager _settingsManager = new();
|
|
private readonly FallbackCommandItem _fallbackItem;
|
|
|
|
public ShellCommandsProvider()
|
|
{
|
|
Id = "Run";
|
|
DisplayName = Resources.cmd_plugin_name;
|
|
Icon = Icons.RunV2Icon;
|
|
Settings = _settingsManager.Settings;
|
|
|
|
_fallbackItem = new FallbackExecuteItem(_settingsManager);
|
|
|
|
_shellPageItem = new CommandItem(new ShellListPage(_settingsManager))
|
|
{
|
|
Icon = Icons.RunV2Icon,
|
|
Title = Resources.shell_command_name,
|
|
Subtitle = Resources.cmd_plugin_description,
|
|
MoreCommands = [
|
|
new CommandContextItem(Settings.SettingsPage),
|
|
],
|
|
};
|
|
}
|
|
|
|
public override ICommandItem[] TopLevelCommands() => [_shellPageItem];
|
|
|
|
public override IFallbackCommandItem[]? FallbackCommands() => [_fallbackItem];
|
|
|
|
public static bool SuppressFileFallbackIf(string query) => FallbackExecuteItem.SuppressFileFallbackIf(query);
|
|
}
|