Merge remote-tracking branch 'upstream/dev' into FixProgramUID

This commit is contained in:
Vic 2022-11-14 15:25:40 +08:00
commit 2ea310ce37
9 changed files with 373 additions and 238 deletions

View file

@ -116,7 +116,7 @@
<Target Name="PreBuild" BeforeTargets="PreBuildEvent"> <Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="taskkill /f /fi &quot;IMAGENAME eq Flow.Launcher.exe&quot;" /> <Exec Command="taskkill /f /fi &quot;IMAGENAME eq Flow.Launcher.exe&quot;" />
</Target> </Target>
<Target Name="RemoveDuplicateAnalyzers" BeforeTargets="CoreCompile"> <Target Name="RemoveDuplicateAnalyzers" BeforeTargets="CoreCompile">
<!-- Work around https://github.com/dotnet/wpf/issues/6792 --> <!-- Work around https://github.com/dotnet/wpf/issues/6792 -->

View file

@ -2044,31 +2044,43 @@
<Border Padding="{TemplateBinding Padding}"> <Border Padding="{TemplateBinding Padding}">
<Grid Background="Transparent" SnapsToDevicePixels="False"> <Grid Background="Transparent" SnapsToDevicePixels="False">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="19" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Ellipse
x:Name="circle"
Width="19"
Height="19"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Stroke="Transparent" />
<Path
x:Name="arrow"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 1,1.5 L 4.5,5 L 8,1.5"
SnapsToDevicePixels="false"
Stroke="#666"
StrokeThickness="1" />
<ContentPresenter <ContentPresenter
Grid.Column="1" Grid.Column="0"
Margin="4,0,0,0" Margin="0,0,0,0"
HorizontalAlignment="Left" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
RecognizesAccessKey="True" RecognizesAccessKey="True"
SnapsToDevicePixels="True" /> SnapsToDevicePixels="True" />
<Grid
x:Name="ChevronGrid"
Grid.Column="1"
Margin="0"
VerticalAlignment="Center"
Background="Transparent"
RenderTransformOrigin="0.5, 0.5">
<Grid.RenderTransform>
<RotateTransform Angle="0" />
</Grid.RenderTransform>
<Ellipse
x:Name="circle"
Width="19"
Height="19"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Stroke="Transparent" />
<Path
x:Name="arrow"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 1,1.5 L 4.5,5 L 8,1.5"
SnapsToDevicePixels="false"
Stroke="#666"
StrokeThickness="1" />
</Grid>
</Grid> </Grid>
</Border> </Border>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
@ -2077,12 +2089,12 @@
</Trigger> </Trigger>
<Trigger Property="IsMouseOver" Value="true"> <Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="circle" Property="Stroke" Value="Transparent" /> <Setter TargetName="circle" Property="Stroke" Value="Transparent" />
<Setter TargetName="arrow" Property="Stroke" Value="#222" /> <Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Color05B}" />
</Trigger> </Trigger>
<Trigger Property="IsPressed" Value="true"> <Trigger Property="IsPressed" Value="true">
<Setter TargetName="circle" Property="Stroke" Value="Transparent" /> <Setter TargetName="circle" Property="Stroke" Value="Transparent" />
<Setter TargetName="circle" Property="StrokeThickness" Value="1.5" /> <Setter TargetName="circle" Property="StrokeThickness" Value="1.5" />
<Setter TargetName="arrow" Property="Stroke" Value="#FF003366" /> <Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Color17B}" />
</Trigger> </Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
@ -2110,7 +2122,7 @@
x:Name="HeaderSite" x:Name="HeaderSite"
MinWidth="0" MinWidth="0"
MinHeight="0" MinHeight="0"
Margin="18,0,0,0" Margin="18,0,18,0"
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
@ -2127,19 +2139,62 @@
Foreground="{TemplateBinding Foreground}" Foreground="{TemplateBinding Foreground}"
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ExpanderDownHeaderStyle}" /> Style="{StaticResource ExpanderDownHeaderStyle}" />
<ContentPresenter <Border x:Name="ContentPresenterBorder">
x:Name="ExpandSite" <ContentPresenter
Margin="{TemplateBinding Padding}" x:Name="ExpandSite"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
DockPanel.Dock="Bottom" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Focusable="false" DockPanel.Dock="Bottom"
Visibility="Collapsed" /> Focusable="false" />
<Border.LayoutTransform>
<ScaleTransform ScaleY="0" />
</Border.LayoutTransform>
</Border>
</DockPanel> </DockPanel>
</Border> </Border>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="true"> <Trigger Property="IsExpanded" Value="true">
<Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" /> <Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
<Setter TargetName="ContentPresenterBorder" Property="BorderThickness" Value="0,1,0,0" />
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="ContentPresenterBorder"
Storyboard.TargetProperty="(Border.LayoutTransform).(ScaleTransform.ScaleY)"
From="0.0"
To="1.0"
Duration="00:00:00.00" />
<DoubleAnimation
Storyboard.TargetName="ContentPresenterBorder"
Storyboard.TargetProperty="(Border.Opacity)"
From="0.0"
To="1.0"
Duration="00:00:00.00" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="ContentPresenterBorder"
Storyboard.TargetProperty="(Border.LayoutTransform).(ScaleTransform.ScaleY)"
From="1.0"
To="0"
Duration="00:00:00.00" />
<!-- Animation 00:00:00.167 -->
<DoubleAnimation
Storyboard.TargetName="ContentPresenterBorder"
Storyboard.TargetProperty="(Border.Opacity)"
From="1.0"
To="0.0"
Duration="00:00:00.00" />
<!-- Animation 00:00:00.167 -->
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger> </Trigger>
<Trigger Property="ExpandDirection" Value="Right"> <Trigger Property="ExpandDirection" Value="Right">
<Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Right" /> <Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Right" />

View file

@ -48,10 +48,9 @@
<scm:SortDescription PropertyName="Source" /> <scm:SortDescription PropertyName="Source" />
</CollectionViewSource.SortDescriptions> </CollectionViewSource.SortDescriptions>
</CollectionViewSource> </CollectionViewSource>
<CollectionViewSource x:Key="PluginStoreCollectionView" <CollectionViewSource x:Key="PluginStoreCollectionView" Source="{Binding ExternalPlugins}">
Source="{Binding ExternalPlugins}">
<CollectionViewSource.GroupDescriptions> <CollectionViewSource.GroupDescriptions>
<PropertyGroupDescription PropertyName="Category"></PropertyGroupDescription> <PropertyGroupDescription PropertyName="Category" />
</CollectionViewSource.GroupDescriptions> </CollectionViewSource.GroupDescriptions>
</CollectionViewSource> </CollectionViewSource>
@ -95,7 +94,6 @@
<Setter Property="Margin" Value="0,5,0,0" /> <Setter Property="Margin" Value="0,5,0,0" />
<Setter Property="Padding" Value="0,15,0,15" /> <Setter Property="Padding" Value="0,15,0,15" />
<Setter Property="SnapsToDevicePixels" Value="True" /> <Setter Property="SnapsToDevicePixels" Value="True" />
</Style> </Style>
<Style x:Key="SettingTitleLabel" TargetType="{x:Type TextBlock}"> <Style x:Key="SettingTitleLabel" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="{DynamicResource Color05B}" /> <Setter Property="Foreground" Value="{DynamicResource Color05B}" />
@ -135,6 +133,7 @@
BasedOn="{StaticResource DefaultToggleSwitch}" BasedOn="{StaticResource DefaultToggleSwitch}"
TargetType="{x:Type ui:ToggleSwitch}"> TargetType="{x:Type ui:ToggleSwitch}">
<Setter Property="Grid.Column" Value="2" /> <Setter Property="Grid.Column" Value="2" />
<Setter Property="FocusVisualMargin" Value="5" />
<Setter Property="Width" Value="Auto" /> <Setter Property="Width" Value="Auto" />
<Setter Property="HorizontalAlignment" Value="Right" /> <Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="HorizontalContentAlignment" Value="Right" /> <Setter Property="HorizontalContentAlignment" Value="Right" />
@ -262,12 +261,11 @@
</Setter> </Setter>
</Style> </Style>
<!-- Plugin Store Item when Selected layout for nothing -->
<Style x:Key="StoreItem" TargetType="{x:Type ToggleButton}" />
<Style x:Key="PluginList" TargetType="ListBoxItem"> <Style x:Key="PluginList" TargetType="ListBoxItem">
<Setter Property="Background" Value="{DynamicResource Color00B}" /> <Setter Property="Background" Value="{DynamicResource Color00B}" />
<Setter Property="Padding" Value="0,12,0,12" /> <Setter Property="Padding" Value="0,0,0,0" />
<Setter Property="UseLayoutRounding" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Margin" Value="0,0,18,5" /> <Setter Property="Margin" Value="0,0,18,5" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="BorderBrush" Value="{DynamicResource Color03B}" /> <Setter Property="BorderBrush" Value="{DynamicResource Color03B}" />
@ -282,7 +280,7 @@
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5" CornerRadius="5"
SnapsToDevicePixels="True"> UseLayoutRounding="True">
<ContentPresenter <ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
@ -398,6 +396,7 @@
x:Key="StoreListStyle" x:Key="StoreListStyle"
BasedOn="{StaticResource {x:Type ListBox}}" BasedOn="{StaticResource {x:Type ListBox}}"
TargetType="ListBox"> TargetType="ListBox">
<Setter Property="Background" Value="{DynamicResource Color01B}" />
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Items.Count}" Value="0"> <DataTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Items.Count}" Value="0">
<Setter Property="Template"> <Setter Property="Template">
@ -630,7 +629,11 @@
<StackPanel Style="{StaticResource TextPanel}"> <StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource startFlowLauncherOnSystemStartup}" /> <TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource startFlowLauncherOnSystemStartup}" />
</StackPanel> </StackPanel>
<CheckBox IsChecked="{Binding StartFlowLauncherOnSystemStartup}" Style="{DynamicResource SideControlCheckBox}" /> <ui:ToggleSwitch
Grid.Column="2"
FocusVisualMargin="5"
IsOn="{Binding StartFlowLauncherOnSystemStartup}"
Style="{DynamicResource SideToggleSwitch}" />
<TextBlock Style="{StaticResource Glyph}"> <TextBlock Style="{StaticResource Glyph}">
&#xe8fc; &#xe8fc;
</TextBlock> </TextBlock>
@ -642,7 +645,11 @@
<StackPanel Style="{StaticResource TextPanel}"> <StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource hideOnStartup}" /> <TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource hideOnStartup}" />
</StackPanel> </StackPanel>
<CheckBox IsChecked="{Binding Settings.HideOnStartup}" Style="{DynamicResource SideControlCheckBox}" /> <ui:ToggleSwitch
Grid.Column="2"
FocusVisualMargin="5"
IsOn="{Binding Settings.HideOnStartup}"
Style="{DynamicResource SideToggleSwitch}" />
<TextBlock Style="{StaticResource Glyph}"> <TextBlock Style="{StaticResource Glyph}">
&#xed1a; &#xed1a;
</TextBlock> </TextBlock>
@ -654,7 +661,11 @@
<StackPanel Style="{StaticResource TextPanel}"> <StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource hideFlowLauncherWhenLoseFocus}" /> <TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource hideFlowLauncherWhenLoseFocus}" />
</StackPanel> </StackPanel>
<CheckBox IsChecked="{Binding Settings.HideWhenDeactive}" Style="{DynamicResource SideControlCheckBox}" /> <ui:ToggleSwitch
Grid.Column="2"
FocusVisualMargin="5"
IsOn="{Binding Settings.HideWhenDeactive}"
Style="{DynamicResource SideToggleSwitch}" />
</ItemsControl> </ItemsControl>
</Border> </Border>
@ -665,7 +676,11 @@
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource hideNotifyIcon}" /> <TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource hideNotifyIcon}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource hideNotifyIconToolTip}" /> <TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource hideNotifyIconToolTip}" />
</StackPanel> </StackPanel>
<CheckBox IsChecked="{Binding Settings.HideNotifyIcon}" Style="{DynamicResource SideControlCheckBox}" /> <ui:ToggleSwitch
Grid.Column="2"
FocusVisualMargin="5"
IsOn="{Binding Settings.HideNotifyIcon}"
Style="{DynamicResource SideToggleSwitch}" />
</ItemsControl> </ItemsControl>
</Border> </Border>
@ -697,7 +712,11 @@
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource ignoreHotkeysOnFullscreen}" /> <TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource ignoreHotkeysOnFullscreen}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource ignoreHotkeysOnFullscreenToolTip}" /> <TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource ignoreHotkeysOnFullscreenToolTip}" />
</StackPanel> </StackPanel>
<CheckBox IsChecked="{Binding Settings.IgnoreHotkeysOnFullscreen}" Style="{DynamicResource SideControlCheckBox}" /> <ui:ToggleSwitch
Grid.Column="2"
FocusVisualMargin="5"
IsOn="{Binding Settings.IgnoreHotkeysOnFullscreen}"
Style="{DynamicResource SideToggleSwitch}" />
<TextBlock Style="{StaticResource Glyph}"> <TextBlock Style="{StaticResource Glyph}">
&#xe7fc; &#xe7fc;
</TextBlock> </TextBlock>
@ -710,9 +729,11 @@
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource ShouldUsePinyin}" /> <TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource ShouldUsePinyin}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource ShouldUsePinyinToolTip}" /> <TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource ShouldUsePinyinToolTip}" />
</StackPanel> </StackPanel>
<CheckBox <ui:ToggleSwitch
IsChecked="{Binding Settings.ShouldUsePinyin}" Grid.Column="2"
Style="{DynamicResource SideControlCheckBox}" FocusVisualMargin="5"
IsOn="{Binding Settings.ShouldUsePinyin}"
Style="{DynamicResource SideToggleSwitch}"
ToolTip="{DynamicResource ShouldUsePinyinToolTip}" /> ToolTip="{DynamicResource ShouldUsePinyinToolTip}" />
<TextBlock Style="{StaticResource Glyph}"> <TextBlock Style="{StaticResource Glyph}">
&#xe98a; &#xe98a;
@ -1036,7 +1057,7 @@
VirtualizingStackPanel.VirtualizationMode="Recycling"> VirtualizingStackPanel.VirtualizationMode="Recycling">
<ListBox.ItemsPanel> <ListBox.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<VirtualizingStackPanel Margin="0,0,0,18" /> <VirtualizingStackPanel Margin="0,0,0,0" />
</ItemsPanelTemplate> </ItemsPanelTemplate>
</ListBox.ItemsPanel> </ListBox.ItemsPanel>
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
@ -1045,57 +1066,54 @@
x:Name="expanderHeader" x:Name="expanderHeader"
Grid.Column="4" Grid.Column="4"
Padding="0" Padding="0"
Background="Transparent" BorderThickness="0"
FlowDirection="RightToLeft" ClipToBounds="True"
IsExpanded="{Binding Mode=TwoWay, Path=IsExpanded}" IsExpanded="{Binding Mode=TwoWay, Path=IsExpanded}"
SnapsToDevicePixels="True"
Style="{StaticResource ExpanderStyle1}"> Style="{StaticResource ExpanderStyle1}">
<Expander.Header> <Expander.Header>
<Grid <Border Padding="0,12,0,12">
Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Expander}}, Path=ActualWidth}" <Grid Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Expander}}, Path=ActualWidth}" HorizontalAlignment="Left">
HorizontalAlignment="Left" <Grid.ColumnDefinitions>
FlowDirection="LeftToRight"> <ColumnDefinition Width="36" MinWidth="36" />
<Grid.ColumnDefinitions> <ColumnDefinition Width="7*" />
<ColumnDefinition Width="100" MinWidth="100" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="8*" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <StackPanel
</Grid.ColumnDefinitions> Grid.Column="0"
<StackPanel Margin="0,0,0,0"
Grid.Column="0" VerticalAlignment="Center">
Margin="24,0,0,0" <Image
VerticalAlignment="Center" Width="32"
FlowDirection="LeftToRight"> Height="32"
<Image Margin="0,0,0,0"
Width="32" FlowDirection="LeftToRight"
Height="32" Source="{Binding Image, IsAsync=True}" />
Margin="32,0,0,0" </StackPanel>
FlowDirection="LeftToRight" <StackPanel Grid.Column="1" Margin="16,0,14,0">
Source="{Binding Image, IsAsync=True}" /> <TextBlock
</StackPanel> Foreground="{DynamicResource Color05B}"
<StackPanel Grid.Column="1" Margin="12,0,14,0"> Text="{Binding PluginPair.Metadata.Name}"
<TextBlock TextWrapping="Wrap"
Foreground="{DynamicResource Color05B}" ToolTip="{Binding PluginPair.Metadata.Version}" />
Text="{Binding PluginPair.Metadata.Name}" <TextBlock
TextWrapping="Wrap" Margin="0,2,0,0"
ToolTip="{Binding PluginPair.Metadata.Version}" /> Foreground="{DynamicResource Color04B}"
<TextBlock TextWrapping="WrapWithOverflow">
Margin="0,2,0,0" <Run FontSize="12" Text="{Binding PluginPair.Metadata.Description}" />
Foreground="{DynamicResource Color04B}" </TextBlock>
TextWrapping="WrapWithOverflow"> </StackPanel>
<Run FontSize="12" Text="{Binding PluginPair.Metadata.Description}" /> <StackPanel
</TextBlock> Grid.Column="2"
</StackPanel> HorizontalAlignment="Right"
<StackPanel Orientation="Horizontal">
Grid.Column="2" <TextBlock
HorizontalAlignment="Right" Margin="0,0,8,0"
Orientation="Horizontal"> VerticalAlignment="Center"
<TextBlock FontSize="12"
Margin="0,0,8,0" Foreground="{DynamicResource Color08B}"
VerticalAlignment="Center" Text="{DynamicResource priority}" />
FontSize="12"
Foreground="{DynamicResource Color08B}"
Text="{DynamicResource priority}" />
<Border>
<Button <Button
x:Name="PriorityButton" x:Name="PriorityButton"
Margin="0,0,22,0" Margin="0,0,22,0"
@ -1126,26 +1144,28 @@
</Button.Style> </Button.Style>
<!--#endregion--> <!--#endregion-->
</Button> </Button>
</Border>
</StackPanel>
<DockPanel Grid.Column="3">
<ui:ToggleSwitch
Margin="0,0,6,0"
HorizontalAlignment="Right"
IsOn="{Binding PluginState}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}" />
</DockPanel>
</Grid>
</StackPanel>
<DockPanel Grid.Column="3">
<ui:ToggleSwitch
Margin="0,0,60,0"
HorizontalAlignment="Right"
DockPanel.Dock="Right"
IsOn="{Binding PluginState}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}" />
</DockPanel>
</Grid>
</Border>
</Expander.Header> </Expander.Header>
<Grid FlowDirection="LeftToRight"> <Grid FlowDirection="LeftToRight">
<StackPanel Margin="0,12,0,0" Orientation="Vertical"> <StackPanel Margin="0,0,0,0" Orientation="Vertical">
<StackPanel> <StackPanel>
<Border <Border
Width="auto" Width="Auto"
Height="52" Height="52"
Margin="0"
Padding="0" Padding="0"
BorderThickness="0,1,0,0" BorderThickness="0,1,0,0"
CornerRadius="0" CornerRadius="0"
@ -1170,8 +1190,6 @@
DockPanel.Dock="Left" DockPanel.Dock="Left"
Style="{DynamicResource SettingTitleLabel}" Style="{DynamicResource SettingTitleLabel}"
Text="{DynamicResource actionKeywords}" /> Text="{DynamicResource actionKeywords}" />
<Button <Button
Grid.Column="2" Grid.Column="2"
Width="100" Width="100"
@ -1186,14 +1204,11 @@
ToolTip="{DynamicResource actionKeywordsTooltip}" ToolTip="{DynamicResource actionKeywordsTooltip}"
Visibility="{Binding ActionKeywordsVisibility}" /> Visibility="{Binding ActionKeywordsVisibility}" />
</DockPanel> </DockPanel>
</ItemsControl> </ItemsControl>
</Border> </Border>
</StackPanel> </StackPanel>
<StackPanel> <StackPanel>
<Border <Border
Padding="0" Padding="0"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
@ -1214,23 +1229,27 @@
</Style.Triggers> </Style.Triggers>
</Style> </Style>
</Border.Style> </Border.Style>
</Border>
<Border Background="{DynamicResource Color00B}">
<ContentControl
x:Name="PluginSettingControl"
Margin="0"
Padding="1"
VerticalAlignment="Stretch"
Content="{Binding SettingControl}" />
</Border> </Border>
<!--#endregion--> <!--#endregion-->
<ContentControl
x:Name="PluginSettingControl"
Margin="0"
Padding="1"
VerticalAlignment="Stretch"
Content="{Binding SettingControl}" />
</StackPanel> </StackPanel>
<StackPanel> <StackPanel>
<Border <Border
Margin="0" Margin="0"
Padding="0,12,0,0" Padding="0,12,0,12"
VerticalAlignment="Center" VerticalAlignment="Center"
BorderThickness="0,1,0,0" BorderThickness="0,1,0,0"
CornerRadius="0" CornerRadius="0 0 5 5"
Style="{DynamicResource SettingGroupBox}"> Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{DynamicResource SettingGrid}"> <ItemsControl Style="{DynamicResource SettingGrid}">
<StackPanel <StackPanel
@ -1317,7 +1336,7 @@
FontSize="11" FontSize="11"
Foreground="{DynamicResource PluginInfoColor}" Foreground="{DynamicResource PluginInfoColor}"
MouseUp="OnExternalPluginUninstallClick" MouseUp="OnExternalPluginUninstallClick"
Text="{DynamicResource uninstallbtn}" Text="{DynamicResource plugin_uninstall}"
TextDecorations="Underline" /> TextDecorations="Underline" />
<TextBlock <TextBlock
@ -1512,7 +1531,45 @@
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<!-- Hover Layout Style --> <DataTemplate.Resources>
<Style x:Key="StoreListItemBtnStyle" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
x:Name="Background"
Background="{DynamicResource Color00B}"
BorderBrush="{DynamicResource Color03B}"
BorderThickness="1"
CornerRadius="4"
SnapsToDevicePixels="True">
<Border
x:Name="Border"
Padding="{TemplateBinding Padding}"
BorderThickness="1"
CornerRadius="4">
<ContentPresenter
x:Name="ContentPresenter"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Background" Property="Background" Value="{DynamicResource Color07B}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="Background" Property="Background" Value="{DynamicResource Color07B}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DataTemplate.Resources>
<Button <Button
Name="StoreListItem" Name="StoreListItem"
Margin="0" Margin="0"
@ -1523,7 +1580,8 @@
VerticalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
BorderThickness="0" BorderThickness="0"
Click="StoreListItem_Click" Click="StoreListItem_Click"
FocusVisualStyle="{StaticResource StoreItemFocusVisualStyleKey}"> FocusVisualStyle="{StaticResource StoreItemFocusVisualStyleKey}"
Style="{DynamicResource StoreListItemBtnStyle}">
<ui:FlyoutService.Flyout> <ui:FlyoutService.Flyout>
<ui:Flyout x:Name="InstallFlyout" Placement="Bottom"> <ui:Flyout x:Name="InstallFlyout" Placement="Bottom">
<Grid MinWidth="200"> <Grid MinWidth="200">
@ -2365,11 +2423,10 @@
Text="{DynamicResource showOpenResultHotkey}" /> Text="{DynamicResource showOpenResultHotkey}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource showOpenResultHotkeyToolTip}" /> <TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource showOpenResultHotkeyToolTip}" />
</StackPanel> </StackPanel>
<CheckBox <ui:ToggleSwitch
Grid.Column="2" Grid.Column="2"
FontSize="14" IsOn="{Binding Settings.ShowOpenResultHotkey}"
IsChecked="{Binding Settings.ShowOpenResultHotkey}" Style="{DynamicResource SideToggleSwitch}" />
Style="{DynamicResource SideControlCheckBox}" />
</ItemsControl> </ItemsControl>
</Border> </Border>
</StackPanel> </StackPanel>
@ -2590,7 +2647,10 @@
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{DynamicResource SettingTitleLabel}" Style="{DynamicResource SettingTitleLabel}"
Text="{DynamicResource enableProxy}" /> Text="{DynamicResource enableProxy}" />
<CheckBox IsChecked="{Binding Settings.Proxy.Enabled}" Style="{DynamicResource SideControlCheckBox}" /> <ui:ToggleSwitch
Grid.Column="2"
IsOn="{Binding Settings.Proxy.Enabled}"
Style="{DynamicResource SideToggleSwitch}" />
</ItemsControl> </ItemsControl>
</Border> </Border>
<Separator <Separator

View file

@ -17,10 +17,14 @@
<system:String x:Key="flowlauncher_plugin_program_suffixes">File Type</system:String> <system:String x:Key="flowlauncher_plugin_program_suffixes">File Type</system:String>
<system:String x:Key="flowlauncher_plugin_program_reindex">Reindex</system:String> <system:String x:Key="flowlauncher_plugin_program_reindex">Reindex</system:String>
<system:String x:Key="flowlauncher_plugin_program_indexing">Indexing</system:String> <system:String x:Key="flowlauncher_plugin_program_indexing">Indexing</system:String>
<system:String x:Key="flowlauncher_plugin_program_index_start">Index Start Menu</system:String> <system:String x:Key="flowlauncher_plugin_program_index_source">Index Sources</system:String>
<system:String x:Key="flowlauncher_plugin_program_index_option">Options</system:String>
<system:String x:Key="flowlauncher_plugin_program_index_start">Start Menu</system:String>
<system:String x:Key="flowlauncher_plugin_program_index_start_tooltip">When enabled, Flow will load programs from the start menu</system:String> <system:String x:Key="flowlauncher_plugin_program_index_start_tooltip">When enabled, Flow will load programs from the start menu</system:String>
<system:String x:Key="flowlauncher_plugin_program_index_registry">Index Registry</system:String> <system:String x:Key="flowlauncher_plugin_program_index_registry">Registry</system:String>
<system:String x:Key="flowlauncher_plugin_program_index_registry_tooltip">When enabled, Flow will load programs from the registry</system:String> <system:String x:Key="flowlauncher_plugin_program_index_registry_tooltip">When enabled, Flow will load programs from the registry</system:String>
<system:String x:Key="flowlauncher_plugin_program_index_PATH">PATH</system:String>
<system:String x:Key="flowlauncher_plugin_program_index_PATH_tooltip">When enabled, Flow will load programs from the PATH environment variable</system:String>
<system:String x:Key="flowlauncher_plugin_program_enable_hidelnkpath">Hide app path</system:String> <system:String x:Key="flowlauncher_plugin_program_enable_hidelnkpath">Hide app path</system:String>
<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> <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>
<system:String x:Key="flowlauncher_plugin_program_enable_description">Search in Program Description</system:String> <system:String x:Key="flowlauncher_plugin_program_enable_description">Search in Program Description</system:String>

View file

@ -95,7 +95,7 @@ namespace Flow.Launcher.Plugin.Program
var b = Task.Run(() => var b = Task.Run(() =>
{ {
Stopwatch.Normal("|Flow.Launcher.Plugin.Program.Main|UWPProgram index cost", IndexUwpPrograms); Stopwatch.Normal("|Flow.Launcher.Plugin.Program.Main|UWPPRogram index cost", IndexUwpPrograms);
}); });
if (cacheEmpty) if (cacheEmpty)

View file

@ -273,6 +273,14 @@ namespace Flow.Launcher.Plugin.Program.Programs
program.Valid = false; program.Valid = false;
return program; return program;
} }
catch (FileNotFoundException e)
{
ProgramLogger.LogException($"|Win32|LnkProgram|{path}" +
"|An unexpected error occurred in the calling method LnkProgram", e);
program.Valid = false;
return program;
}
#if !DEBUG //Only do a catch all in production. This is so make developer aware of any unhandled exception and add the exception handling in. #if !DEBUG //Only do a catch all in production. This is so make developer aware of any unhandled exception and add the exception handling in.
catch (Exception e) catch (Exception e)
{ {
@ -343,7 +351,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
} }
} }
private static IEnumerable<string> ProgramPaths(string directory, string[] suffixes) private static IEnumerable<string> ProgramPaths(string directory, string[] suffixes, bool recursive = true)
{ {
if (!Directory.Exists(directory)) if (!Directory.Exists(directory))
return Enumerable.Empty<string>(); return Enumerable.Empty<string>();
@ -351,7 +359,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
return Directory.EnumerateFiles(directory, "*", new EnumerationOptions return Directory.EnumerateFiles(directory, "*", new EnumerationOptions
{ {
IgnoreInaccessible = true, IgnoreInaccessible = true,
RecurseSubdirectories = true RecurseSubdirectories = recursive
}).Where(x => suffixes.Contains(Extension(x))); }).Where(x => suffixes.Contains(Extension(x)));
} }
@ -394,7 +402,30 @@ namespace Flow.Launcher.Plugin.Program.Programs
return programs; return programs;
} }
private static IEnumerable<Win32> AppPathsPrograms(string[] suffixes, string[] protocols) private static IEnumerable<Win32> PATHPrograms(string[] suffixes)
{
var pathEnv = Environment.GetEnvironmentVariable("Path");
if (String.IsNullOrEmpty(pathEnv))
{
return Array.Empty<Win32>();
}
var paths = pathEnv.Split(";", StringSplitOptions.RemoveEmptyEntries).DistinctBy(p => p.ToLowerInvariant());
var toFilter = paths.AsParallel().SelectMany(p => ProgramPaths(p, suffixes, recursive: false));
var programs = ExceptDisabledSource(toFilter.Distinct())
.Select(x => Extension(x) switch
{
ShortcutExtension => LnkProgram(x),
UrlExtension => UrlProgram(x),
ExeExtension => ExeProgram(x),
_ => Win32Program(x)
});
return programs;
}
private static IEnumerable<Win32> AppPathsPrograms(string[] suffixes)
{ {
// https://msdn.microsoft.com/en-us/library/windows/desktop/ee872121 // https://msdn.microsoft.com/en-us/library/windows/desktop/ee872121
const string appPaths = @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths"; const string appPaths = @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths";
@ -552,6 +583,12 @@ namespace Flow.Launcher.Plugin.Program.Programs
autoIndexPrograms = autoIndexPrograms.Concat(startMenu); autoIndexPrograms = autoIndexPrograms.Concat(startMenu);
} }
if (settings.EnablePATHSource)
{
var path = PATHPrograms(settings.GetSuffixes());
autoIndexPrograms = autoIndexPrograms.Concat(path);
}
autoIndexPrograms = ProgramsHasher(autoIndexPrograms); autoIndexPrograms = ProgramsHasher(autoIndexPrograms);
return programs.Concat(autoIndexPrograms).Where(x => x.Valid).Distinct().ToArray(); return programs.Concat(autoIndexPrograms).Where(x => x.Valid).Distinct().ToArray();

View file

@ -118,6 +118,8 @@ namespace Flow.Launcher.Plugin.Program
public bool EnableDescription { get; set; } = false; public bool EnableDescription { get; set; } = false;
public bool HideAppsPath { get; set; } = true; public bool HideAppsPath { get; set; } = true;
public bool EnableRegistrySource { get; set; } = true; public bool EnableRegistrySource { get; set; } = true;
public bool EnablePATHSource { get; set; } = true;
public string CustomizedExplorer { get; set; } = Explorer; public string CustomizedExplorer { get; set; } = Explorer;
public string CustomizedArgs { get; set; } = ExplorerArgs; public string CustomizedArgs { get; set; } = ExplorerArgs;

View file

@ -10,58 +10,88 @@
mc:Ignorable="d"> mc:Ignorable="d">
<Grid Margin="0"> <Grid Margin="0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="170" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="60" /> <RowDefinition Height="60" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<DockPanel
Margin="70,10,0,8"
HorizontalAlignment="Stretch"
LastChildFill="True">
<TextBlock
MinWidth="120"
Margin="0,5,10,0"
Text="{DynamicResource flowlauncher_plugin_program_index_source}" />
<WrapPanel
Width="Auto"
Margin="0,0,14,0"
HorizontalAlignment="Right"
DockPanel.Dock="Right">
<CheckBox
Name="StartMenuEnabled"
Margin="12,0,12,0"
Content="{DynamicResource flowlauncher_plugin_program_index_start}"
IsChecked="{Binding EnableStartMenuSource}"
ToolTip="{DynamicResource flowlauncher_plugin_program_index_start_tooltip}" />
<CheckBox
Name="RegistryEnabled"
Margin="12,0,12,0"
Content="{DynamicResource flowlauncher_plugin_program_index_registry}"
IsChecked="{Binding EnableRegistrySource}"
ToolTip="{DynamicResource flowlauncher_plugin_program_index_registry_tooltip}" />
<CheckBox
Name="PATHEnabled"
Margin="12,0,12,0"
Content="{DynamicResource flowlauncher_plugin_program_index_PATH}"
IsChecked="{Binding EnablePATHSource}"
ToolTip="{DynamicResource flowlauncher_plugin_program_index_PATH_tooltip}" />
</WrapPanel>
</DockPanel>
<StackPanel <StackPanel
Grid.Row="0" Grid.Row="1"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
Orientation="Vertical"> Orientation="Vertical">
<StackPanel Width="Auto" Orientation="Vertical"> <Separator
<StackPanel Width="Auto" Orientation="Horizontal"> Height="1"
<CheckBox BorderBrush="{DynamicResource Color03B}"
Name="StartMenuEnabled" BorderThickness="1" />
Width="220" <DockPanel
Margin="70,8,10,8" Margin="70,10,0,8"
Content="{DynamicResource flowlauncher_plugin_program_index_start}" HorizontalAlignment="Stretch"
IsChecked="{Binding EnableStartMenuSource}" LastChildFill="True">
ToolTip="{DynamicResource flowlauncher_plugin_program_index_start_tooltip}" /> <TextBlock
<CheckBox MinWidth="120"
Name="RegistryEnabled" Margin="0,5,10,0"
Margin="70,8,10,8" Text="{DynamicResource flowlauncher_plugin_program_index_option}" />
Content="{DynamicResource flowlauncher_plugin_program_index_registry}" <WrapPanel
IsChecked="{Binding EnableRegistrySource}" Width="Auto"
ToolTip="{DynamicResource flowlauncher_plugin_program_index_registry_tooltip}" /> Margin="0,0,14,0"
</StackPanel> HorizontalAlignment="Right"
DockPanel.Dock="Right">
<Separator
Height="1"
BorderBrush="{DynamicResource Color03B}"
BorderThickness="1" />
<StackPanel Width="Auto" Orientation="Horizontal">
<CheckBox <CheckBox
Name="HideLnkEnabled" Name="HideLnkEnabled"
Width="220" Margin="12,0,12,0"
Margin="70,8,10,8"
Content="{DynamicResource flowlauncher_plugin_program_enable_hidelnkpath}" Content="{DynamicResource flowlauncher_plugin_program_enable_hidelnkpath}"
IsChecked="{Binding HideAppsPath}" IsChecked="{Binding HideAppsPath}"
ToolTip="{DynamicResource flowlauncher_plugin_program_enable_hidelnkpath_tooltip}" /> ToolTip="{DynamicResource flowlauncher_plugin_program_enable_hidelnkpath_tooltip}" />
<CheckBox <CheckBox
Name="DescriptionEnabled" Name="DescriptionEnabled"
Margin="70,8,10,8" Margin="12,0,12,0"
Content="{DynamicResource flowlauncher_plugin_program_enable_description}" Content="{DynamicResource flowlauncher_plugin_program_enable_description}"
IsChecked="{Binding EnableDescription}" IsChecked="{Binding EnableDescription}"
ToolTip="{DynamicResource flowlauncher_plugin_program_enable_description_tooltip}" /> ToolTip="{DynamicResource flowlauncher_plugin_program_enable_description_tooltip}" />
</StackPanel> </WrapPanel>
<Separator </DockPanel>
Height="1" <Separator
BorderBrush="{DynamicResource Color03B}" Height="1"
BorderThickness="1" /> BorderBrush="{DynamicResource Color03B}"
</StackPanel> BorderThickness="1" />
<StackPanel <StackPanel
Width="Auto" Width="Auto"
Margin="10,6,0,0" Margin="60,6,0,0"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Orientation="Horizontal"> Orientation="Horizontal">
<Button <Button
@ -107,8 +137,8 @@
</StackPanel> </StackPanel>
<ListView <ListView
x:Name="programSourceView" x:Name="programSourceView"
Grid.Row="1" Grid.Row="2"
Margin="20,0,20,0" Margin="70,0,20,0"
AllowDrop="True" AllowDrop="True"
BorderBrush="DarkGray" BorderBrush="DarkGray"
BorderThickness="1" BorderThickness="1"
@ -149,7 +179,7 @@
</ListView.View> </ListView.View>
</ListView> </ListView>
<DockPanel <DockPanel
Grid.Row="2" Grid.Row="3"
Grid.RowSpan="1" Grid.RowSpan="1"
Margin="0,0,20,10"> Margin="0,0,20,10">
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
@ -175,66 +205,3 @@
</DockPanel> </DockPanel>
</Grid> </Grid>
</UserControl> </UserControl>

View file

@ -66,6 +66,16 @@ namespace Flow.Launcher.Plugin.Program.Views
} }
} }
public bool EnablePATHSource
{
get => _settings.EnablePATHSource;
set
{
_settings.EnablePATHSource = value;
ReIndexing();
}
}
public string CustomizedExplorerPath public string CustomizedExplorerPath
{ {
get => _settings.CustomizedExplorer; get => _settings.CustomizedExplorer;