Skip to content

Commit

Permalink
Merge pull request #3118 from Flow-Launcher/add-preserve-last-action-…
Browse files Browse the repository at this point in the history
…keyword-option

Add preserve last action keyword options
  • Loading branch information
jjw24 authored Dec 22, 2024
2 parents 0506f09 + 824befd commit 06a9faf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
8 changes: 5 additions & 3 deletions Flow.Launcher.Infrastructure/UserSettings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public string Theme
public double ItemHeightSize { get; set; } = 58;
public double QueryBoxFontSize { get; set; } = 20;
public double ResultItemFontSize { get; set; } = 16;
public double ResultSubItemFontSize { get; set; } = 13;
public double ResultSubItemFontSize { get; set; } = 13;
public string QueryBoxFont { get; set; } = FontFamily.GenericSansSerif.Name;
public string QueryBoxFontStyle { get; set; }
public string QueryBoxFontWeight { get; set; }
Expand Down Expand Up @@ -187,7 +187,7 @@ public CustomBrowserViewModel CustomBrowser
public bool ShouldUsePinyin { get; set; } = false;

public bool AlwaysPreview { get; set; } = false;

public bool AlwaysStartEn { get; set; } = false;

private SearchPrecisionScore _querySearchPrecision = SearchPrecisionScore.Regular;
Expand Down Expand Up @@ -370,7 +370,9 @@ public enum LastQueryMode
{
Selected,
Empty,
Preserved
Preserved,
ActionKeywordPreserved,
ActionKeywordSelected
}

public enum ColorSchemes
Expand Down
2 changes: 2 additions & 0 deletions Flow.Launcher/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
<system:String x:Key="LastQueryPreserved">Preserve Last Query</system:String>
<system:String x:Key="LastQuerySelected">Select last Query</system:String>
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
<system:String x:Key="LastQueryActionKeywordPreserved">Preserve Last Action Keyword</system:String>
<system:String x:Key="LastQueryActionKeywordSelected">Select Last Action Keyword</system:String>
<system:String x:Key="KeepMaxResults">Fixed Window Height</system:String>
<system:String x:Key="KeepMaxResultsToolTip">The window height is not adjustable by dragging.</system:String>
<system:String x:Key="maxShowResults">Maximum results shown</system:String>
Expand Down
16 changes: 13 additions & 3 deletions Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ public string VerifyOrSetDefaultHotkey(string hotkey, string defaultHotkey)
public string Image => Constant.QueryTextBoxIconImagePath;

public bool StartWithEnglishMode => Settings.AlwaysStartEn;

#endregion

#region Preview
Expand Down Expand Up @@ -833,7 +833,7 @@ when CanExternalPreviewSelectedResult(out var path):
}

private void HidePreview()
{
{
if (PluginManager.UseExternalPreview())
CloseExternalPreview();

Expand Down Expand Up @@ -912,7 +912,7 @@ when PluginManager.AllowAlwaysPreview() && CanExternalPreviewSelectedResult(out
break;
}
}

private void UpdatePreview()
{
switch (PluginManager.UseExternalPreview())
Expand Down Expand Up @@ -1401,6 +1401,16 @@ public async void Hide()
await Task.Delay(100);
LastQuerySelected = false;
break;
case LastQueryMode.ActionKeywordPreserved or LastQueryMode.ActionKeywordSelected:
var newQuery = _lastQuery.ActionKeyword;
if (!string.IsNullOrEmpty(newQuery))
newQuery += " ";
ChangeQueryText(newQuery);
if (Settings.UseAnimation)
await Task.Delay(100);
if (Settings.LastQueryMode == LastQueryMode.ActionKeywordSelected)
LastQuerySelected = false;
break;
default:
throw new ArgumentException($"wrong LastQueryMode: <{Settings.LastQueryMode}>");
}
Expand Down

0 comments on commit 06a9faf

Please sign in to comment.