Skip to content

Commit 8010179

Browse files
authored
Merge pull request #194 from taooceros/CustomizeExplorer
Add Exploere Customization
2 parents c254c93 + e16f0e4 commit 8010179

File tree

8 files changed

+57
-11
lines changed

8 files changed

+57
-11
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 6d5b687e240a6abdc5623d8a8e09501f3994b0d3

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@
4040
<system:String x:Key="flowlauncher_plugin_program_plugin_description">Search programs in Flow Launcher</system:String>
4141

4242
<system:String x:Key="flowlauncher_plugin_program_invalid_path">Invalid Path</system:String>
43-
43+
44+
<system:String x:Key="flowlauncher_plugin_program_customizedexplorer">Customized Explorer</system:String>
45+
<system:String x:Key="flowlauncher_plugin_program_args">Args</system:String>
46+
<system:String x:Key="flowlauncher_plugin_program_tooltip_customizedexplorer">You can customized the explorer used for opening the container folder by inputing the Environmental Variable of the explorer you want to use. It will be useful to use CMD to test whether the Environmental Variable is avaliable.</system:String>
47+
<system:String x:Key="flowlauncher_plugin_program_tooltip_args">Enter the customized args you want to add for your customized explorer. %s for parent directory, %f for full path (which only works for win32). Check the explorer's website for details.</system:String>
48+
4449
<!--Dialogs-->
4550
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success">Success</system:String>
4651
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success_message">Successfully disabled this program from displaying in your query</system:String>

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@ public List<Result> ContextMenus(IPublicAPI api)
324324

325325
Action = _ =>
326326
{
327-
Main.StartProcess(Process.Start, new ProcessStartInfo(Package.Location));
327+
Main.StartProcess(Process.Start, new ProcessStartInfo(
328+
!string.IsNullOrEmpty(Main._settings.CustomizedExplorer) ? Main._settings.CustomizedExplorer:Settings.Explorer,
329+
Main._settings.CustomizedArgs.Replace("%s",$"\"{Package.Location}\"").Trim()));
328330

329331
return true;
330332
},

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,19 @@ public List<Result> ContextMenus(IPublicAPI api)
140140
Title = api.GetTranslation("flowlauncher_plugin_program_open_containing_folder"),
141141
Action = _ =>
142142
{
143-
144-
145-
Main.StartProcess(Process.Start, new ProcessStartInfo("explorer", ParentDirectory));
146-
143+
var args = !string.IsNullOrWhiteSpace(Main._settings.CustomizedArgs)
144+
?Main._settings.CustomizedArgs
145+
.Replace("%s",$"\"{ParentDirectory}\"")
146+
.Replace("%f",$"\"{FullPath}\""):
147+
Main._settings.CustomizedExplorer==Settings.Explorer
148+
? $"/select,\"{FullPath}\""
149+
: Settings.ExplorerArgs;
150+
151+
Main.StartProcess(Process.Start, new ProcessStartInfo(
152+
!string.IsNullOrWhiteSpace(Main._settings.CustomizedExplorer)
153+
? Main._settings.CustomizedExplorer
154+
: Settings.Explorer,
155+
args));
147156
return true;
148157
},
149158
IcoPath = "Images/folder.png"

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ public class Settings
1414
public bool EnableStartMenuSource { get; set; } = true;
1515

1616
public bool EnableRegistrySource { get; set; } = true;
17+
public string CustomizedExplorer { get; set; } = Explorer;
18+
public string CustomizedArgs { get; set; } = ExplorerArgs;
1719

1820
internal const char SuffixSeperator = ';';
1921

22+
internal const string Explorer = "explorer";
23+
24+
internal const string ExplorerArgs = "%s";
25+
2026
/// <summary>
2127
/// Contains user added folder location contents as well as all user disabled applications
2228
/// </summary>

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:program="clr-namespace:Flow.Launcher.Plugin.Program"
77
mc:Ignorable="d"
8-
d:DesignHeight="300" d:DesignWidth="600">
8+
d:DesignHeight="404.508" d:DesignWidth="600">
99
<Grid Margin="10">
1010
<Grid.RowDefinitions>
1111
<RowDefinition Height="75"/>
1212
<RowDefinition Height="*"/>
1313
<RowDefinition Height="50"/>
14+
<RowDefinition Height="50"/>
1415
</Grid.RowDefinitions>
1516
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Stretch">
1617
<StackPanel Orientation="Vertical" Width="205">
@@ -24,7 +25,7 @@
2425
</StackPanel>
2526
</StackPanel>
2627
<ListView x:Name="programSourceView" Grid.Row="1" AllowDrop="True" SelectionMode="Extended" Style="{StaticResource {x:Static GridView.GridViewStyleKey}}"
27-
Margin="0 13 0 0"
28+
Margin="0,13,0,10"
2829
BorderBrush="DarkGray"
2930
BorderThickness="1"
3031
GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler"
@@ -63,17 +64,26 @@
6364
</GridView>
6465
</ListView.View>
6566
</ListView>
66-
<DockPanel Grid.Row="2">
67+
<DockPanel Grid.Row="2" Margin="0,0,0,0" Grid.RowSpan="1">
6768
<StackPanel x:Name="indexingPanel" Visibility="Hidden" HorizontalAlignment="Left" Orientation="Horizontal">
6869
<ProgressBar x:Name="progressBarIndexing" Height="20" Width="80" Minimum="0" Maximum="100" IsIndeterminate="True" />
6970
<TextBlock Margin="10 0 0 0" Height="20" HorizontalAlignment="Center" Text="{DynamicResource flowlauncher_plugin_program_indexing}" />
7071
</StackPanel>
7172
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
7273
<Button x:Name="btnProgramSourceStatus" Click="btnProgramSourceStatus_OnClick" Width="100" Margin="10" Content="{DynamicResource flowlauncher_plugin_program_disable}" />
7374
<Button x:Name="btnEditProgramSource" Click="btnEditProgramSource_OnClick" Width="100" Margin="10" Content="{DynamicResource flowlauncher_plugin_program_edit}"/>
74-
<Button x:Name="btnAddProgramSource" Click="btnAddProgramSource_OnClick" Width="100" Margin="10" Content="{DynamicResource flowlauncher_plugin_program_add}"/>
75+
<Button x:Name="btnAddProgramSource" Click="btnAddProgramSource_OnClick" Width="100" Margin="10 10 0 10" Content="{DynamicResource flowlauncher_plugin_program_add}"/>
7576
</StackPanel>
7677
</DockPanel>
78+
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Stretch">
79+
<TextBlock Text="{DynamicResource flowlauncher_plugin_program_customizedexplorer}" VerticalAlignment="Center" FontSize="15"
80+
ToolTip= "{DynamicResource flowlauncher_plugin_program_tooltip_customizedexplorer}"/>
81+
<TextBox Margin="10,0,10,0" TextWrapping="NoWrap" VerticalAlignment="Center" Width="200" Height="30" FontSize="15"
82+
TextChanged="CustomizeExplorer" x:Name="CustomizeExplorerBox"/>
83+
<TextBlock Text="{DynamicResource flowlauncher_plugin_program_args}" VerticalAlignment="Center" FontSize="15"
84+
ToolTip="{DynamicResource flowlauncher_plugin_program_tooltip_args}" />
85+
<TextBox Margin="10,0,0,0" Width="135" Height="30" FontSize="15" x:Name="CustomizeArgsBox" TextChanged="CustomizeExplorerArgs"></TextBox>
86+
</StackPanel>
7787
</Grid>
7888
</UserControl>
7989

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ private void Setting_Loaded(object sender, RoutedEventArgs e)
4343
StartMenuEnabled.IsChecked = _settings.EnableStartMenuSource;
4444
RegistryEnabled.IsChecked = _settings.EnableRegistrySource;
4545

46+
CustomizeExplorerBox.Text = _settings.CustomizedExplorer;
47+
CustomizeArgsBox.Text = _settings.CustomizedArgs;
48+
4649
ViewRefresh();
4750
}
4851

@@ -326,5 +329,15 @@ private void Row_OnClick(object sender, RoutedEventArgs e)
326329
btnProgramSourceStatus.Content = "Enable";
327330
}
328331
}
332+
333+
private void CustomizeExplorer(object sender, TextChangedEventArgs e)
334+
{
335+
_settings.CustomizedExplorer = CustomizeExplorerBox.Text;
336+
}
337+
338+
private void CustomizeExplorerArgs(object sender, TextChangedEventArgs e)
339+
{
340+
_settings.CustomizedArgs = CustomizeArgsBox.Text;
341+
}
329342
}
330343
}

Plugins/Flow.Launcher.Plugin.Program/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Name": "Program",
55
"Description": "Search programs in Flow.Launcher",
66
"Author": "qianlifeng",
7-
"Version": "1.0.0",
7+
"Version": "1.1.0",
88
"Language": "csharp",
99
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
1010
"ExecuteFileName": "Flow.Launcher.Plugin.Program.dll",

0 commit comments

Comments
 (0)