mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
allow main query window's width to be dynamic
This commit is contained in:
parent
aa34a0202d
commit
b5272ddb47
6 changed files with 24 additions and 5 deletions
|
|
@ -30,6 +30,8 @@ namespace Flow.Launcher.Core.Resource
|
|||
|
||||
public bool BlurEnabled { get; set; }
|
||||
|
||||
private double mainWindowWidth;
|
||||
|
||||
public Theme()
|
||||
{
|
||||
_themeDirectories.Add(DirectoryPath);
|
||||
|
|
@ -187,6 +189,21 @@ namespace Flow.Launcher.Core.Resource
|
|||
Array.ForEach(new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle }, o => Array.ForEach(setters, p => o.Setters.Add(p)));
|
||||
}
|
||||
|
||||
var windowStyle = dict["WindowStyle"] as Style;
|
||||
|
||||
var width = windowStyle?.Setters.OfType<Setter>().Where(x => x.Property.Name == "Width")
|
||||
.Select(x => x.Value).FirstOrDefault();
|
||||
|
||||
if (width == null)
|
||||
{
|
||||
windowStyle = dict["BaseWindowStyle"] as Style;
|
||||
|
||||
width = windowStyle?.Setters.OfType<Setter>().Where(x => x.Property.Name == "Width")
|
||||
.Select(x => x.Value).FirstOrDefault();
|
||||
}
|
||||
|
||||
mainWindowWidth = (double)width;
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
|
|
@ -354,8 +371,11 @@ namespace Flow.Launcher.Core.Resource
|
|||
private void SetWindowAccent(Window w, AccentState state)
|
||||
{
|
||||
var windowHelper = new WindowInteropHelper(w);
|
||||
w.Width = 750;
|
||||
|
||||
// this determines the width of the main query window
|
||||
w.Width = mainWindowWidth;
|
||||
windowHelper.EnsureHandle();
|
||||
|
||||
var accent = new AccentPolicy { AccentState = state };
|
||||
var accentStructSize = Marshal.SizeOf(accent);
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
<KeyBinding Key="D8" Modifiers="{Binding OpenResultCommandModifiers}" Command="{Binding OpenResultCommand}" CommandParameter="7"></KeyBinding>
|
||||
<KeyBinding Key="D9" Modifiers="{Binding OpenResultCommandModifiers}" Command="{Binding OpenResultCommand}" CommandParameter="8"></KeyBinding>
|
||||
</Window.InputBindings>
|
||||
<Grid Width="750">
|
||||
<Grid>
|
||||
<Border Style="{DynamicResource WindowBorderStyle}" MouseDown="OnMouseDown" CornerRadius="5" >
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid>
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@
|
|||
<Setter Property="Padding" Value="8 10 8 8" />
|
||||
</Style>
|
||||
<Style x:Key="BaseWindowStyle" TargetType="{x:Type Window}">
|
||||
<Setter Property="Width" Value="750" />
|
||||
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="BasePendingLineStyle" TargetType="{x:Type Line}">
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
</Style>
|
||||
|
||||
<Style x:Key="WindowStyle" BasedOn="{StaticResource BaseWindowStyle}" TargetType="{x:Type Window}">
|
||||
<Setter Property="Width" Value="750" /> <!-- This is used to set the blur width only -->
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="Black" Opacity="0.6"/>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
</Style>
|
||||
|
||||
<Style x:Key="WindowStyle" BasedOn="{StaticResource BaseWindowStyle}" TargetType="{x:Type Window}">
|
||||
<Setter Property="Width" Value="750" /> <!-- This is used to set the blur width only -->
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="Black" Opacity="0.3"/>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
</Style>
|
||||
|
||||
<Style x:Key="WindowStyle" BasedOn="{StaticResource BaseWindowStyle}" TargetType="{x:Type Window}">
|
||||
<Setter Property="Width" Value="750" /> <!-- This is used to set the blur width only -->
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="White" Opacity="0.5"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue