mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
CmdPal: Display correct context items for run fallback (#39521)
Corrected the Run fallback handler to provide the same context items as it does on the run page.  **Closes:** #39092
This commit is contained in:
@@ -12,10 +12,12 @@ namespace Microsoft.CmdPal.Ext.Shell;
|
|||||||
internal sealed partial class FallbackExecuteItem : FallbackCommandItem
|
internal sealed partial class FallbackExecuteItem : FallbackCommandItem
|
||||||
{
|
{
|
||||||
private readonly ExecuteItem _executeItem;
|
private readonly ExecuteItem _executeItem;
|
||||||
|
private readonly SettingsManager _settings;
|
||||||
|
|
||||||
public FallbackExecuteItem(SettingsManager settings)
|
public FallbackExecuteItem(SettingsManager settings)
|
||||||
: base(new ExecuteItem(string.Empty, settings), Resources.shell_command_display_title)
|
: base(new ExecuteItem(string.Empty, settings), Resources.shell_command_display_title)
|
||||||
{
|
{
|
||||||
|
_settings = settings;
|
||||||
_executeItem = (ExecuteItem)this.Command!;
|
_executeItem = (ExecuteItem)this.Command!;
|
||||||
Title = string.Empty;
|
Title = string.Empty;
|
||||||
_executeItem.Name = string.Empty;
|
_executeItem.Name = string.Empty;
|
||||||
@@ -28,5 +30,9 @@ internal sealed partial class FallbackExecuteItem : FallbackCommandItem
|
|||||||
_executeItem.Cmd = query;
|
_executeItem.Cmd = query;
|
||||||
_executeItem.Name = string.IsNullOrEmpty(query) ? string.Empty : Properties.Resources.generic_run_command;
|
_executeItem.Name = string.IsNullOrEmpty(query) ? string.Empty : Properties.Resources.generic_run_command;
|
||||||
Title = query;
|
Title = query;
|
||||||
|
MoreCommands = [
|
||||||
|
new CommandContextItem(new ExecuteItem(query, _settings, RunAsType.Administrator)),
|
||||||
|
new CommandContextItem(new ExecuteItem(query, _settings, RunAsType.OtherUser)),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user