mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #2489 from flooxo/open_with
feat: Add open with option for files in context menu
This commit is contained in:
commit
f927f3aa83
2 changed files with 24 additions and 1 deletions
|
|
@ -54,6 +54,11 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
contextMenus.Add(CreateOpenContainingFolderResult(record));
|
||||
|
||||
if (record.Type == ResultType.File)
|
||||
{
|
||||
contextMenus.Add(CreateOpenWithMenu(record));
|
||||
}
|
||||
|
||||
if (record.WindowsIndexed)
|
||||
{
|
||||
contextMenus.Add(CreateOpenWindowsIndexingOptions());
|
||||
|
|
@ -434,6 +439,22 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
};
|
||||
}
|
||||
|
||||
private Result CreateOpenWithMenu(SearchResult record)
|
||||
{
|
||||
return new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_openwith"),
|
||||
SubTitle = Context.API.GetTranslation("plugin_explorer_openwith_subtitle"),
|
||||
Action = _ =>
|
||||
{
|
||||
Process.Start("rundll32.exe", $"{Path.Combine(Environment.SystemDirectory, "shell32.dll")},OpenAs_RunDLL {record.FullPath}");
|
||||
return true;
|
||||
},
|
||||
IcoPath = Constants.ShowContextMenuImagePath,
|
||||
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\ue7ac"),
|
||||
};
|
||||
}
|
||||
|
||||
private void LogException(string message, Exception e)
|
||||
{
|
||||
Log.Exception($"|Flow.Launcher.Plugin.Folder.ContextMenu|{message}", e);
|
||||
|
|
|
|||
|
|
@ -102,7 +102,9 @@
|
|||
<system:String x:Key="plugin_explorer_remove_from_quickaccess_title">Remove from Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_remove_from_quickaccess_subtitle">Remove current item from Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_show_contextmenu_title">Show Windows Context Menu</system:String>
|
||||
|
||||
<system:String x:Key="plugin_explorer_openwith">Open With</system:String>
|
||||
<system:String x:Key="plugin_explorer_openwith_subtitle">Select a program to open with</system:String>
|
||||
|
||||
<!-- Special Results-->
|
||||
<system:String x:Key="plugin_explorer_diskfreespace">{0} free of {1}</system:String>
|
||||
<system:String x:Key="plugin_explorer_openresultfolder">Open in Default File Manager</system:String>
|
||||
|
|
|
|||
Loading…
Reference in a new issue