mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
- change visibility call structure (like powertoy)
- add some opacity trick for empty query - remove start animation
This commit is contained in:
parent
c6e2dc840f
commit
f77d45068d
3 changed files with 83 additions and 25 deletions
|
|
@ -28,22 +28,6 @@
|
||||||
PreviewKeyDown="OnKeyDown"
|
PreviewKeyDown="OnKeyDown"
|
||||||
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
d:DataContext="{d:DesignInstance vm:MainViewModel}">
|
d:DataContext="{d:DesignInstance vm:MainViewModel}">
|
||||||
<Window.Triggers>
|
|
||||||
<EventTrigger RoutedEvent="Window.Loaded">
|
|
||||||
<BeginStoryboard>
|
|
||||||
<Storyboard>
|
|
||||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:.5">
|
|
||||||
|
|
||||||
</DoubleAnimation>
|
|
||||||
<DoubleAnimation Storyboard.TargetProperty="Top" From="530" To="500" Duration="0:0:.5">
|
|
||||||
<DoubleAnimation.EasingFunction>
|
|
||||||
<QuarticEase EasingMode="EaseOut"/>
|
|
||||||
</DoubleAnimation.EasingFunction>
|
|
||||||
</DoubleAnimation>
|
|
||||||
</Storyboard>
|
|
||||||
</BeginStoryboard>
|
|
||||||
</EventTrigger>
|
|
||||||
</Window.Triggers>
|
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<converters:QuerySuggestionBoxConverter x:Key="QuerySuggestionBoxConverter"/>
|
<converters:QuerySuggestionBoxConverter x:Key="QuerySuggestionBoxConverter"/>
|
||||||
<converters:BorderClipConverter x:Key="BorderClipConverter"/>
|
<converters:BorderClipConverter x:Key="BorderClipConverter"/>
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,7 @@ namespace Flow.Launcher
|
||||||
{
|
{
|
||||||
if (_settings.HideWhenDeactive)
|
if (_settings.HideWhenDeactive)
|
||||||
{
|
{
|
||||||
Hide();
|
_viewModel.Hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -176,10 +176,18 @@ namespace Flow.Launcher.ViewModel
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateLastQUeryMode();
|
Hide();
|
||||||
var overlayTask = Task.Delay(50).ContinueWith(_ => {
|
}
|
||||||
MainWindowVisibility = Visibility.Collapsed;
|
});
|
||||||
});
|
|
||||||
|
ClearQueryCommand = new RelayCommand(_ =>
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(QueryText))
|
||||||
|
{
|
||||||
|
ChangeQueryText(string.Empty);
|
||||||
|
|
||||||
|
// Push Event to UI SystemQuery has changed
|
||||||
|
//OnPropertyChanged(nameof(SystemQueryText));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -217,7 +225,8 @@ namespace Flow.Launcher.ViewModel
|
||||||
|
|
||||||
if (hideWindow)
|
if (hideWindow)
|
||||||
{
|
{
|
||||||
MainWindowVisibility = Visibility.Collapsed;
|
//MainWindowVisibility = Visibility.Collapsed;
|
||||||
|
Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectedIsFromQueryResults())
|
if (SelectedIsFromQueryResults())
|
||||||
|
|
@ -267,7 +276,8 @@ namespace Flow.Launcher.ViewModel
|
||||||
Owner = Application.Current.MainWindow
|
Owner = Application.Current.MainWindow
|
||||||
};
|
};
|
||||||
|
|
||||||
MainWindowVisibility = Visibility.Collapsed;
|
//MainWindowVisibility = Visibility.Collapsed;
|
||||||
|
Hide();
|
||||||
|
|
||||||
PluginManager
|
PluginManager
|
||||||
.ReloadData()
|
.ReloadData()
|
||||||
|
|
@ -372,6 +382,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
public ICommand LoadHistoryCommand { get; set; }
|
public ICommand LoadHistoryCommand { get; set; }
|
||||||
public ICommand OpenResultCommand { get; set; }
|
public ICommand OpenResultCommand { get; set; }
|
||||||
public ICommand ReloadPluginDataCommand { get; set; }
|
public ICommand ReloadPluginDataCommand { get; set; }
|
||||||
|
public ICommand ClearQueryCommand { get; private set; }
|
||||||
|
|
||||||
public string OpenResultCommandModifiers { get; private set; }
|
public string OpenResultCommandModifiers { get; private set; }
|
||||||
|
|
||||||
|
|
@ -683,7 +694,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
OpenResultCommandModifiers = _settings.OpenResultModifiers ?? DefaultOpenResultModifiers;
|
OpenResultCommandModifiers = _settings.OpenResultModifiers ?? DefaultOpenResultModifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ToggleFlowLauncher()
|
public void ToggleFlowLauncher()
|
||||||
{
|
{
|
||||||
if (MainWindowVisibility != Visibility.Visible)
|
if (MainWindowVisibility != Visibility.Visible)
|
||||||
{
|
{
|
||||||
|
|
@ -691,12 +702,75 @@ namespace Flow.Launcher.ViewModel
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainWindowVisibility = Visibility.Collapsed;
|
if (_settings.LastQueryMode == LastQueryMode.Empty)
|
||||||
|
{
|
||||||
|
Application.Current.MainWindow.Opacity = 0; // Trick for no delay
|
||||||
|
ClearQueryCommand.Execute(null);
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
Thread.Sleep(100);
|
||||||
|
Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
|
||||||
|
{
|
||||||
|
MainWindowVisibility = Visibility.Collapsed;
|
||||||
|
Application.Current.MainWindow.Opacity = 1;
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
MainWindowVisibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Hide()
|
||||||
|
{
|
||||||
|
if (MainWindowVisibility != Visibility.Collapsed)
|
||||||
|
{
|
||||||
|
ToggleFlowLauncher();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public void OnHotkey()
|
||||||
|
{
|
||||||
|
if (!ShouldIgnoreHotkeys())
|
||||||
|
{
|
||||||
|
|
||||||
|
if (_settings.LastQueryMode == LastQueryMode.Empty)
|
||||||
|
{
|
||||||
|
ChangeQueryText(string.Empty);
|
||||||
|
}
|
||||||
|
else if (_settings.LastQueryMode == LastQueryMode.Preserved)
|
||||||
|
{
|
||||||
|
LastQuerySelected = true;
|
||||||
|
}
|
||||||
|
else if (_settings.LastQueryMode == LastQueryMode.Selected)
|
||||||
|
{
|
||||||
|
LastQuerySelected = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ArgumentException($"wrong LastQueryMode: <{_settings.LastQueryMode}>");
|
||||||
|
}
|
||||||
|
|
||||||
|
ToggleFlowLauncher();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if Flow Launcher should ignore any hotkeys
|
||||||
|
/// </summary>
|
||||||
|
private bool ShouldIgnoreHotkeys()
|
||||||
|
{
|
||||||
|
return _settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue