Skip to content

Commit f927f3a

Browse files
authored
Merge pull request #2489 from flooxo/open_with
feat: Add open with option for files in context menu
2 parents 06e3452 + e14e7d0 commit f927f3a

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ public List<Result> LoadContextMenus(Result selectedResult)
5454

5555
contextMenus.Add(CreateOpenContainingFolderResult(record));
5656

57+
if (record.Type == ResultType.File)
58+
{
59+
contextMenus.Add(CreateOpenWithMenu(record));
60+
}
61+
5762
if (record.WindowsIndexed)
5863
{
5964
contextMenus.Add(CreateOpenWindowsIndexingOptions());
@@ -434,6 +439,22 @@ private Result CreateOpenWindowsIndexingOptions()
434439
};
435440
}
436441

442+
private Result CreateOpenWithMenu(SearchResult record)
443+
{
444+
return new Result
445+
{
446+
Title = Context.API.GetTranslation("plugin_explorer_openwith"),
447+
SubTitle = Context.API.GetTranslation("plugin_explorer_openwith_subtitle"),
448+
Action = _ =>
449+
{
450+
Process.Start("rundll32.exe", $"{Path.Combine(Environment.SystemDirectory, "shell32.dll")},OpenAs_RunDLL {record.FullPath}");
451+
return true;
452+
},
453+
IcoPath = Constants.ShowContextMenuImagePath,
454+
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\ue7ac"),
455+
};
456+
}
457+
437458
private void LogException(string message, Exception e)
438459
{
439460
Log.Exception($"|Flow.Launcher.Plugin.Folder.ContextMenu|{message}", e);

Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@
102102
<system:String x:Key="plugin_explorer_remove_from_quickaccess_title">Remove from Quick Access</system:String>
103103
<system:String x:Key="plugin_explorer_remove_from_quickaccess_subtitle">Remove current item from Quick Access</system:String>
104104
<system:String x:Key="plugin_explorer_show_contextmenu_title">Show Windows Context Menu</system:String>
105-
105+
<system:String x:Key="plugin_explorer_openwith">Open With</system:String>
106+
<system:String x:Key="plugin_explorer_openwith_subtitle">Select a program to open with</system:String>
107+
106108
<!-- Special Results-->
107109
<system:String x:Key="plugin_explorer_diskfreespace">{0} free of {1}</system:String>
108110
<system:String x:Key="plugin_explorer_openresultfolder">Open in Default File Manager</system:String>

0 commit comments

Comments
 (0)