Skip to content

Commit 84f2686

Browse files
committed
Support placeholder size change
1 parent c74dd20 commit 84f2686

File tree

7 files changed

+65
-13
lines changed

7 files changed

+65
-13
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ public bool ShowPlaceholder
134134
OnPropertyChanged();
135135
}
136136
}
137+
string _placeholderText { get; set; } = string.Empty;
138+
public string PlaceholderText
139+
{
140+
get => _placeholderText;
141+
set
142+
{
143+
_placeholderText = value;
144+
OnPropertyChanged();
145+
}
146+
}
137147

138148
public int CustomExplorerIndex { get; set; } = 0;
139149

Flow.Launcher/Languages/en.xaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,10 @@
202202
<system:String x:Key="BackdropTypesMicaAlt">Mica Alt</system:String>
203203
<system:String x:Key="TypeIsDarkToolTip">This theme supports two(light/dark) modes.</system:String>
204204
<system:String x:Key="TypeHasBlurToolTip">This theme supports Blur Transparent Background.</system:String>
205-
<system:String x:Key="PlaceholderText">Placeholder Text</system:String>
206-
<system:String x:Key="PlaceholderTextTip">Display placeholder text when query is empty</system:String>
205+
<system:String x:Key="ShowPlaceholder">Show placeholder</system:String>
206+
<system:String x:Key="ShowPlaceholderTip">Display placeholder when query is empty</system:String>
207+
<system:String x:Key="PlaceholderText">Placeholder text</system:String>
208+
<system:String x:Key="PlaceholderTextTip">Change placeholder text. Input empty will use: Type here to search</system:String>
207209
<system:String x:Key="ResizeWindow">Allow window size change</system:String>
208210
<system:String x:Key="ResizeWindowTip">Allow dragging the search window edges to change its size</system:String>
209211

Flow.Launcher/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
FontSize="{Binding QueryBoxFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
225225
IsEnabled="False"
226226
Style="{DynamicResource QuerySuggestionBoxStyle}"
227-
Text="{DynamicResource queryTextBoxSuggestion}"
227+
Text="{Binding PlaceholderText, Mode=OneWay}"
228228
Visibility="Collapsed" />
229229
<TextBox
230230
x:Name="QueryTextSuggestionBox"

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
118118

119119
// Initialize place holder
120120
SetupPlaceholderText();
121+
_viewModel.PlaceholderText = _settings.PlaceholderText;
121122

122123
// Hide window if need
123124
UpdatePosition();
@@ -248,6 +249,9 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
248249
case nameof(Settings.ShowPlaceholder):
249250
SetupPlaceholderText();
250251
break;
252+
case nameof(Settings.PlaceholderText):
253+
_viewModel.PlaceholderText = _settings.PlaceholderText;
254+
break;
251255
case nameof(Settings.ResizeWindow):
252256
SetupResizeMode();
253257
break;

Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,12 @@ public bool ShowPlaceholder
271271
set => Settings.ShowPlaceholder = value;
272272
}
273273

274+
public string PlaceholderText
275+
{
276+
get => Settings.PlaceholderText;
277+
set => Settings.PlaceholderText = value;
278+
}
279+
274280
public bool UseClock
275281
{
276282
get => Settings.UseClock;

Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
<ColumnDefinition Width="8*" />
7171
<ColumnDefinition MaxWidth="250" Style="{StaticResource SecondColumnStyle}" />
7272
</Grid.ColumnDefinitions>
73+
7374
<!-- Theme Size Editor -->
7475
<Border
7576
Grid.Column="1"
@@ -542,16 +543,27 @@
542543
</cc:Card>
543544

544545
<!-- Placeholder text -->
545-
<cc:Card
546-
Title="{DynamicResource PlaceholderText}"
547-
Margin="0 14 0 0"
548-
Icon="&#xE82F;"
549-
Sub="{DynamicResource PlaceholderTextTip}">
550-
<ui:ToggleSwitch
551-
IsOn="{Binding ShowPlaceholder}"
552-
OffContent="{DynamicResource disable}"
553-
OnContent="{DynamicResource enable}" />
554-
</cc:Card>
546+
<cc:CardGroup Margin="0 14 0 0">
547+
<cc:Card
548+
Title="{DynamicResource ShowPlaceholder}"
549+
Icon="&#xE82F;"
550+
Sub="{DynamicResource ShowPlaceholderTip}">
551+
<ui:ToggleSwitch
552+
IsOn="{Binding ShowPlaceholder}"
553+
OffContent="{DynamicResource disable}"
554+
OnContent="{DynamicResource enable}" />
555+
</cc:Card>
556+
557+
<cc:Card
558+
Title="{DynamicResource PlaceholderText}"
559+
Icon="&#xED59;"
560+
Sub="{DynamicResource PlaceholderTextTip}">
561+
<TextBox
562+
MinWidth="80"
563+
Text="{Binding PlaceholderText}"
564+
TextWrapping="NoWrap" />
565+
</cc:Card>
566+
</cc:CardGroup>
555567

556568
<!-- Time and date -->
557569
<cc:CardGroup Margin="0 14 0 0">

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,24 @@ private ResultsViewModel SelectedResults
765765
public double ClockPanelOpacity { get; set; } = 1;
766766
public double SearchIconOpacity { get; set; } = 1;
767767

768+
private string _placeholderText;
769+
public string PlaceholderText
770+
{
771+
get => _placeholderText;
772+
set
773+
{
774+
if (string.IsNullOrEmpty(value))
775+
{
776+
_placeholderText = App.API.GetTranslation("queryTextBoxSuggestion");
777+
}
778+
else
779+
{
780+
_placeholderText = value;
781+
}
782+
OnPropertyChanged();
783+
}
784+
}
785+
768786
public double MainWindowWidth
769787
{
770788
get => Settings.WindowSize;

0 commit comments

Comments
 (0)