Skip to content

Commit 5ee6c4b

Browse files
committed
Migrate Program Plugin Custom Explorer
1 parent 992735f commit 5ee6c4b

File tree

4 files changed

+3
-33
lines changed

4 files changed

+3
-33
lines changed

Plugins/Flow.Launcher.Plugin.Program/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class Main : ISettingProvider, IAsyncPlugin, IPluginI18n, IContextMenu, I
2626

2727
private static bool IsStartupIndexProgramsRequired => _settings.LastIndexTime.AddDays(3) < DateTime.Today;
2828

29-
private static PluginInitContext _context;
29+
internal static PluginInitContext Context { get; private set; }
3030

3131
private static BinaryStorage<Win32[]> _win32Storage;
3232
private static BinaryStorage<UWP.Application[]> _uwpStorage;

Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,7 @@ public List<Result> ContextMenus(IPublicAPI api)
362362

363363
Action = _ =>
364364
{
365-
Main.StartProcess(Process.Start,
366-
new ProcessStartInfo(
367-
!string.IsNullOrEmpty(Main._settings.CustomizedExplorer)
368-
? Main._settings.CustomizedExplorer
369-
: Settings.Explorer,
370-
Main._settings.CustomizedArgs
371-
.Replace("%s",$"\"{Package.Location}\"")
372-
.Trim()));
365+
Main.Context.API.OpenDirectory(Package.Location);
373366

374367
return true;
375368
},

Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -177,20 +177,7 @@ public List<Result> ContextMenus(IPublicAPI api)
177177
Title = api.GetTranslation("flowlauncher_plugin_program_open_containing_folder"),
178178
Action = _ =>
179179
{
180-
var args = !string.IsNullOrWhiteSpace(Main._settings.CustomizedArgs)
181-
? Main._settings.CustomizedArgs
182-
.Replace("%s", $"\"{ParentDirectory}\"")
183-
.Replace("%f", $"\"{FullPath}\"")
184-
: Main._settings.CustomizedExplorer == Settings.Explorer
185-
? $"/select,\"{FullPath}\""
186-
: Settings.ExplorerArgs;
187-
188-
Main.StartProcess(Process.Start,
189-
new ProcessStartInfo(
190-
!string.IsNullOrWhiteSpace(Main._settings.CustomizedExplorer)
191-
? Main._settings.CustomizedExplorer
192-
: Settings.Explorer,
193-
args));
180+
Main.Context.API.OpenDirectory(ParentDirectory, FullPath);
194181

195182
return true;
196183
},

Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<RowDefinition Height="120"/>
1313
<RowDefinition Height="*"/>
1414
<RowDefinition Height="50"/>
15-
<RowDefinition Height="50"/>
1615
</Grid.RowDefinitions>
1716
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Stretch">
1817
<StackPanel Orientation="Vertical" Width="Auto">
@@ -77,15 +76,6 @@
7776
<Button x:Name="btnAddProgramSource" Click="btnAddProgramSource_OnClick" Width="100" Margin="10 10 0 10" Content="{DynamicResource flowlauncher_plugin_program_add}"/>
7877
</StackPanel>
7978
</DockPanel>
80-
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Stretch">
81-
<TextBlock Text="{DynamicResource flowlauncher_plugin_program_customizedexplorer}" VerticalAlignment="Center" FontSize="15"
82-
ToolTip= "{DynamicResource flowlauncher_plugin_program_tooltip_customizedexplorer}"/>
83-
<TextBox Margin="10,0,10,0" TextWrapping="NoWrap" VerticalAlignment="Center" Width="200" Height="30" FontSize="15"
84-
Text="{Binding CustomizedExplorerPath}" x:Name="CustomizeExplorerBox"/>
85-
<TextBlock Text="{DynamicResource flowlauncher_plugin_program_args}" VerticalAlignment="Center" FontSize="15"
86-
ToolTip="{DynamicResource flowlauncher_plugin_program_tooltip_args}" />
87-
<TextBox Margin="10,0,0,0" Width="135" Height="30" FontSize="15" x:Name="CustomizeArgsBox" Text="{Binding CustomizedExplorerArg}"></TextBox>
88-
</StackPanel>
8979
</Grid>
9080
</UserControl>
9181

0 commit comments

Comments
 (0)