Skip to content
Merged
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
27 changes: 17 additions & 10 deletions Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.Storage;
using iNKORE.UI.WPF.Modern;

Check warning on line 28 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`NKORE` is not a recognized word. (unrecognized-spelling)
using Microsoft.VisualStudio.Threading;

namespace Flow.Launcher.ViewModel
Expand Down Expand Up @@ -65,7 +65,7 @@
Priority = 0 // Priority is for calculating scores in UpdateResultView
};

private bool _taskbarShownByFlow = false;

Check warning on line 68 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`taskbar` is not a recognized word. (unrecognized-spelling)

#endregion

Expand Down Expand Up @@ -273,7 +273,7 @@
#if DEBUG
throw t.Exception;
#else
App.API.LogError(ClassName, $"Error happen in task dealing with viewupdate for results. {t.Exception}");

Check warning on line 276 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`viewupdate` is not a recognized word. (unrecognized-spelling)
_resultsViewUpdateTask =
Task.Run(UpdateActionAsync).ContinueWith(continueAction, CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.Default);
#endif
Expand Down Expand Up @@ -515,8 +515,11 @@
return;
}

var hideWindow = false;
var isDialogJumpLeftClick = _isDialogJump && Settings.DialogJumpResultBehaviour == DialogJumpResultBehaviours.LeftClick;

// For Dialog Jump and left click mode, we need to navigate to the path
if (_isDialogJump && Settings.DialogJumpResultBehaviour == DialogJumpResultBehaviours.LeftClick)
if (isDialogJumpLeftClick)
{
if (result is DialogJumpResult dialogJumpResult)
{
Expand All @@ -531,26 +534,30 @@
// For query mode, we execute the result
else
{
var hideWindow = await result.ExecuteAsync(new ActionContext
hideWindow = await result.ExecuteAsync(new ActionContext
{
// not null means pressing modifier key + number, should ignore the modifier key
SpecialKeyState = index is not null ? SpecialKeyState.Default : GlobalHotkey.CheckModifiers()
}).ConfigureAwait(false);

if (hideWindow)
{
Hide();
}
}

// Record user selected result for result ranking
_userSelectedRecord.Add(result);
// Add item to history only if it is from results but not context menu or history
// New history result must be recorded before Hide() is called, otherwise when in 'Empty Last Query' query style mode
// the QueryAsync call will reconstruct the result list without the new item.
// Also, add item to history only if it is from results but not context menu or history.
if (queryResultsSelected)
{
_history.Add(result);
lastHistoryIndex = 1;
}

// Only hide for query results (not Dialog Jump left-click mode)
if (!isDialogJumpLeftClick && hideWindow)
{
Hide();
}

// Record user selected result for result ranking
_userSelectedRecord.Add(result);
}

private static IReadOnlyList<Result> DeepCloneResults(IReadOnlyList<Result> results, bool isDialogJump, CancellationToken token = default)
Expand Down Expand Up @@ -2149,11 +2156,11 @@
Win32Helper.SwitchToEnglishKeyboardLayout(true);
}

// Show the taskbar if the setting is enabled

Check warning on line 2159 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`taskbar` is not a recognized word. (unrecognized-spelling)
if (Settings.ShowTaskbarWhenInvoked && !_taskbarShownByFlow)

Check warning on line 2160 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`taskbar` is not a recognized word. (unrecognized-spelling)
{
Win32Helper.ShowTaskbar();
_taskbarShownByFlow = true;

Check warning on line 2163 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`taskbar` is not a recognized word. (unrecognized-spelling)
}
}

Expand Down Expand Up @@ -2223,7 +2230,7 @@
Win32Helper.RestorePreviousKeyboardLayout();
}

// Hide the taskbar if the setting is enabled

Check warning on line 2233 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`taskbar` is not a recognized word. (unrecognized-spelling)
if (_taskbarShownByFlow)
{
Win32Helper.HideTaskbar();
Expand Down
Loading