Skip to content

Commit 96bcf1b

Browse files
authored
Merge pull request #835 from onesounds/AdjustProgramPlugin
Hide Apps Path & Adjust program plugin setting panel
2 parents b134e0e + 594075d commit 96bcf1b

File tree

12 files changed

+342
-112
lines changed

12 files changed

+342
-112
lines changed
Lines changed: 126 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,132 @@
1-
<Window x:Class="Flow.Launcher.Plugin.Program.AddProgramSource"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
mc:Ignorable="d"
7-
Width="400"
8-
Height="130"
9-
WindowStartupLocation="CenterScreen">
1+
<Window
2+
x:Class="Flow.Launcher.Plugin.Program.AddProgramSource"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
Title="{DynamicResource flowlauncher_plugin_program_directory}"
8+
Width="400"
9+
Background="{DynamicResource PopuBGColor}"
10+
Foreground="{DynamicResource PopupTextColor}"
11+
SizeToContent="Height"
12+
WindowStartupLocation="CenterScreen"
13+
mc:Ignorable="d">
14+
<WindowChrome.WindowChrome>
15+
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
16+
</WindowChrome.WindowChrome>
17+
<Grid>
18+
<Grid.RowDefinitions>
19+
<RowDefinition />
20+
<RowDefinition Height="80" />
21+
</Grid.RowDefinitions>
22+
23+
<StackPanel Grid.Row="0">
24+
<StackPanel>
25+
<Grid>
26+
<Grid.ColumnDefinitions>
27+
<ColumnDefinition Width="Auto" />
28+
<ColumnDefinition Width="*" />
29+
<ColumnDefinition Width="Auto" />
30+
<ColumnDefinition Width="Auto" />
31+
<ColumnDefinition Width="Auto" />
32+
</Grid.ColumnDefinitions>
33+
<Button
34+
Grid.Column="4"
35+
Click="BtnCancel_OnClick"
36+
Style="{StaticResource TitleBarCloseButtonStyle}">
37+
<Path
38+
Width="46"
39+
Height="32"
40+
Data="M 18,11 27,20 M 18,20 27,11"
41+
Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
42+
StrokeThickness="1">
43+
<Path.Style>
44+
<Style TargetType="Path">
45+
<Style.Triggers>
46+
<DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="False">
47+
<Setter Property="Opacity" Value="0.5" />
48+
</DataTrigger>
49+
</Style.Triggers>
50+
</Style>
51+
</Path.Style>
52+
</Path>
53+
</Button>
54+
</Grid>
55+
</StackPanel>
56+
<StackPanel Margin="26,12,26,0">
57+
<StackPanel Margin="0,0,0,12">
58+
<TextBlock
59+
Grid.Column="0"
60+
Margin="0,0,0,0"
61+
FontFamily="Segoe UI"
62+
FontSize="20"
63+
FontWeight="SemiBold"
64+
Text="{DynamicResource flowlauncher_plugin_program_directory}"
65+
TextAlignment="Left" />
66+
</StackPanel>
67+
<StackPanel Margin="0,0,0,10" Orientation="Horizontal">
68+
<TextBox
69+
Name="Directory"
70+
Width="268"
71+
Margin="0,7"
72+
VerticalAlignment="Center" />
73+
<Button
74+
Width="70"
75+
Margin="10"
76+
HorizontalAlignment="Right"
77+
Click="BrowseButton_Click"
78+
Content="{DynamicResource flowlauncher_plugin_program_browse}" />
79+
</StackPanel>
80+
</StackPanel>
81+
</StackPanel>
82+
<Border
83+
Grid.Row="1"
84+
Background="{DynamicResource PopupButtonAreaBGColor}"
85+
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
86+
BorderThickness="0,1,0,0">
87+
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
88+
<Button
89+
x:Name="btnCancel"
90+
Width="100"
91+
Margin="0,0,5,0"
92+
Click="BtnCancel_OnClick"
93+
Content="{DynamicResource cancel}" />
94+
95+
<Button
96+
Width="100"
97+
Margin="5,0,0,0"
98+
HorizontalAlignment="Right"
99+
Click="ButtonAdd_OnClick"
100+
Content="{DynamicResource flowlauncher_plugin_program_update}" />
101+
</StackPanel>
102+
</Border>
103+
</Grid>
104+
<!--
10105
<StackPanel Orientation="Vertical">
11106
<StackPanel Orientation="Horizontal">
12-
<Label Content="{DynamicResource flowlauncher_plugin_program_directory}" Margin="15,10"/>
13-
<TextBox Name="Directory" VerticalAlignment="Center" Width="278" Margin="10,7" />
107+
<Label Margin="15,10" Content="{DynamicResource flowlauncher_plugin_program_directory}" />
108+
<TextBox
109+
Name="Directory"
110+
Width="278"
111+
Margin="10,7"
112+
VerticalAlignment="Center" />
14113
</StackPanel>
15-
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
16-
<Button Click="BrowseButton_Click" Content="{DynamicResource flowlauncher_plugin_program_browse}"
17-
HorizontalAlignment="Right" Margin="10" Height="31" Width="70" />
18-
<Button Click="ButtonAdd_OnClick" Content="{DynamicResource flowlauncher_plugin_program_update}"
19-
HorizontalAlignment="Right" Margin="10" Height="31" Width="70" />
114+
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
115+
<Button
116+
Width="70"
117+
Height="31"
118+
Margin="10"
119+
HorizontalAlignment="Right"
120+
Click="BrowseButton_Click"
121+
Content="{DynamicResource flowlauncher_plugin_program_browse}" />
122+
<Button
123+
Width="70"
124+
Height="31"
125+
Margin="10"
126+
HorizontalAlignment="Right"
127+
Click="ButtonAdd_OnClick"
128+
Content="{DynamicResource flowlauncher_plugin_program_update}" />
20129
</StackPanel>
21130
</StackPanel>
131+
-->
22132
</Window>

Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ private void BrowseButton_Click(object sender, RoutedEventArgs e)
4242
}
4343
}
4444

45+
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
46+
{
47+
Close();
48+
}
49+
4550
private void ButtonAdd_OnClick(object sender, RoutedEventArgs e)
4651
{
4752
string s = Directory.Text;

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3-
xmlns:system="clr-namespace:System;assembly=mscorlib">
1+
<ResourceDictionary
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:system="clr-namespace:System;assembly=mscorlib">
45

5-
<!--Program setting-->
6+
<!-- Program setting -->
67
<system:String x:Key="flowlauncher_plugin_program_delete">Delete</system:String>
78
<system:String x:Key="flowlauncher_plugin_program_edit">Edit</system:String>
89
<system:String x:Key="flowlauncher_plugin_program_add">Add</system:String>
@@ -16,12 +17,14 @@
1617
<system:String x:Key="flowlauncher_plugin_program_index_start_tooltip">When enabled, Flow will load programs from the start menu</system:String>
1718
<system:String x:Key="flowlauncher_plugin_program_index_registry">Index Registry</system:String>
1819
<system:String x:Key="flowlauncher_plugin_program_index_registry_tooltip">When enabled, Flow will load programs from the registry</system:String>
19-
<system:String x:Key="flowlauncher_plugin_program_enable_description">Enable Program Description</system:String>
20+
<system:String x:Key="flowlauncher_plugin_program_enable_hidelnkpath">Hide app path</system:String>
21+
<system:String x:Key="flowlauncher_plugin_program_enable_hidelnkpath_tooltip">For executable files such as UWP or lnk, hide the file path from being visible</system:String>
22+
<system:String x:Key="flowlauncher_plugin_program_enable_description">Search in Program Description</system:String>
2023
<system:String x:Key="flowlauncher_plugin_program_enable_description_tooltip">Disabling this will also stop Flow from searching via the program desciption</system:String>
2124
<system:String x:Key="flowlauncher_plugin_program_suffixes_header">Suffixes</system:String>
2225
<system:String x:Key="flowlauncher_plugin_program_max_depth_header">Max Depth</system:String>
2326

24-
<system:String x:Key="flowlauncher_plugin_program_directory">Directory:</system:String>
27+
<system:String x:Key="flowlauncher_plugin_program_directory">Directory</system:String>
2528
<system:String x:Key="flowlauncher_plugin_program_browse">Browse</system:String>
2629
<system:String x:Key="flowlauncher_plugin_program_file_suffixes">File Suffixes:</system:String>
2730
<system:String x:Key="flowlauncher_plugin_program_max_search_depth">Maximum Search Depth (-1 is unlimited):</system:String>
@@ -30,8 +33,7 @@
3033
<system:String x:Key="flowlauncher_plugin_program_delete_program_source">Are you sure you want to delete the selected program sources?</system:String>
3134

3235
<system:String x:Key="flowlauncher_plugin_program_update">OK</system:String>
33-
<system:String x:Key="flowlauncher_plugin_program_only_index_tip">Flow Launcher will only index files that end with the following suffixes:</system:String>
34-
<system:String x:Key="flowlauncher_plugin_program_split_by_tip">(Each suffix should split by ';' )</system:String>
36+
<system:String x:Key="flowlauncher_plugin_program_only_index_tip">Flow Launcher will only index files that end with the following suffixes. (Each suffix should split by ';' )</system:String>
3537
<system:String x:Key="flowlauncher_plugin_program_update_file_suffixes">Successfully updated file suffixes</system:String>
3638
<system:String x:Key="flowlauncher_plugin_program_suffixes_cannot_empty">File suffixes can't be empty</system:String>
3739

@@ -50,7 +52,7 @@
5052
<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>
5153
<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>
5254

53-
<!--Dialogs-->
55+
<!-- Dialogs -->
5456
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success">Success</system:String>
5557
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success_message">Successfully disabled this program from displaying in your query</system:String>
5658
<system:String x:Key="flowlauncher_plugin_program_run_as_administrator_not_supported_message">This app is not intended to be run as administrator</system:String>

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,15 @@ public static async Task IndexPrograms()
147147
var t1 = Task.Run(IndexWin32Programs);
148148
var t2 = Task.Run(IndexUwpPrograms);
149149
await Task.WhenAll(t1, t2).ConfigureAwait(false);
150+
ResetCache();
151+
_settings.LastIndexTime = DateTime.Today;
152+
}
153+
154+
internal static void ResetCache()
155+
{
150156
var oldCache = cache;
151157
cache = new MemoryCache(cacheOptions);
152158
oldCache.Dispose();
153-
_settings.LastIndexTime = DateTime.Today;
154159
}
155160

156161
public Control CreateSettingPanel()

Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml

Lines changed: 98 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,101 @@
1-
<Window x:Class="Flow.Launcher.Plugin.Program.ProgramSuffixes"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
mc:Ignorable="d"
7-
Width="400"
8-
Height="180"
9-
WindowStartupLocation="CenterScreen"
10-
d:DesignHeight="400" d:DesignWidth="300">
11-
<StackPanel>
12-
<TextBlock Margin="10 10 0 0" Foreground="Gray" Text="{DynamicResource flowlauncher_plugin_program_only_index_tip}" />
13-
<TextBlock Margin="10 10 0 0" Foreground="Gray" Text="{DynamicResource flowlauncher_plugin_program_split_by_tip}" />
14-
<TextBox x:Name="tbSuffixes" Margin="10"/>
15-
<Button HorizontalAlignment="Right" Height="30" Width="80" Click="ButtonBase_OnClick" Margin="0 0 10 0" Content="{DynamicResource flowlauncher_plugin_program_update}" />
16-
</StackPanel>
1+
<Window
2+
x:Class="Flow.Launcher.Plugin.Program.ProgramSuffixes"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
Title="{DynamicResource flowlauncher_plugin_program_suffixes}"
8+
Width="400"
9+
Background="{DynamicResource PopuBGColor}"
10+
Foreground="{DynamicResource PopupTextColor}"
11+
ResizeMode="NoResize"
12+
SizeToContent="Height"
13+
WindowStartupLocation="CenterScreen"
14+
mc:Ignorable="d">
15+
<WindowChrome.WindowChrome>
16+
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
17+
</WindowChrome.WindowChrome>
18+
<Grid>
19+
<Grid.RowDefinitions>
20+
<RowDefinition />
21+
<RowDefinition Height="80" />
22+
</Grid.RowDefinitions>
23+
24+
<StackPanel Grid.Row="0">
25+
<StackPanel>
26+
<Grid>
27+
<Grid.ColumnDefinitions>
28+
<ColumnDefinition Width="Auto" />
29+
<ColumnDefinition Width="*" />
30+
<ColumnDefinition Width="Auto" />
31+
<ColumnDefinition Width="Auto" />
32+
<ColumnDefinition Width="Auto" />
33+
</Grid.ColumnDefinitions>
34+
<Button
35+
Grid.Column="4"
36+
Click="BtnCancel_OnClick"
37+
Style="{StaticResource TitleBarCloseButtonStyle}">
38+
<Path
39+
Width="46"
40+
Height="32"
41+
Data="M 18,11 27,20 M 18,20 27,11"
42+
Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
43+
StrokeThickness="1">
44+
<Path.Style>
45+
<Style TargetType="Path">
46+
<Style.Triggers>
47+
<DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="False">
48+
<Setter Property="Opacity" Value="0.5" />
49+
</DataTrigger>
50+
</Style.Triggers>
51+
</Style>
52+
</Path.Style>
53+
</Path>
54+
</Button>
55+
</Grid>
56+
</StackPanel>
57+
<StackPanel Margin="26,12,26,0">
58+
<StackPanel Margin="0,0,0,12">
59+
<TextBlock
60+
Grid.Column="0"
61+
Margin="0,0,0,0"
62+
FontFamily="Segoe UI"
63+
FontSize="20"
64+
FontWeight="SemiBold"
65+
Text="{DynamicResource flowlauncher_plugin_program_suffixes}"
66+
TextAlignment="Left" />
67+
</StackPanel>
68+
<TextBlock
69+
FontSize="14"
70+
Text="{DynamicResource flowlauncher_plugin_program_only_index_tip}"
71+
TextWrapping="Wrap" />
72+
<TextBox x:Name="tbSuffixes" Margin="0,20,0,20" />
73+
</StackPanel>
74+
</StackPanel>
75+
<Border
76+
Grid.Row="1"
77+
Background="{DynamicResource PopupButtonAreaBGColor}"
78+
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
79+
BorderThickness="0,1,0,0">
80+
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
81+
<Button
82+
x:Name="btnCancel"
83+
Width="100"
84+
Height="30"
85+
Margin="0,0,5,0"
86+
Click="BtnCancel_OnClick"
87+
Content="{DynamicResource cancel}" />
88+
89+
<Button
90+
Width="100"
91+
Height="30"
92+
Margin="5,0,0,0"
93+
HorizontalAlignment="Right"
94+
Click="ButtonBase_OnClick"
95+
Content="{DynamicResource flowlauncher_plugin_program_update}" />
96+
</StackPanel>
97+
</Border>
98+
</Grid>
1799
</Window>
18100

19101

Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ public ProgramSuffixes(PluginInitContext context, Settings settings)
1818
_settings = settings;
1919
tbSuffixes.Text = string.Join(Settings.SuffixSeperator.ToString(), _settings.ProgramSuffixes);
2020
}
21-
21+
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
22+
{
23+
Close();
24+
}
2225
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
2326
{
2427
var suffixes = tbSuffixes.Text.Split(Settings.SuffixSeperator, StringSplitOptions.RemoveEmptyEntries);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ public Result Result(string query, IPublicAPI api)
314314
var result = new Result
315315
{
316316
Title = title,
317-
SubTitle = Package.Location,
317+
SubTitle = Main._settings.HideAppsPath ? string.Empty : Package.Location,
318318
Icon = Logo,
319319
Score = matchResult.Score,
320320
TitleHighlightData = matchResult.MatchData,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public Result Result(string query, IPublicAPI api)
9797
var result = new Result
9898
{
9999
Title = title,
100-
SubTitle = LnkResolvedPath ?? FullPath,
100+
SubTitle = Main._settings.HideAppsPath ? string.Empty : LnkResolvedPath ?? FullPath,
101101
IcoPath = IcoPath,
102102
Score = matchResult.Score,
103103
TitleHighlightData = matchResult.MatchData,

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ public class Settings
1313

1414
public bool EnableStartMenuSource { get; set; } = true;
1515

16-
public bool EnableDescription { get; set; } = true;
16+
public bool EnableDescription { get; set; } = false;
17+
public bool HideAppsPath { get; set; } = true;
1718
public bool EnableRegistrySource { get; set; } = true;
1819
public string CustomizedExplorer { get; set; } = Explorer;
1920
public string CustomizedArgs { get; set; } = ExplorerArgs;

0 commit comments

Comments
 (0)