Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 21 additions & 35 deletions Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public partial class MainWindow : IDisposable

// Window Animation
private const double DefaultRightMargin = 66; //* this value from base.xaml
private bool _animating;
private bool _isClockPanelAnimating = false;

// IDisposable
Expand All @@ -76,7 +75,7 @@ public MainWindow()
DataContext = _viewModel;

InitializeComponent();
UpdatePosition(true);
UpdatePosition();

InitSoundEffects();
DataObject.AddPastingHandler(QueryTextBox, QueryTextBox_OnPaste);
Expand Down Expand Up @@ -112,7 +111,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
}

// Hide window if need
UpdatePosition(true);
UpdatePosition();
if (_settings.HideOnStartup)
{
_viewModel.Hide();
Expand All @@ -139,7 +138,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
InitProgressbarAnimation();

// Force update position
UpdatePosition(true);
UpdatePosition();

// Refresh frame
await Ioc.Default.GetRequiredService<Theme>().RefreshFrameAsync();
Expand Down Expand Up @@ -167,7 +166,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
SoundPlay();
}

UpdatePosition(false);
UpdatePosition();
_viewModel.ResetPreview();
Activate();
QueryTextBox.Focus();
Expand Down Expand Up @@ -234,7 +233,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)

// Detect History.Visibility changes
DependencyPropertyDescriptor
.FromProperty(VisibilityProperty, typeof(StackPanel)) // History는 StackPanel이라고 가정
.FromProperty(VisibilityProperty, typeof(StackPanel))
.AddValueChanged(History, (s, e) => UpdateClockPanelVisibility());
}

Expand Down Expand Up @@ -269,8 +268,6 @@ private void OnClosed(object sender, EventArgs e)

private void OnLocationChanged(object sender, EventArgs e)
{
if (_animating) return;

if (_settings.SearchWindowScreen == SearchWindowScreens.RememberLastLaunchLocation)
{
_settings.WindowLeft = Left;
Expand All @@ -282,17 +279,18 @@ private async void OnDeactivated(object sender, EventArgs e)
{
_settings.WindowLeft = Left;
_settings.WindowTop = Top;

ClockPanel.Opacity = 0;
SearchIcon.Opacity = 0;
//This condition stops extra hide call when animator is on,

// This condition stops extra hide call when animator is on,
// which causes the toggling to occasional hide instead of show.
if (_viewModel.MainWindowVisibilityStatus)
{
// Need time to initialize the main query window animation.
// This also stops the mainwindow from flickering occasionally after Settings window is opened
// and always after Settings window is closed.
if (_settings.UseAnimation)

await Task.Delay(100);

if (_settings.HideWhenDeactivated && !_viewModel.ExternalPreviewVisible)
Expand Down Expand Up @@ -590,13 +588,8 @@ private void UpdateNotifyIconText()

#region Window Position

private void UpdatePosition(bool force)
private void UpdatePosition()
{
if (_animating && !force)
{
return;
}

// Initialize call twice to work around multi-display alignment issue- https://github.com/Flow-Launcher/Flow.Launcher/issues/2910
InitializePosition();
InitializePosition();
Expand Down Expand Up @@ -770,19 +763,17 @@ private void InitProgressbarAnimation()

private void WindowAnimation()
{
if (_animating)
return;

_isArrowKeyPressed = true;
_animating = true;
UpdatePosition(false);

ClockPanel.Opacity = 0;
SearchIcon.Opacity = 0;

UpdatePosition();

var opacity = _settings.UseAnimation ? 0.0 : 1.0;
ClockPanel.Opacity = opacity;
SearchIcon.Opacity = opacity;

var clocksb = new Storyboard();
var iconsb = new Storyboard();
CircleEase easing = new CircleEase { EasingMode = EasingMode.EaseInOut };
var easing = new CircleEase { EasingMode = EasingMode.EaseInOut };

var animationLength = _settings.AnimationSpeed switch
{
Expand Down Expand Up @@ -810,7 +801,7 @@ private void WindowAnimation()
FillBehavior = FillBehavior.HoldEnd
};

double TargetIconOpacity = GetOpacityFromStyle(SearchIcon.Style, 1.0);
var TargetIconOpacity = GetOpacityFromStyle(SearchIcon.Style, 1.0);

var IconOpacity = new DoubleAnimation
{
Expand All @@ -821,7 +812,7 @@ private void WindowAnimation()
FillBehavior = FillBehavior.HoldEnd
};

double rightMargin = GetThicknessFromStyle(ClockPanel.Style, new Thickness(0, 0, DefaultRightMargin, 0)).Right;
var rightMargin = GetThicknessFromStyle(ClockPanel.Style, new Thickness(0, 0, DefaultRightMargin, 0)).Right;

var thicknessAnimation = new ThicknessAnimation
{
Expand All @@ -848,16 +839,11 @@ private void WindowAnimation()
clocksb.Children.Add(ClockOpacity);
iconsb.Children.Add(IconMotion);
iconsb.Children.Add(IconOpacity);

clocksb.Completed += (_, _) => _animating = false;

_settings.WindowLeft = Left;
_isArrowKeyPressed = false;

if (QueryTextBox.Text.Length == 0)
{
clocksb.Begin(ClockPanel);
}


clocksb.Begin(ClockPanel);
iconsb.Begin(SearchIcon);
}

Expand Down
2 changes: 2 additions & 0 deletions Flow.Launcher/Resources/Dark.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@
<SolidColorBrush x:Key="InfoBarWarningIcon" Color="#FCE100" />
<SolidColorBrush x:Key="InfoBarWarningBG" Color="#433519" />
<SolidColorBrush x:Key="InfoBarBD" Color="#19000000" />

<SolidColorBrush x:Key="MouseOverWindowCloseButtonForegroundBrush" Color="#ffffff" />

<SolidColorBrush x:Key="ButtonOutBorder" Color="Transparent" />
<SolidColorBrush x:Key="ButtonInsideBorder" Color="#3f3f3f" />
Expand Down
1 change: 1 addition & 0 deletions Flow.Launcher/Resources/Light.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
<SolidColorBrush x:Key="InfoBarWarningBG" Color="#FFF4CE" />
<SolidColorBrush x:Key="InfoBarBD" Color="#0F000000" />

<SolidColorBrush x:Key="MouseOverWindowCloseButtonForegroundBrush" Color="#ffffff" />

<SolidColorBrush x:Key="ButtonOutBorder" Color="#e5e5e5" />
<SolidColorBrush x:Key="ButtonInsideBorder" Color="#d3d3d3" />
Expand Down
3 changes: 3 additions & 0 deletions Flow.Launcher/SettingWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
Loaded="OnLoaded"
MouseDown="window_MouseDown"
ResizeMode="CanResize"
SnapsToDevicePixels="True"
UseLayoutRounding="True"
StateChanged="Window_StateChanged"
Top="{Binding SettingWindowTop, Mode=TwoWay}"
WindowStartupLocation="Manual"
Expand Down Expand Up @@ -54,6 +56,7 @@
Width="16"
Height="16"
Margin="10 4 4 4"
RenderOptions.BitmapScalingMode="HighQuality"
Source="/Images/app.png" />
<TextBlock
Grid.Row="0"
Expand Down
Loading
Loading