Support resize window

This commit is contained in:
Jack251970 2025-03-29 13:25:00 +08:00
parent f485e8605a
commit a4dac91093
5 changed files with 57 additions and 8 deletions

View file

@ -113,7 +113,18 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public double? SettingWindowLeft { get; set; } = null;
public System.Windows.WindowState SettingWindowState { get; set; } = WindowState.Normal;
bool _showPlaceholder { get; set; } = true;
bool _resizeWindow { get; set; } = true;
public bool ResizeWindow
{
get => _resizeWindow;
set
{
_resizeWindow = value;
OnPropertyChanged();
}
}
bool _showPlaceholder { get; set; } = false;
public bool ShowPlaceholder
{
get => _showPlaceholder;

View file

@ -104,11 +104,6 @@
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
<system:String x:Key="BackdropType">Backdrop Type</system:String>
<system:String x:Key="BackdropTypesNone">None</system:String>
<system:String x:Key="BackdropTypesAcrylic">Acrylic</system:String>
<system:String x:Key="BackdropTypesMica">Mica</system:String>
<system:String x:Key="BackdropTypesMicaAlt">Mica Alt</system:String>
<!-- Setting Plugin -->
<system:String x:Key="searchplugin">Search Plugin</system:String>
@ -200,10 +195,17 @@
<system:String x:Key="AnimationSpeedCustom">Custom</system:String>
<system:String x:Key="Clock">Clock</system:String>
<system:String x:Key="Date">Date</system:String>
<system:String x:Key="BackdropType">Backdrop Type</system:String>
<system:String x:Key="BackdropTypesNone">None</system:String>
<system:String x:Key="BackdropTypesAcrylic">Acrylic</system:String>
<system:String x:Key="BackdropTypesMica">Mica</system:String>
<system:String x:Key="BackdropTypesMicaAlt">Mica Alt</system:String>
<system:String x:Key="TypeIsDarkToolTip">This theme supports two(light/dark) modes.</system:String>
<system:String x:Key="TypeHasBlurToolTip">This theme supports Blur Transparent Background.</system:String>
<system:String x:Key="PlaceholderText">Placeholder Text</system:String>
<system:String x:Key="PlaceholderTextTip">Display placeholder text when query is empty</system:String>
<system:String x:Key="ResizeWindow">Allow window size change</system:String>
<system:String x:Key="ResizeWindowTip">Allow dragging the search window edges to change its size</system:String>
<!-- Setting Hotkey -->
<system:String x:Key="hotkey">Hotkey</system:String>

View file

@ -115,6 +115,9 @@ namespace Flow.Launcher
welcomeWindow.Show();
}
// Initialize resize mode
SetupResizeMode();
// Initialize place holder
SetupPlaceholderText();
@ -243,6 +246,9 @@ namespace Flow.Launcher
case nameof(Settings.ShowPlaceholder):
SetupPlaceholderText();
break;
case nameof(Settings.ResizeWindow):
SetupResizeMode();
break;
}
};
@ -1071,6 +1077,15 @@ namespace Flow.Launcher
#endregion
#region Resize Mode
private void SetupResizeMode()
{
ResizeMode = _settings.ResizeWindow ? ResizeMode.CanResize : ResizeMode.NoResize;
}
#endregion
#region IDisposable
protected virtual void Dispose(bool disposing)

View file

@ -259,6 +259,12 @@ public partial class SettingsPaneThemeViewModel : BaseModel
set => Settings.SoundVolume = value;
}
public bool ResizeWindow
{
get => Settings.ResizeWindow;
set => Settings.ResizeWindow = value;
}
public bool ShowPlaceholder
{
get => Settings.ShowPlaceholder;

View file

@ -30,6 +30,7 @@
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.ScrollUnit="Pixel">
<StackPanel>
<!-- Page title -->
<TextBlock
Margin="5 23 0 5"
@ -38,6 +39,7 @@
Text="{DynamicResource appearance}"
TextAlignment="left"
Visibility="Collapsed" />
<!-- Theme Preview and Editor -->
<Grid>
<Grid.Style>
@ -260,7 +262,8 @@
</StackPanel>
</ScrollViewer>
</Border>
<!-- Theme Preview -->
<!-- Theme preview -->
<Border
Grid.Column="0"
Background="{Binding PreviewBackground}"
@ -495,7 +498,19 @@
Text="{DynamicResource browserMoreThemes}"
Uri="{Binding LinkThemeGallery}" />
<!-- Fixed Height -->
<!-- Resize window -->
<cc:Card
Title="{DynamicResource ResizeWindow}"
Margin="0 14 0 0"
Icon="&#xE744;"
Sub="{DynamicResource ResizeWindowTip}">
<ui:ToggleSwitch
IsOn="{Binding ResizeWindow}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}" />
</cc:Card>
<!-- Fixed height -->
<cc:CardGroup Margin="0 20 0 0">
<cc:Card
Title="{DynamicResource KeepMaxResults}"