Skip to content

Commit c9061a4

Browse files
authored
Merge pull request #2699 from onesounds/240514ResizableWindow
Resizable Window + Customize
2 parents 3d1434f + e39a7ed commit c9061a4

File tree

17 files changed

+1229
-615
lines changed

17 files changed

+1229
-615
lines changed

Flow.Launcher.Core/Resource/Theme.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ public ResourceDictionary GetResourceDictionary(string theme)
176176
}
177177

178178
if (dict["ItemTitleStyle"] is Style resultItemStyle &&
179-
dict["ItemSubTitleStyle"] is Style resultSubItemStyle &&
180-
dict["ItemSubTitleSelectedStyle"] is Style resultSubItemSelectedStyle &&
181179
dict["ItemTitleSelectedStyle"] is Style resultItemSelectedStyle &&
182180
dict["ItemHotkeyStyle"] is Style resultHotkeyItemStyle &&
183181
dict["ItemHotkeySelectedStyle"] is Style resultHotkeyItemSelectedStyle)
@@ -189,9 +187,25 @@ public ResourceDictionary GetResourceDictionary(string theme)
189187

190188
Setter[] setters = { fontFamily, fontStyle, fontWeight, fontStretch };
191189
Array.ForEach(
192-
new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o
190+
new[] { resultItemStyle, resultItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o
191+
=> Array.ForEach(setters, p => o.Setters.Add(p)));
192+
}
193+
194+
if (
195+
dict["ItemSubTitleStyle"] is Style resultSubItemStyle &&
196+
dict["ItemSubTitleSelectedStyle"] is Style resultSubItemSelectedStyle)
197+
{
198+
Setter fontFamily = new Setter(TextBlock.FontFamilyProperty, new FontFamily(Settings.ResultSubFont));
199+
Setter fontStyle = new Setter(TextBlock.FontStyleProperty, FontHelper.GetFontStyleFromInvariantStringOrNormal(Settings.ResultSubFontStyle));
200+
Setter fontWeight = new Setter(TextBlock.FontWeightProperty, FontHelper.GetFontWeightFromInvariantStringOrNormal(Settings.ResultSubFontWeight));
201+
Setter fontStretch = new Setter(TextBlock.FontStretchProperty, FontHelper.GetFontStretchFromInvariantStringOrNormal(Settings.ResultSubFontStretch));
202+
203+
Setter[] setters = { fontFamily, fontStyle, fontWeight, fontStretch };
204+
Array.ForEach(
205+
new[] { resultSubItemStyle,resultSubItemSelectedStyle}, o
193206
=> Array.ForEach(setters, p => o.Setters.Add(p)));
194207
}
208+
195209
/* Ignore Theme Window Width and use setting */
196210
var windowStyle = dict["WindowStyle"] as Style;
197211
var width = Settings.WindowSize;

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ public string Theme
5656
}
5757
}
5858
public bool UseDropShadowEffect { get; set; } = false;
59+
60+
/* Appearance Settings. It should be separated from the setting later.*/
61+
public double WindowHeightSize { get; set; } = 42;
62+
public double ItemHeightSize { get; set; } = 58;
63+
public double QueryBoxFontSize { get; set; } = 20;
64+
public double ResultItemFontSize { get; set; } = 16;
65+
public double ResultSubItemFontSize { get; set; } = 13;
5966
public string QueryBoxFont { get; set; } = FontFamily.GenericSansSerif.Name;
6067
public string QueryBoxFontStyle { get; set; }
6168
public string QueryBoxFontWeight { get; set; }
@@ -64,6 +71,10 @@ public string Theme
6471
public string ResultFontStyle { get; set; }
6572
public string ResultFontWeight { get; set; }
6673
public string ResultFontStretch { get; set; }
74+
public string ResultSubFont { get; set; } = FontFamily.GenericSansSerif.Name;
75+
public string ResultSubFontStyle { get; set; }
76+
public string ResultSubFontWeight { get; set; }
77+
public string ResultSubFontStretch { get; set; }
6778
public bool UseGlyphIcons { get; set; } = true;
6879
public bool UseAnimation { get; set; } = true;
6980
public bool UseSound { get; set; } = true;
@@ -205,6 +216,7 @@ public SearchPrecisionScore QuerySearchPrecision
205216
/// </summary>
206217
public double CustomWindowTop { get; set; } = 0;
207218

219+
public bool KeepMaxResults { get; set; } = false;
208220
public int MaxResultsToShow { get; set; } = 5;
209221
public int ActivateTimes { get; set; }
210222

Flow.Launcher/Languages/en.xaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
<system:String x:Key="LastQueryPreserved">Preserve Last Query</system:String>
5757
<system:String x:Key="LastQuerySelected">Select last Query</system:String>
5858
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
59+
<system:String x:Key="KeepMaxResults">Fixed Window Height</system:String>
60+
<system:String x:Key="KeepMaxResultsToolTip">The window height will not be resizeable by dragging</system:String>
5961
<system:String x:Key="maxShowResults">Maximum results shown</system:String>
6062
<system:String x:Key="maxShowResultsToolTip">You can also quickly adjust this by using CTRL+Plus and CTRL+Minus.</system:String>
6163
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignore hotkeys in fullscreen mode</system:String>
@@ -145,8 +147,13 @@
145147
<system:String x:Key="SampleSubTitleProgram">Launch programs as admin or a different user</system:String>
146148
<system:String x:Key="SampleTitleProcessKiller">ProcessKiller</system:String>
147149
<system:String x:Key="SampleSubTitleProcessKiller">Terminate unwanted processes</system:String>
150+
<system:String x:Key="SearchBarHeight">Search Bar Height</system:String>
151+
<system:String x:Key="ItemHeight">Item Height</system:String>
148152
<system:String x:Key="queryBoxFont">Query Box Font</system:String>
149-
<system:String x:Key="resultItemFont">Result Item Font</system:String>
153+
<system:String x:Key="resultItemFont">Result Title Font</system:String>
154+
<system:String x:Key="resultSubItemFont">Result Subtitle Font</system:String>
155+
<system:String x:Key="resetCustomize">Reset</system:String>
156+
<system:String x:Key="CustomizeToolTip">Customize</system:String>
150157
<system:String x:Key="windowMode">Window Mode</system:String>
151158
<system:String x:Key="opacity">Opacity</system:String>
152159
<system:String x:Key="theme_load_failure_path_not_exists">Theme {0} not exists, fallback to default theme</system:String>
@@ -173,6 +180,7 @@
173180
<system:String x:Key="Clock">Clock</system:String>
174181
<system:String x:Key="Date">Date</system:String>
175182

183+
176184
<!-- Setting Hotkey -->
177185
<system:String x:Key="hotkey">Hotkey</system:String>
178186
<system:String x:Key="hotkeys">Hotkeys</system:String>

0 commit comments

Comments
 (0)