Skip to content

Commit b8d1611

Browse files
committed
Merge SettingWidth for the inclusion of fody in infrastrature project
2 parents 5ebe5d4 + 8ca8461 commit b8d1611

File tree

10 files changed

+972
-649
lines changed

10 files changed

+972
-649
lines changed

Flow.Launcher.Core/Resource/Theme.cs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -189,22 +189,11 @@ public ResourceDictionary GetResourceDictionary()
189189
new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o
190190
=> Array.ForEach(setters, p => o.Setters.Add(p)));
191191
}
192-
192+
/* Ignore Theme Window Width and use setting */
193193
var windowStyle = dict["WindowStyle"] as Style;
194-
195-
var width = windowStyle?.Setters.OfType<Setter>().Where(x => x.Property.Name == "Width")
196-
.Select(x => x.Value).FirstOrDefault();
197-
198-
if (width == null)
199-
{
200-
windowStyle = dict["BaseWindowStyle"] as Style;
201-
202-
width = windowStyle?.Setters.OfType<Setter>().Where(x => x.Property.Name == "Width")
203-
.Select(x => x.Value).FirstOrDefault();
204-
}
205-
194+
var width = Settings.WindowSize;
195+
windowStyle.Setters.Add(new Setter(Window.WidthProperty, width));
206196
mainWindowWidth = (double)width;
207-
208197
return dict;
209198
}
210199

@@ -375,8 +364,6 @@ private void SetWindowAccent(Window w, AccentState state)
375364
{
376365
var windowHelper = new WindowInteropHelper(w);
377366

378-
// this determines the width of the main query window
379-
w.Width = mainWindowWidth;
380367
windowHelper.EnsureHandle();
381368

382369
var accent = new AccentPolicy { AccentState = state };

Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,15 @@
5050

5151
<ItemGroup>
5252
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
53+
<PackageReference Include="Fody" Version="6.5.5">
54+
<PrivateAssets>all</PrivateAssets>
55+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
56+
</PackageReference>
5357
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="16.10.56" />
5458
<PackageReference Include="NLog" Version="4.7.10" />
5559
<PackageReference Include="NLog.Schema" Version="4.7.10" />
5660
<PackageReference Include="NLog.Web.AspNetCore" Version="4.13.0" />
61+
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
5762
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
5863
<!--ToolGood.Words.Pinyin v3.0.2.6 results in high memory usage when search with pinyin is enabled-->
5964
<!--Bumping to it or higher needs to test and ensure this is no longer a problem-->

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ namespace Flow.Launcher.Infrastructure.UserSettings
1212
public class Settings : BaseModel
1313
{
1414
private string language = "en";
15-
1615
public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}";
1716
public string OpenResultModifiers { get; set; } = KeyConstant.Alt;
1817
public bool ShowOpenResultHotkey { get; set; } = true;
18+
public double WindowSize { get; set; } = 580;
19+
1920
public string Language
2021
{
21-
get => language; set
22+
get => language;
23+
set
2224
{
2325
language = value;
2426
OnPropertyChanged();
@@ -77,7 +79,7 @@ public string QuerySearchPrecisionString
7779
try
7880
{
7981
var precisionScore = (SearchPrecisionScore)Enum
80-
.Parse(typeof(SearchPrecisionScore), value);
82+
.Parse(typeof(SearchPrecisionScore), value);
8183

8284
QuerySearchPrecision = precisionScore;
8385
StringMatcher.Instance.UserSettingSearchPrecision = precisionScore;

Flow.Launcher/Languages/en.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
<system:String x:Key="deleteCustomHotkeyWarning">Are you sure you want to delete {0} plugin hotkey?</system:String>
9999
<system:String x:Key="queryWindowShadowEffect">Query window shadow effect</system:String>
100100
<system:String x:Key="shadowEffectCPUUsage">Shadow effect has a substantial usage of GPU. Not recommended if your computer performance is limited.</system:String>
101+
<system:String x:Key="windowWidthSize">Window Width Size</system:String>
101102
<system:String x:Key="useGlyphUI">Use Segoe Fluent Icons</system:String>
102103
<system:String x:Key="useGlyphUIEffect">Use Segoe Fluent Icons for query results where supported</system:String>
103104

Flow.Launcher/MainWindow.xaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
LocationChanged="OnLocationChanged"
2727
Deactivated="OnDeactivated"
2828
PreviewKeyDown="OnKeyDown"
29+
MinWidth="{Binding MainWindowWidth, Mode=OneWay}"
30+
MaxWidth="{Binding MainWindowWidth, Mode=OneWay}"
2931
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
3032
d:DataContext="{d:DesignInstance vm:MainViewModel}">
3133
<Window.Resources>
@@ -102,7 +104,25 @@
102104
</Grid>
103105

104106
<Grid ClipToBounds="True">
105-
<Rectangle Width="Auto" HorizontalAlignment="Stretch" Style="{DynamicResource SeparatorStyle}" />
107+
<ContentControl>
108+
<ContentControl.Style>
109+
<Style TargetType="ContentControl">
110+
<Setter Property="Visibility" Value="Collapsed" />
111+
<Style.Triggers>
112+
<DataTrigger Binding="{Binding ElementName=ResultListBox, Path=Visibility}" Value="Visible">
113+
<Setter Property="Visibility" Value="Visible" />
114+
</DataTrigger>
115+
<DataTrigger Binding="{Binding ElementName=ContextMenu, Path=Visibility}" Value="Visible">
116+
<Setter Property="Visibility" Value="Visible" />
117+
</DataTrigger>
118+
<DataTrigger Binding="{Binding ElementName=History, Path=Visibility}" Value="Visible">
119+
<Setter Property="Visibility" Value="Visible" />
120+
</DataTrigger>
121+
</Style.Triggers>
122+
</Style>
123+
</ContentControl.Style>
124+
<Rectangle Width="Auto" HorizontalAlignment="Stretch" Style="{DynamicResource SeparatorStyle}"/>
125+
</ContentControl>
106126
<Line x:Name="ProgressBar" HorizontalAlignment="Right"
107127
Style="{DynamicResource PendingLineStyle}" Visibility="{Binding ProgressBarVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
108128
Y1="0" Y2="0" X1="-150" X2="-50" Height="2" Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}},Path=ActualWidth}" StrokeThickness="1">

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
2121
using MessageBox = System.Windows.MessageBox;
2222
using NotifyIcon = System.Windows.Forms.NotifyIcon;
23+
using System.Windows.Interop;
2324

2425
namespace Flow.Launcher
2526
{

0 commit comments

Comments
 (0)