Support copy file name

This commit is contained in:
Jack251970 2025-05-11 09:28:55 +08:00
parent 7c8a4379a3
commit 0c7d0e9300
3 changed files with 25 additions and 1 deletions

View file

@ -140,6 +140,29 @@ namespace Flow.Launcher.Plugin.Explorer
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\ue8c8")
});
contextMenus.Add(new Result
{
Title = Context.API.GetTranslation("plugin_explorer_copyname"),
SubTitle = Context.API.GetTranslation("plugin_explorer_copyname_subtitle"),
Action = _ =>
{
try
{
Context.API.CopyToClipboard(Path.GetFileName(record.FullPath));
return true;
}
catch (Exception e)
{
var message = "Fail to set text in clipboard";
LogException(message, e);
Context.API.ShowMsg(message);
return false;
}
},
IcoPath = Constants.CopyImagePath,
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\ue8c8")
});
contextMenus.Add(new Result
{
Title = Context.API.GetTranslation("plugin_explorer_copyfilefolder"),

View file

@ -82,6 +82,8 @@
<!-- Context menu items -->
<system:String x:Key="plugin_explorer_copypath">Copy path</system:String>
<system:String x:Key="plugin_explorer_copypath_subtitle">Copy path of current item to clipboard</system:String>
<system:String x:Key="plugin_explorer_copyname">Copy name</system:String>
<system:String x:Key="plugin_explorer_copyname_subtitle">Copy name of current item to clipboard</system:String>
<system:String x:Key="plugin_explorer_copyfilefolder">Copy</system:String>
<system:String x:Key="plugin_explorer_copyfile_subtitle">Copy current file to clipboard</system:String>
<system:String x:Key="plugin_explorer_copyfolder_subtitle">Copy current folder to clipboard</system:String>

View file

@ -8,7 +8,6 @@ using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Flow.Launcher.Plugin.Explorer.Exceptions;