Files
PowerToys/src/modules/cmdpal/extensionsdk/Microsoft.CommandPalette.Extensions.Toolkit/Commands/CopyTextCommand.cs
Mike Griese 3a0487f74a cmdpal: Add "file" context items to the run items too (#40768)
After #39955, the "exe" items from the shell commands only ever have the
"Run{as admin, as other user}" commands. This adds the rest of the
"file" commands - copy path, open in explorer, etc.

This shuffles around some commands into the toolkit and common commands
project to make this easier.

<img width="814" height="505" alt="image"
src="https://github.com/user-attachments/assets/36ae2c75-d4d6-4762-98ec-796986f39c20"
/>
2025-07-28 20:03:49 -05:00

26 lines
773 B
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.
namespace Microsoft.CommandPalette.Extensions.Toolkit;
public partial class CopyTextCommand : InvokableCommand
{
public virtual string Text { get; set; }
public virtual CommandResult Result { get; set; } = CommandResult.ShowToast(Properties.Resources.CopyTextCommand_CopiedToClipboard);
public CopyTextCommand(string text)
{
Text = text;
Name = Properties.Resources.CopyTextCommand_Copy;
Icon = new IconInfo("\uE8C8");
}
public override ICommandResult Invoke()
{
ClipboardHelper.SetText(Text);
return Result;
}
}