mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix Clock/Search Icon show logic
This commit is contained in:
parent
350276dbf5
commit
b9f013e58b
2 changed files with 74 additions and 33 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Media;
|
using System.Media;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -58,7 +59,6 @@ namespace Flow.Launcher
|
||||||
|
|
||||||
// Window Animation
|
// Window Animation
|
||||||
private const double DefaultRightMargin = 66; //* this value from base.xaml
|
private const double DefaultRightMargin = 66; //* this value from base.xaml
|
||||||
private bool _animating;
|
|
||||||
private bool _isClockPanelAnimating = false;
|
private bool _isClockPanelAnimating = false;
|
||||||
|
|
||||||
// IDisposable
|
// IDisposable
|
||||||
|
|
@ -234,7 +234,7 @@ namespace Flow.Launcher
|
||||||
|
|
||||||
// Detect History.Visibility changes
|
// Detect History.Visibility changes
|
||||||
DependencyPropertyDescriptor
|
DependencyPropertyDescriptor
|
||||||
.FromProperty(VisibilityProperty, typeof(StackPanel)) // History는 StackPanel이라고 가정
|
.FromProperty(VisibilityProperty, typeof(StackPanel))
|
||||||
.AddValueChanged(History, (s, e) => UpdateClockPanelVisibility());
|
.AddValueChanged(History, (s, e) => UpdateClockPanelVisibility());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -269,7 +269,6 @@ namespace Flow.Launcher
|
||||||
|
|
||||||
private void OnLocationChanged(object sender, EventArgs e)
|
private void OnLocationChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_animating) return;
|
|
||||||
|
|
||||||
if (_settings.SearchWindowScreen == SearchWindowScreens.RememberLastLaunchLocation)
|
if (_settings.SearchWindowScreen == SearchWindowScreens.RememberLastLaunchLocation)
|
||||||
{
|
{
|
||||||
|
|
@ -592,7 +591,7 @@ namespace Flow.Launcher
|
||||||
|
|
||||||
private void UpdatePosition(bool force)
|
private void UpdatePosition(bool force)
|
||||||
{
|
{
|
||||||
if (_animating && !force)
|
if (!force)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -768,18 +767,20 @@ namespace Flow.Launcher
|
||||||
_viewModel.ProgressBarVisibility = Visibility.Hidden;
|
_viewModel.ProgressBarVisibility = Visibility.Hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WindowAnimation()
|
public void WindowAnimation()
|
||||||
{
|
{
|
||||||
if (_animating)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_isArrowKeyPressed = true;
|
_isArrowKeyPressed = true;
|
||||||
_animating = true;
|
|
||||||
UpdatePosition(false);
|
UpdatePosition(false);
|
||||||
|
if(_settings.UseAnimation)
|
||||||
ClockPanel.Opacity = 0;
|
{
|
||||||
SearchIcon.Opacity = 0;
|
ClockPanel.Opacity = 0;
|
||||||
|
SearchIcon.Opacity = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ClockPanel.Opacity = 1;
|
||||||
|
SearchIcon.Opacity = 1;
|
||||||
|
}
|
||||||
var clocksb = new Storyboard();
|
var clocksb = new Storyboard();
|
||||||
var iconsb = new Storyboard();
|
var iconsb = new Storyboard();
|
||||||
CircleEase easing = new CircleEase { EasingMode = EasingMode.EaseInOut };
|
CircleEase easing = new CircleEase { EasingMode = EasingMode.EaseInOut };
|
||||||
|
|
@ -848,16 +849,11 @@ namespace Flow.Launcher
|
||||||
clocksb.Children.Add(ClockOpacity);
|
clocksb.Children.Add(ClockOpacity);
|
||||||
iconsb.Children.Add(IconMotion);
|
iconsb.Children.Add(IconMotion);
|
||||||
iconsb.Children.Add(IconOpacity);
|
iconsb.Children.Add(IconOpacity);
|
||||||
|
|
||||||
clocksb.Completed += (_, _) => _animating = false;
|
|
||||||
_settings.WindowLeft = Left;
|
_settings.WindowLeft = Left;
|
||||||
_isArrowKeyPressed = false;
|
_isArrowKeyPressed = false;
|
||||||
|
|
||||||
if (QueryTextBox.Text.Length == 0)
|
clocksb.Begin(ClockPanel);
|
||||||
{
|
|
||||||
clocksb.Begin(ClockPanel);
|
|
||||||
}
|
|
||||||
|
|
||||||
iconsb.Begin(SearchIcon);
|
iconsb.Begin(SearchIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
@ -1437,11 +1438,43 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
// 📌 Remove DWM Cloak (Make the window visible normally)
|
// 📌 Remove DWM Cloak (Make the window visible normally)
|
||||||
Win32Helper.DWMSetCloakForWindow(mainWindow, false);
|
Win32Helper.DWMSetCloakForWindow(mainWindow, false);
|
||||||
|
|
||||||
|
//Clock and SearchIcon hide when show situation
|
||||||
|
if(Settings.UseAnimation)
|
||||||
|
{
|
||||||
|
mainWindow.ClockPanel.Opacity = 0;
|
||||||
|
mainWindow.SearchIcon.Opacity = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainWindow.ClockPanel.Opacity = 1;
|
||||||
|
mainWindow.SearchIcon.Opacity = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mainWindow.QueryTextBox.Text.Length != 0)
|
||||||
|
{
|
||||||
|
mainWindow.ClockPanel.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainWindow.ClockPanel.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
if (PluginIconSource != null)
|
||||||
|
{
|
||||||
|
mainWindow.SearchIcon.Opacity = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SearchIconVisibility = Visibility.Visible;
|
||||||
|
}
|
||||||
// 📌 Restore UI elements
|
// 📌 Restore UI elements
|
||||||
mainWindow.ClockPanel.Visibility = Visibility.Visible;
|
|
||||||
//mainWindow.SearchIcon.Visibility = Visibility.Visible;
|
//mainWindow.SearchIcon.Visibility = Visibility.Visible;
|
||||||
SearchIconVisibility = Visibility.Visible;
|
if (Settings.UseAnimation)
|
||||||
|
{
|
||||||
|
Application.Current.Dispatcher.BeginInvoke(() =>
|
||||||
|
mainWindow.WindowAnimation());
|
||||||
|
Debug.WriteLine("Call Animation");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update WPF properties
|
// Update WPF properties
|
||||||
|
|
@ -1474,15 +1507,19 @@ namespace Flow.Launcher.ViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
// 📌 Immediately apply text reset + force UI update
|
// 📌 Immediately apply text reset + force UI update
|
||||||
if (Settings.LastQueryMode == LastQueryMode.Empty)
|
/*if (Settings.LastQueryMode == LastQueryMode.Empty)
|
||||||
{
|
{
|
||||||
ChangeQueryText(string.Empty);
|
ChangeQueryText(string.Empty);
|
||||||
await Task.Delay(1); // Wait for one frame to ensure UI reflects changes
|
await Task.Delay(1); // Wait for one frame to ensure UI reflects changes
|
||||||
Application.Current.Dispatcher.Invoke(Application.Current.MainWindow.UpdateLayout); // Force UI update
|
Application.Current.Dispatcher.Invoke(Application.Current.MainWindow.UpdateLayout); // Force UI update
|
||||||
}
|
}*/
|
||||||
|
|
||||||
switch (Settings.LastQueryMode)
|
switch (Settings.LastQueryMode)
|
||||||
{
|
{
|
||||||
|
case LastQueryMode.Empty:
|
||||||
|
ChangeQueryText(string.Empty);
|
||||||
|
await Task.Delay(1);
|
||||||
|
break;
|
||||||
case LastQueryMode.Preserved:
|
case LastQueryMode.Preserved:
|
||||||
case LastQueryMode.Selected:
|
case LastQueryMode.Selected:
|
||||||
LastQuerySelected = (Settings.LastQueryMode == LastQueryMode.Preserved);
|
LastQuerySelected = (Settings.LastQueryMode == LastQueryMode.Preserved);
|
||||||
|
|
@ -1504,18 +1541,26 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
// 📌 Set Opacity of icon and clock to 0 and apply Visibility.Hidden
|
// 📌 Set Opacity of icon and clock to 0 and apply Visibility.Hidden
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
|
||||||
|
}, DispatcherPriority.Render);
|
||||||
|
if(Settings.UseAnimation)
|
||||||
{
|
{
|
||||||
mainWindow.ClockPanel.Opacity = 0;
|
mainWindow.ClockPanel.Opacity = 0;
|
||||||
mainWindow.SearchIcon.Opacity = 0;
|
mainWindow.SearchIcon.Opacity = 0;
|
||||||
mainWindow.ClockPanel.Visibility = Visibility.Hidden;
|
}
|
||||||
//mainWindow.SearchIcon.Visibility = Visibility.Hidden;
|
else
|
||||||
SearchIconVisibility = Visibility.Hidden;
|
{
|
||||||
|
mainWindow.ClockPanel.Opacity = 1;
|
||||||
// Force UI update
|
mainWindow.SearchIcon.Opacity = 1;
|
||||||
mainWindow.ClockPanel.UpdateLayout();
|
}
|
||||||
mainWindow.SearchIcon.UpdateLayout();
|
mainWindow.ClockPanel.Visibility = Visibility.Hidden;
|
||||||
}, DispatcherPriority.Render);
|
//mainWindow.SearchIcon.Visibility = Visibility.Hidden;
|
||||||
|
SearchIconVisibility = Visibility.Hidden;
|
||||||
|
|
||||||
|
// Force UI update
|
||||||
|
mainWindow.ClockPanel.UpdateLayout();
|
||||||
|
mainWindow.SearchIcon.UpdateLayout();
|
||||||
// 📌 Apply DWM Cloak (Completely hide the window)
|
// 📌 Apply DWM Cloak (Completely hide the window)
|
||||||
Win32Helper.DWMSetCloakForWindow(mainWindow, true);
|
Win32Helper.DWMSetCloakForWindow(mainWindow, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue