mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
396 lines
No EOL
20 KiB
XML
396 lines
No EOL
20 KiB
XML
<Window x:Class="Flow.Launcher.MainWindow"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:converters="clr-namespace:Flow.Launcher.Converters"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
|
|
xmlns:vm="clr-namespace:Flow.Launcher.ViewModel"
|
|
Name="FlowMainWindow"
|
|
Title="Flow Launcher"
|
|
MinWidth="{Binding MainWindowWidth, Mode=OneWay}"
|
|
MaxWidth="{Binding MainWindowWidth, Mode=OneWay}"
|
|
AllowDrop="True"
|
|
AllowsTransparency="True"
|
|
Background="Transparent"
|
|
Closing="OnClosing"
|
|
Deactivated="OnDeactivated"
|
|
Icon="Images/app.png"
|
|
Initialized="OnInitialized"
|
|
Loaded="OnLoaded"
|
|
LocationChanged="OnLocationChanged"
|
|
Opacity="{Binding MainWindowOpacity, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
|
PreviewKeyDown="OnKeyDown"
|
|
ResizeMode="NoResize"
|
|
ShowInTaskbar="False"
|
|
SizeToContent="Height"
|
|
Style="{DynamicResource WindowStyle}"
|
|
Topmost="True"
|
|
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
WindowStartupLocation="Manual"
|
|
WindowStyle="None"
|
|
mc:Ignorable="d">
|
|
<Window.Resources>
|
|
<converters:QuerySuggestionBoxConverter x:Key="QuerySuggestionBoxConverter" />
|
|
<converters:BorderClipConverter x:Key="BorderClipConverter" />
|
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
|
</Window.Resources>
|
|
<Window.InputBindings>
|
|
<KeyBinding Key="Escape"
|
|
Command="{Binding EscCommand}" />
|
|
<KeyBinding Key="F1"
|
|
Command="{Binding StartHelpCommand}" />
|
|
<KeyBinding Key="F5"
|
|
Command="{Binding ReloadPluginDataCommand}" />
|
|
<KeyBinding Key="Tab"
|
|
Command="{Binding AutocompleteQueryCommand}" />
|
|
<KeyBinding Key="Tab"
|
|
Command="{Binding AutocompleteQueryCommand}"
|
|
Modifiers="Shift" />
|
|
<KeyBinding Key="I"
|
|
Command="{Binding OpenSettingCommand}"
|
|
Modifiers="Ctrl" />
|
|
<KeyBinding Key="N"
|
|
Command="{Binding SelectNextItemCommand}"
|
|
Modifiers="Ctrl" />
|
|
<KeyBinding Key="J"
|
|
Command="{Binding SelectNextItemCommand}"
|
|
Modifiers="Ctrl" />
|
|
<KeyBinding Key="D"
|
|
Command="{Binding SelectNextPageCommand}"
|
|
Modifiers="Ctrl" />
|
|
<KeyBinding Key="P"
|
|
Command="{Binding SelectPrevItemCommand}"
|
|
Modifiers="Ctrl" />
|
|
<KeyBinding Key="K"
|
|
Command="{Binding SelectPrevItemCommand}"
|
|
Modifiers="Ctrl" />
|
|
<KeyBinding Key="U"
|
|
Command="{Binding SelectPrevPageCommand}"
|
|
Modifiers="Ctrl" />
|
|
<KeyBinding Key="Home"
|
|
Command="{Binding SelectFirstResultCommand}"
|
|
Modifiers="Alt" />
|
|
<KeyBinding Key="O"
|
|
Command="{Binding LoadContextMenuCommand}"
|
|
Modifiers="Ctrl" />
|
|
<KeyBinding Key="Right"
|
|
Command="{Binding LoadContextMenuCommand}" />
|
|
<KeyBinding Key="Left"
|
|
Command="{Binding EscCommand}" />
|
|
<KeyBinding
|
|
Key="H"
|
|
Command="{Binding LoadHistoryCommand}"
|
|
Modifiers="Ctrl" />
|
|
<KeyBinding Key="Right" Command="{Binding LoadContextMenuCommand}" />
|
|
<KeyBinding Key="Left" Command="{Binding EscCommand}" />
|
|
<KeyBinding
|
|
Key="OemCloseBrackets"
|
|
Command="{Binding IncreaseWidthCommand}"
|
|
Modifiers="Control" />
|
|
<KeyBinding
|
|
Key="OemOpenBrackets"
|
|
Command="{Binding DecreaseWidthCommand}"
|
|
Modifiers="Control" />
|
|
<KeyBinding
|
|
Key="OemPlus"
|
|
Command="{Binding IncreaseMaxResultCommand}"
|
|
Modifiers="Control" />
|
|
<KeyBinding
|
|
Key="OemMinus"
|
|
Command="{Binding DecreaseMaxResultCommand}"
|
|
Modifiers="Control" />
|
|
<KeyBinding
|
|
Key="H"
|
|
Command="{Binding LoadHistoryCommand}"
|
|
Modifiers="Ctrl" />
|
|
<KeyBinding Key="Enter"
|
|
Command="{Binding OpenResultCommand}"
|
|
Modifiers="Ctrl+Shift" />
|
|
<KeyBinding Key="Enter"
|
|
Command="{Binding LoadContextMenuCommand}"
|
|
Modifiers="Shift" />
|
|
<KeyBinding Key="Enter"
|
|
Command="{Binding OpenResultCommand}" />
|
|
<KeyBinding Key="Enter"
|
|
Command="{Binding OpenResultCommand}"
|
|
Modifiers="Ctrl" />
|
|
<KeyBinding Key="Enter"
|
|
Command="{Binding OpenResultCommand}"
|
|
Modifiers="Alt" />
|
|
<KeyBinding Key="D1"
|
|
Command="{Binding OpenResultCommand}"
|
|
CommandParameter="0"
|
|
Modifiers="{Binding OpenResultCommandModifiers}" />
|
|
<KeyBinding Key="D2"
|
|
Command="{Binding OpenResultCommand}"
|
|
CommandParameter="1"
|
|
Modifiers="{Binding OpenResultCommandModifiers}" />
|
|
<KeyBinding Key="D3"
|
|
Command="{Binding OpenResultCommand}"
|
|
CommandParameter="2"
|
|
Modifiers="{Binding OpenResultCommandModifiers}" />
|
|
<KeyBinding Key="D4"
|
|
Command="{Binding OpenResultCommand}"
|
|
CommandParameter="3"
|
|
Modifiers="{Binding OpenResultCommandModifiers}" />
|
|
<KeyBinding Key="D5"
|
|
Command="{Binding OpenResultCommand}"
|
|
CommandParameter="4"
|
|
Modifiers="{Binding OpenResultCommandModifiers}" />
|
|
<KeyBinding Key="D6"
|
|
Command="{Binding OpenResultCommand}"
|
|
CommandParameter="5"
|
|
Modifiers="{Binding OpenResultCommandModifiers}" />
|
|
<KeyBinding Key="D7"
|
|
Command="{Binding OpenResultCommand}"
|
|
CommandParameter="6"
|
|
Modifiers="{Binding OpenResultCommandModifiers}" />
|
|
<KeyBinding Key="D8"
|
|
Command="{Binding OpenResultCommand}"
|
|
CommandParameter="7"
|
|
Modifiers="{Binding OpenResultCommandModifiers}" />
|
|
<KeyBinding Key="D9"
|
|
Command="{Binding OpenResultCommand}"
|
|
CommandParameter="8"
|
|
Modifiers="{Binding OpenResultCommandModifiers}" />
|
|
<KeyBinding Key="D0"
|
|
Command="{Binding OpenResultCommand}"
|
|
CommandParameter="9"
|
|
Modifiers="{Binding OpenResultCommandModifiers}" />
|
|
</Window.InputBindings>
|
|
<Grid>
|
|
<Border MouseDown="OnMouseDown"
|
|
Style="{DynamicResource WindowBorderStyle}">
|
|
<StackPanel Orientation="Vertical">
|
|
<Grid>
|
|
<TextBox x:Name="QueryTextSuggestionBox"
|
|
IsEnabled="False"
|
|
Style="{DynamicResource QuerySuggestionBoxStyle}">
|
|
<TextBox.Text>
|
|
<MultiBinding Converter="{StaticResource QuerySuggestionBoxConverter}">
|
|
<Binding ElementName="QueryTextBox"
|
|
Mode="OneTime" />
|
|
<Binding ElementName="ResultListBox"
|
|
Path="SelectedItem" />
|
|
<Binding ElementName="QueryTextBox"
|
|
Path="Text" />
|
|
</MultiBinding>
|
|
</TextBox.Text>
|
|
</TextBox>
|
|
<TextBox x:Name="QueryTextBox"
|
|
AllowDrop="True"
|
|
Background="Transparent"
|
|
PreviewDragOver="OnPreviewDragOver"
|
|
PreviewKeyUp="QueryTextBox_KeyUp"
|
|
Style="{DynamicResource QueryBoxStyle}"
|
|
Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
Visibility="Visible">
|
|
<TextBox.CommandBindings>
|
|
<CommandBinding Command="ApplicationCommands.Copy"
|
|
Executed="OnCopy" />
|
|
</TextBox.CommandBindings>
|
|
<TextBox.ContextMenu>
|
|
<ContextMenu>
|
|
<MenuItem Command="ApplicationCommands.Cut"
|
|
Header="{DynamicResource cut}" />
|
|
<MenuItem Command="ApplicationCommands.Copy"
|
|
Header="{DynamicResource copy}" />
|
|
<MenuItem Command="ApplicationCommands.Paste"
|
|
Header="{DynamicResource paste}" />
|
|
<Separator Margin="0"
|
|
Padding="0,4,0,4"
|
|
Background="{DynamicResource ContextSeparator}" />
|
|
<MenuItem Click="OnContextMenusForSettingsClick"
|
|
Header="{DynamicResource flowlauncher_settings}" />
|
|
<MenuItem Command="{Binding EscCommand}"
|
|
Header="{DynamicResource closeWindow}" />
|
|
</ContextMenu>
|
|
</TextBox.ContextMenu>
|
|
</TextBox>
|
|
|
|
<StackPanel x:Name="ClockPanel"
|
|
Style="{DynamicResource ClockPanel}"
|
|
IsHitTestVisible="False">
|
|
<TextBlock
|
|
Visibility="{Binding Settings.UseDate, Converter={StaticResource BooleanToVisibilityConverter}}"
|
|
Style="{DynamicResource DateBox}"
|
|
Text="{Binding DateText}" />
|
|
<TextBlock Style="{DynamicResource ClockBox}"
|
|
Visibility="{Binding Settings.UseClock, Converter={StaticResource BooleanToVisibilityConverter}}"
|
|
Text="{Binding ClockText}"/>
|
|
</StackPanel>
|
|
|
|
<Canvas Style="{DynamicResource SearchIconPosition}">
|
|
<Image x:Name="PluginActivationIcon"
|
|
Width="32"
|
|
Height="32"
|
|
Margin="0,0,0,0"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Panel.ZIndex="2"
|
|
RenderOptions.BitmapScalingMode="HighQuality"
|
|
Source="{Binding PluginIconPath}"
|
|
Stretch="Uniform"
|
|
Style="{DynamicResource PluginActivationIcon}" />
|
|
<Path Name="SearchIcon"
|
|
Margin="0"
|
|
Data="{DynamicResource SearchIconImg}"
|
|
Stretch="Fill"
|
|
Style="{DynamicResource SearchIconStyle}"
|
|
Visibility="{Binding SearchIconVisibility}" />
|
|
</Canvas>
|
|
</Grid>
|
|
|
|
<Grid ClipToBounds="True">
|
|
<ContentControl>
|
|
<ContentControl.Style>
|
|
<Style TargetType="ContentControl">
|
|
<Setter Property="Visibility"
|
|
Value="Collapsed" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding ElementName=ResultListBox, Path=Visibility}"
|
|
Value="Visible">
|
|
<Setter Property="Visibility"
|
|
Value="Visible" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding ElementName=ContextMenu, Path=Visibility}"
|
|
Value="Visible">
|
|
<Setter Property="Visibility"
|
|
Value="Visible" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding ElementName=History, Path=Visibility}"
|
|
Value="Visible">
|
|
<Setter Property="Visibility"
|
|
Value="Visible" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</ContentControl.Style>
|
|
<Rectangle Width="Auto"
|
|
HorizontalAlignment="Stretch"
|
|
Style="{DynamicResource SeparatorStyle}" />
|
|
</ContentControl>
|
|
<Line x:Name="ProgressBar"
|
|
Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=ActualWidth}"
|
|
Height="2"
|
|
HorizontalAlignment="Right"
|
|
StrokeThickness="1"
|
|
Style="{DynamicResource PendingLineStyle}"
|
|
Visibility="{Binding ProgressBarVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
X1="-150"
|
|
X2="-50"
|
|
Y1="0"
|
|
Y2="0" />
|
|
</Grid>
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="0.8*" MinWidth="240" />
|
|
</Grid.ColumnDefinitions>
|
|
<StackPanel x:Name="ResultArea" Grid.Column="0">
|
|
<Border Style="{DynamicResource WindowRadius}">
|
|
<Border.Clip>
|
|
<MultiBinding Converter="{StaticResource BorderClipConverter}">
|
|
<Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
|
|
<Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
|
|
<Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}" />
|
|
</MultiBinding>
|
|
</Border.Clip>
|
|
<ContentControl>
|
|
<flowlauncher:ResultListBox
|
|
x:Name="ResultListBox"
|
|
DataContext="{Binding Results}"
|
|
PreviewMouseDown="OnPreviewMouseButtonDown" />
|
|
</ContentControl>
|
|
</Border>
|
|
<Border Style="{DynamicResource WindowRadius}">
|
|
<Border.Clip>
|
|
<MultiBinding Converter="{StaticResource BorderClipConverter}">
|
|
<Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
|
|
<Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
|
|
<Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}" />
|
|
</MultiBinding>
|
|
</Border.Clip>
|
|
<ContentControl>
|
|
<flowlauncher:ResultListBox
|
|
x:Name="ContextMenu"
|
|
DataContext="{Binding ContextMenu}"
|
|
PreviewMouseDown="OnPreviewMouseButtonDown" />
|
|
</ContentControl>
|
|
</Border>
|
|
<Border Style="{DynamicResource WindowRadius}">
|
|
<Border.Clip>
|
|
<MultiBinding Converter="{StaticResource BorderClipConverter}">
|
|
<Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
|
|
<Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
|
|
<Binding Path="CornerRadius" RelativeSource="{RelativeSource Self}" />
|
|
</MultiBinding>
|
|
</Border.Clip>
|
|
<ContentControl>
|
|
<flowlauncher:ResultListBox
|
|
x:Name="History"
|
|
DataContext="{Binding History}"
|
|
PreviewMouseDown="OnPreviewMouseButtonDown" />
|
|
</ContentControl>
|
|
</Border>
|
|
</StackPanel>
|
|
<Grid
|
|
x:Name="Preview"
|
|
Grid.Column="1"
|
|
VerticalAlignment="Stretch"
|
|
d:DataContext="{d:DesignInstance vm:ResultViewModel}"
|
|
DataContext="{Binding SelectedItem, ElementName=ResultListBox}"
|
|
Style="{DynamicResource PreviewArea}"
|
|
Visibility="Collapsed">
|
|
<Border Style="{DynamicResource PreviewBorderStyle}" Visibility="{Binding ShowDefaultPreview}">
|
|
<Grid
|
|
Margin="20,0,10,0"
|
|
VerticalAlignment="Center"
|
|
Background="Transparent">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
<Image
|
|
x:Name="ImageIcon"
|
|
Grid.Row="0"
|
|
Grid.Column="0"
|
|
MaxWidth="{Binding ActualWidth, ElementName=Preview}"
|
|
MaxHeight="400"
|
|
Margin="0,10,0,8"
|
|
HorizontalAlignment="Center"
|
|
Source="{Binding PreviewImage}"
|
|
Visibility="{Binding ShowIcon}" />
|
|
<TextBlock
|
|
x:Name="Title"
|
|
Grid.Row="1"
|
|
HorizontalAlignment="Stretch"
|
|
FontSize="18"
|
|
FontWeight="SemiBold"
|
|
Style="{DynamicResource ItemTitleStyle}"
|
|
Text="{Binding Result.Title}"
|
|
TextAlignment="Center"
|
|
TextWrapping="Wrap" />
|
|
<TextBlock
|
|
x:Name="SubTitle"
|
|
Grid.Row="2"
|
|
Margin="0,2,0,10"
|
|
HorizontalAlignment="Stretch"
|
|
FontSize="13"
|
|
LineHeight="18"
|
|
Style="{DynamicResource ItemSubTitleStyle}"
|
|
Text="{Binding Result.SubTitle}"
|
|
TextAlignment="Center"
|
|
TextWrapping="Wrap" />
|
|
</Grid>
|
|
</Border>
|
|
<ContentControl Content="{Binding Result.PreviewPanel.Value}" Visibility="{Binding ShowCustomizedPrewview}" />
|
|
</Grid>
|
|
</Grid>
|
|
</StackPanel>
|
|
</Border>
|
|
</Grid>
|
|
</Window> |