Skip to content

Commit 824befd

Browse files
committed
Add preserve last action keyword options
1 parent 1f81ea0 commit 824befd

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public string Theme
6262
public double ItemHeightSize { get; set; } = 58;
6363
public double QueryBoxFontSize { get; set; } = 20;
6464
public double ResultItemFontSize { get; set; } = 16;
65-
public double ResultSubItemFontSize { get; set; } = 13;
65+
public double ResultSubItemFontSize { get; set; } = 13;
6666
public string QueryBoxFont { get; set; } = FontFamily.GenericSansSerif.Name;
6767
public string QueryBoxFontStyle { get; set; }
6868
public string QueryBoxFontWeight { get; set; }
@@ -187,7 +187,7 @@ public CustomBrowserViewModel CustomBrowser
187187
public bool ShouldUsePinyin { get; set; } = false;
188188

189189
public bool AlwaysPreview { get; set; } = false;
190-
190+
191191
public bool AlwaysStartEn { get; set; } = false;
192192

193193
private SearchPrecisionScore _querySearchPrecision = SearchPrecisionScore.Regular;
@@ -370,7 +370,9 @@ public enum LastQueryMode
370370
{
371371
Selected,
372372
Empty,
373-
Preserved
373+
Preserved,
374+
ActionKeywordPreserved,
375+
ActionKeywordSelected
374376
}
375377

376378
public enum ColorSchemes

Flow.Launcher/Languages/en.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
<system:String x:Key="LastQueryPreserved">Preserve Last Query</system:String>
6868
<system:String x:Key="LastQuerySelected">Select last Query</system:String>
6969
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
70+
<system:String x:Key="LastQueryActionKeywordPreserved">Preserve Last Action Keyword</system:String>
71+
<system:String x:Key="LastQueryActionKeywordSelected">Select Last Action Keyword</system:String>
7072
<system:String x:Key="KeepMaxResults">Fixed Window Height</system:String>
7173
<system:String x:Key="KeepMaxResultsToolTip">The window height is not adjustable by dragging.</system:String>
7274
<system:String x:Key="maxShowResults">Maximum results shown</system:String>

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ public string VerifyOrSetDefaultHotkey(string hotkey, string defaultHotkey)
771771
public string Image => Constant.QueryTextBoxIconImagePath;
772772

773773
public bool StartWithEnglishMode => Settings.AlwaysStartEn;
774-
774+
775775
#endregion
776776

777777
#region Preview
@@ -833,7 +833,7 @@ when CanExternalPreviewSelectedResult(out var path):
833833
}
834834

835835
private void HidePreview()
836-
{
836+
{
837837
if (PluginManager.UseExternalPreview())
838838
CloseExternalPreview();
839839

@@ -912,7 +912,7 @@ when PluginManager.AllowAlwaysPreview() && CanExternalPreviewSelectedResult(out
912912
break;
913913
}
914914
}
915-
915+
916916
private void UpdatePreview()
917917
{
918918
switch (PluginManager.UseExternalPreview())
@@ -1401,6 +1401,16 @@ public async void Hide()
14011401
await Task.Delay(100);
14021402
LastQuerySelected = false;
14031403
break;
1404+
case LastQueryMode.ActionKeywordPreserved or LastQueryMode.ActionKeywordSelected:
1405+
var newQuery = _lastQuery.ActionKeyword;
1406+
if (!string.IsNullOrEmpty(newQuery))
1407+
newQuery += " ";
1408+
ChangeQueryText(newQuery);
1409+
if (Settings.UseAnimation)
1410+
await Task.Delay(100);
1411+
if (Settings.LastQueryMode == LastQueryMode.ActionKeywordSelected)
1412+
LastQuerySelected = false;
1413+
break;
14041414
default:
14051415
throw new ArgumentException($"wrong LastQueryMode: <{Settings.LastQueryMode}>");
14061416
}

0 commit comments

Comments
 (0)