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
1 change: 1 addition & 0 deletions Flow.Launcher/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
LocationChanged="OnLocationChanged"
Opacity="{Binding MainWindowOpacity, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
PreviewKeyDown="OnKeyDown"
PreviewKeyUp="OnKeyUp"
ResizeMode="NoResize"
ShowInTaskbar="False"
SizeToContent="Height"
Expand Down
23 changes: 22 additions & 1 deletion Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public partial class MainWindow
private MainViewModel _viewModel;
private bool _animating;
MediaPlayer animationSound = new MediaPlayer();
private bool isArrowKeyPressed = false;

#endregion

Expand Down Expand Up @@ -109,9 +110,11 @@ private async void OnClosing(object sender, CancelEventArgs e)
private void OnInitialized(object sender, EventArgs e)
{
}

private void OnLoaded(object sender, RoutedEventArgs _)
{
// MouseEventHandler
PreviewMouseMove += MainPreviewMouseMove;

CheckFirstLaunch();
HideStartup();
// show notify icon when flowlauncher is hidden
Expand Down Expand Up @@ -406,6 +409,7 @@ public void WindowAnimator()
if (_animating)
return;

isArrowKeyPressed = true;
_animating = true;
UpdatePosition();

Expand Down Expand Up @@ -494,6 +498,7 @@ public void WindowAnimator()
windowsb.Completed += (_, _) => _animating = false;
_settings.WindowLeft = Left;
_settings.WindowTop = Top;
isArrowKeyPressed = false;

if (QueryTextBox.Text.Length == 0)
{
Expand Down Expand Up @@ -644,10 +649,12 @@ private void OnKeyDown(object sender, KeyEventArgs e)
switch (e.Key)
{
case Key.Down:
isArrowKeyPressed = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just did a quick test and found that holding Next Result hotkey also has this issue. IMO we should just left it. hard to fix for every hotkey.

Copy link
Contributor Author

@onesounds onesounds May 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you. Basically, the user mainly uses the single key, but the shortcut key that combines the two will not be used. (Pressing key situation) I think we can ignore other than this key.
+)And I tried logic to block any keyboard when I was just pressing it, but it didn't work out.

_viewModel.SelectNextItemCommand.Execute(null);
e.Handled = true;
break;
case Key.Up:
isArrowKeyPressed = true;
_viewModel.SelectPrevItemCommand.Execute(null);
e.Handled = true;
break;
Expand Down Expand Up @@ -698,7 +705,21 @@ private void OnKeyDown(object sender, KeyEventArgs e)

}
}
private void OnKeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Up || e.Key == Key.Down)
{
isArrowKeyPressed = false;
}
}

private void MainPreviewMouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
if (isArrowKeyPressed)
{
e.Handled = true; // Ignore Mouse Hover when press Arrowkeys
}
}
public void PreviewReset()
{
_viewModel.ResetPreview();
Expand Down