Skip to content

Commit c725181

Browse files
committed
Darkmode CustomQueryHotkey/HotkeyControl
1 parent 0fbec35 commit c725181

File tree

3 files changed

+194
-64
lines changed

3 files changed

+194
-64
lines changed
Lines changed: 145 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,160 @@
1-
<Window x:Class="Flow.Launcher.CustomQueryHotkeySetting"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
5-
Icon="Images\app.png"
6-
ResizeMode="NoResize"
7-
WindowStartupLocation="CenterScreen"
8-
MouseDown="window_MouseDown"
9-
Title="{DynamicResource customeQueryHotkeyTitle}" Height="345" Width="500" Background="#F3F3F3" BorderBrush="#cecece">
1+
<Window
2+
x:Class="Flow.Launcher.CustomQueryHotkeySetting"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
6+
Title="{DynamicResource customeQueryHotkeyTitle}"
7+
Width="500"
8+
Background="{DynamicResource PopuBGColor}"
9+
Foreground="{DynamicResource PopupTextColor}"
10+
Icon="Images\app.png"
11+
MouseDown="window_MouseDown"
12+
ResizeMode="NoResize"
13+
SizeToContent="Height"
14+
WindowStartupLocation="CenterScreen">
15+
<WindowChrome.WindowChrome>
16+
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
17+
</WindowChrome.WindowChrome>
1018
<Window.InputBindings>
11-
<KeyBinding Key="Escape" Command="Close"/>
19+
<KeyBinding Key="Escape" Command="Close" />
1220
</Window.InputBindings>
1321
<Window.CommandBindings>
14-
<CommandBinding Command="Close" Executed="cmdEsc_OnPress"/>
22+
<CommandBinding Command="Close" Executed="cmdEsc_OnPress" />
1523
</Window.CommandBindings>
1624
<Grid>
1725
<Grid.RowDefinitions>
1826
<RowDefinition />
19-
<RowDefinition Height="80"/>
27+
<RowDefinition Height="80" />
2028
</Grid.RowDefinitions>
21-
<Border BorderThickness="0 0 0 1" BorderBrush="#e5e5e5" Background="#ffffff" Padding="26 26 26 0">
22-
<Grid>
29+
<StackPanel Grid.Row="0">
30+
<StackPanel>
31+
<Grid>
32+
<Grid.ColumnDefinitions>
33+
<ColumnDefinition Width="Auto" />
34+
<ColumnDefinition Width="*" />
35+
<ColumnDefinition Width="Auto" />
36+
<ColumnDefinition Width="Auto" />
37+
<ColumnDefinition Width="Auto" />
38+
</Grid.ColumnDefinitions>
39+
<Button
40+
Grid.Column="4"
41+
Click="BtnCancel_OnClick"
42+
Style="{StaticResource TitleBarCloseButtonStyle}">
43+
<Path
44+
Width="46"
45+
Height="32"
46+
Data="M 18,11 27,20 M 18,20 27,11"
47+
Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
48+
StrokeThickness="1">
49+
<Path.Style>
50+
<Style TargetType="Path">
51+
<Style.Triggers>
52+
<DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="False">
53+
<Setter Property="Opacity" Value="0.5" />
54+
</DataTrigger>
55+
</Style.Triggers>
56+
</Style>
57+
</Path.Style>
58+
</Path>
59+
</Button>
60+
</Grid>
61+
</StackPanel>
62+
<StackPanel Margin="26,0,26,0">
63+
<StackPanel Grid.Row="0" Margin="0,0,0,12">
64+
<TextBlock
65+
Grid.Column="0"
66+
Margin="0,0,0,0"
67+
FontFamily="Segoe UI"
68+
FontSize="20"
69+
FontWeight="SemiBold"
70+
Text="{DynamicResource customeQueryHotkeyTitle}"
71+
TextAlignment="Left" />
72+
</StackPanel>
2373
<StackPanel>
24-
<StackPanel Grid.Row="0" Margin="0 0 0 12">
25-
<TextBlock Grid.Column="0" Text="{DynamicResource customeQueryHotkeyTitle}" FontSize="20" FontWeight="SemiBold" FontFamily="Segoe UI" TextAlignment="Left"
26-
Margin="0 0 0 0" />
27-
</StackPanel>
28-
<StackPanel>
29-
<TextBlock
30-
Text="{DynamicResource customeQueryHotkeyTips}" Foreground="#1b1b1b" FontSize="14" TextWrapping="WrapWithOverflow" TextAlignment="Left"/>
31-
</StackPanel>
74+
<TextBlock
75+
FontSize="14"
76+
Text="{DynamicResource customeQueryHotkeyTips}"
77+
TextAlignment="Left"
78+
TextWrapping="WrapWithOverflow" />
79+
</StackPanel>
3280

33-
<StackPanel Orientation="Horizontal" Margin="0 20 0 0">
34-
<TextBlock Margin="10" FontSize="14" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center"
35-
HorizontalAlignment="Left" Text="{DynamicResource hotkey}" Width="60"/>
36-
<flowlauncher:HotkeyControl x:Name="ctlHotkey" Margin="10,0,10,0" Grid.Column="1" VerticalAlignment="Center" Height="32" HorizontalAlignment="Left" HorizontalContentAlignment="Left" Width="200"/>
37-
<TextBlock Margin="10" FontSize="14" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"
38-
HorizontalAlignment="Left" Text="{DynamicResource actionKeyword}" />
39-
</StackPanel>
81+
<StackPanel Margin="0,20,0,0" Orientation="Horizontal">
82+
<TextBlock
83+
Grid.Row="0"
84+
Grid.Column="0"
85+
Width="60"
86+
Margin="10"
87+
HorizontalAlignment="Left"
88+
VerticalAlignment="Center"
89+
FontSize="14"
90+
Text="{DynamicResource hotkey}" />
91+
<flowlauncher:HotkeyControl
92+
x:Name="ctlHotkey"
93+
Grid.Column="1"
94+
Width="200"
95+
Height="34"
96+
Margin="10,0,10,0"
97+
HorizontalAlignment="Left"
98+
VerticalAlignment="Center"
99+
HorizontalContentAlignment="Left" />
100+
<TextBlock
101+
Grid.Row="1"
102+
Grid.Column="0"
103+
Margin="10"
104+
HorizontalAlignment="Left"
105+
VerticalAlignment="Center"
106+
FontSize="14"
107+
Text="{DynamicResource actionKeyword}" />
108+
</StackPanel>
40109

41-
<StackPanel Orientation="Horizontal" Margin="0 0 0 0">
42-
<TextBlock Margin="10" FontSize="14" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Width="60"
43-
HorizontalAlignment="Left" Text="{DynamicResource customQuery}" />
44-
<TextBox x:Name="tbAction" Margin="10" Width="250" VerticalAlignment="Center" HorizontalAlignment="Left" />
45-
<Button x:Name="btnTestActionKeyword" Padding="10 5 10 5" Height="30" Click="BtnTestActionKeyword_OnClick"
46-
Content="{DynamicResource preview}" />
47-
</StackPanel>
110+
<StackPanel Margin="0,0,0,0" Orientation="Horizontal">
111+
<TextBlock
112+
Grid.Row="0"
113+
Grid.Column="0"
114+
Width="60"
115+
Margin="10"
116+
HorizontalAlignment="Left"
117+
VerticalAlignment="Center"
118+
FontSize="14"
119+
Text="{DynamicResource customQuery}" />
120+
<TextBox
121+
x:Name="tbAction"
122+
Width="250"
123+
Margin="10"
124+
HorizontalAlignment="Left"
125+
VerticalAlignment="Center" />
126+
<Button
127+
x:Name="btnTestActionKeyword"
128+
Height="30"
129+
Padding="10,5,10,5"
130+
Click="BtnTestActionKeyword_OnClick"
131+
Content="{DynamicResource preview}" />
48132
</StackPanel>
49-
</Grid>
50-
</Border>
51-
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="1">
52-
<Button x:Name="btnCancel" Click="BtnCancel_OnClick" Margin="10 0 5 0" Width="100" Height="32"
53-
Content="{DynamicResource cancel}" />
54-
<Button x:Name="btnAdd" Margin="5 0 10 0" Width="100" Height="32" Click="btnAdd_OnClick">
55-
<TextBlock x:Name="lblAdd" Text="{DynamicResource done}" />
56-
</Button>
133+
</StackPanel>
57134
</StackPanel>
135+
<Border
136+
Grid.Row="1"
137+
Margin="0,14,0,0"
138+
Background="{DynamicResource PopupButtonAreaBGColor}"
139+
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
140+
BorderThickness="0,1,0,0">
141+
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
142+
<Button
143+
x:Name="btnCancel"
144+
Width="100"
145+
Height="32"
146+
Margin="10,0,5,0"
147+
Click="BtnCancel_OnClick"
148+
Content="{DynamicResource cancel}" />
149+
<Button
150+
x:Name="btnAdd"
151+
Width="100"
152+
Height="32"
153+
Margin="5,0,10,0"
154+
Click="btnAdd_OnClick">
155+
<TextBlock x:Name="lblAdd" Text="{DynamicResource done}" />
156+
</Button>
157+
</StackPanel>
158+
</Border>
58159
</Grid>
59160
</Window>

Flow.Launcher/HotkeyControl.xaml

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,55 @@
1-
<UserControl x:Class="Flow.Launcher.HotkeyControl"
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-
xmlns:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
7-
mc:Ignorable="d"
8-
Height="24"
9-
d:DesignHeight="300" d:DesignWidth="300">
1+
<UserControl
2+
x:Class="Flow.Launcher.HotkeyControl"
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:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
Height="24"
9+
d:DesignHeight="300"
10+
d:DesignWidth="300"
11+
mc:Ignorable="d">
1012
<Grid>
1113
<Grid.ColumnDefinitions>
12-
<ColumnDefinition Width="200"/>
14+
<ColumnDefinition Width="200" />
1315
</Grid.ColumnDefinitions>
14-
<Popup x:Name="popup" AllowDrop="True" PopupAnimation="Fade" PlacementTarget="{Binding ElementName=tbHotkey}" IsOpen="{Binding IsKeyboardFocused, ElementName=tbHotkey, Mode=OneWay}" StaysOpen="True" AllowsTransparency="True" Placement="Top" VerticalOffset="-5">
15-
<Border Background="#f6f6f6" BorderBrush="#cecece" BorderThickness="1" CornerRadius="6" Width="120" Height="30">
16-
<TextBlock x:Name="tbMsg" FontSize="13" FontWeight="SemiBold" Visibility="Visible" Margin="0 0 0 0" VerticalAlignment="Center" HorizontalAlignment="Center">
17-
press key
16+
<Popup
17+
x:Name="popup"
18+
AllowDrop="True"
19+
AllowsTransparency="True"
20+
IsOpen="{Binding IsKeyboardFocused, ElementName=tbHotkey, Mode=OneWay}"
21+
Placement="Top"
22+
PlacementTarget="{Binding ElementName=tbHotkey}"
23+
PopupAnimation="Fade"
24+
StaysOpen="True"
25+
VerticalOffset="-5">
26+
<Border
27+
Width="140"
28+
Height="30"
29+
Background="{DynamicResource Color01B}"
30+
BorderBrush="{DynamicResource Color21B}"
31+
BorderThickness="1"
32+
CornerRadius="4">
33+
<TextBlock
34+
x:Name="tbMsg"
35+
Margin="0,0,0,0"
36+
HorizontalAlignment="Center"
37+
VerticalAlignment="Center"
38+
FontSize="13"
39+
FontWeight="SemiBold"
40+
Foreground="{DynamicResource Color05B}"
41+
Visibility="Visible">
42+
Press key
1843
</TextBlock>
1944
</Border>
2045
</Popup>
21-
22-
<TextBox x:Name="tbHotkey" TabIndex="100" VerticalContentAlignment="Center"
23-
PreviewKeyDown="TbHotkey_OnPreviewKeyDown" input:InputMethod.IsInputMethodEnabled="False" Margin="0 0 18 0">
24-
</TextBox>
46+
47+
<TextBox
48+
x:Name="tbHotkey"
49+
Margin="0,0,18,0"
50+
VerticalContentAlignment="Center"
51+
input:InputMethod.IsInputMethodEnabled="False"
52+
PreviewKeyDown="TbHotkey_OnPreviewKeyDown"
53+
TabIndex="100" />
2554
</Grid>
2655
</UserControl>

Flow.Launcher/Resources/Dark.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
<SolidColorBrush x:Key="CustomNumberBoxBG" Color="#292929" />
4040

4141
<SolidColorBrush x:Key="ThemeHoverButton" Color="#3c3c3c" />
42-
<SolidColorBrush x:Key="PopuBGColor" Color="#2b2b2b" />
42+
<SolidColorBrush x:Key="PopuBGColor" Color="#202020" />
4343
<SolidColorBrush x:Key="PopupTextColor" Color="#cfcfcf" />
44-
<SolidColorBrush x:Key="PopupButtonAreaBGColor" Color="#202020" />
44+
<SolidColorBrush x:Key="PopupButtonAreaBGColor" Color="#2b2b2b" />
4545
<SolidColorBrush x:Key="PopupButtonAreaBorderColor" Color="#3f3f3f" />
4646
<Color x:Key="Color01">#202020</Color>
4747
<Color x:Key="Color02">#2b2b2b</Color>

0 commit comments

Comments
 (0)