Skip to content
2 changes: 2 additions & 0 deletions Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public void UpdateItem(CustomPluginHotkey item)

private void BtnTestActionKeyword_OnClick(object sender, RoutedEventArgs e)
{
// if user happens to open context menu, we need to return back to query results before changing query
App.API.BackToQueryResults();
App.API.ChangeQuery(tbAction.Text);
Application.Current.MainWindow.Show();
Application.Current.MainWindow.Opacity = 1;
Expand Down
2 changes: 2 additions & 0 deletions Flow.Launcher/CustomShortcutSetting.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ private void cmdEsc_OnPress(object sender, ExecutedRoutedEventArgs e)

private void BtnTestShortcut_OnClick(object sender, RoutedEventArgs e)
{
// if user happens to open context menu, we need to return back to query results before changing query
App.API.BackToQueryResults();
App.API.ChangeQuery(tbExpand.Text);
Application.Current.MainWindow.Show();
Application.Current.MainWindow.Opacity = 1;
Expand Down
4 changes: 4 additions & 0 deletions Flow.Launcher/ResultListBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ private void ResultList_MouseMove(object sender, MouseEventArgs e)
var rawQuery = query;
var effect = DragDrop.DoDragDrop((DependencyObject)sender, data, DragDropEffects.Move | DragDropEffects.Copy);
if (effect == DragDropEffects.Move)
{
// if user happens to open context menu, we need to return back to query results before changing query
App.API.BackToQueryResults();
App.API.ChangeQuery(rawQuery, true);
}
}
private void ResultListBox_OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
Expand Down
2 changes: 2 additions & 0 deletions Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,7 @@ private Result ContextMenuTopMost(Result result)
{
_topMostRecord.Remove(result);
App.API.ShowMsg(InternationalizationManager.Instance.GetTranslation("success"));
// if user happens to open context menu, we need to return back to query results before changing query
App.API.BackToQueryResults();
App.API.ReQuery();
return false;
Expand All @@ -1284,6 +1285,7 @@ private Result ContextMenuTopMost(Result result)
{
_topMostRecord.AddOrUpdate(result);
App.API.ShowMsg(InternationalizationManager.Instance.GetTranslation("success"));
// if user happens to open context menu, we need to return back to query results before changing query
App.API.BackToQueryResults();
App.API.ReQuery();
return false;
Expand Down
2 changes: 2 additions & 0 deletions Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public string Category
private void ShowCommandQuery(string action)
{
var actionKeyword = PluginManagerData.Metadata.ActionKeywords.Any() ? PluginManagerData.Metadata.ActionKeywords[0] + " " : String.Empty;
// if user happens to open context menu, we need to return back to query results before changing query
App.API.BackToQueryResults();
App.API.ChangeQuery($"{actionKeyword}{action} {_plugin.Name}");
App.API.ShowMainWindow();
}
Expand Down
2 changes: 2 additions & 0 deletions Flow.Launcher/ViewModel/PluginViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ private void OpenSourceCodeLink()
[RelayCommand]
private void OpenDeletePluginWindow()
{
// if user happens to open context menu, we need to return back to query results before changing query
PluginManager.API.BackToQueryResults();
Copy link
Member

Choose a reason for hiding this comment

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

Should we make it consistent to App.API? Similar to the following.

Copy link
Member Author

Choose a reason for hiding this comment

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

I use PluginManager.API here because OpenDeletePluginWindow use it to get the api instance.

PluginManager.API.ChangeQuery($"{PluginManagerActionKeyword} uninstall {PluginPair.Metadata.Name}".Trim(), true);
PluginManager.API.ShowMainWindow();
}
Expand Down
1 change: 0 additions & 1 deletion Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public List<Result> LoadContextMenus(Result selectedResult)
var link = pluginManifestInfo.UrlSourceCode.StartsWith("https://github.com")
? Regex.Replace(pluginManifestInfo.UrlSourceCode, @"\/tree\/\w+$", "") + "/issues"
: pluginManifestInfo.UrlSourceCode;

Context.API.OpenUrl(link);
return true;
}
Expand Down
5 changes: 3 additions & 2 deletions Plugins/Flow.Launcher.Plugin.Shell/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using WindowsInput;
using WindowsInput.Native;
using Flow.Launcher.Infrastructure.Hotkey;
Expand Down Expand Up @@ -379,9 +378,11 @@ bool API_GlobalKeyboardEvent(int keyevent, int vkcode, SpecialKeyState state)
private void OnWinRPressed()
{
// show the main window and set focus to the query box
Task.Run(() =>
_ = Task.Run(() =>
{
context.API.ShowMainWindow();
// if user happens to open context menu, we need to return back to query results before changing query
context.API.BackToQueryResults();
context.API.ChangeQuery($"{context.CurrentPluginMetadata.ActionKeywords[0]}{Plugin.Query.TermSeparator}");
});

Expand Down
Loading