Merge pull request #3526 from Flow-Launcher/copy_file_name

Support copy file name
This commit is contained in:
Jack Ye 2025-05-11 19:08:34 +08:00 committed by GitHub
commit 63aabd5f1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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;