Skip to content
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
3cc4f13
feat: New option to show executed results in settings
01Dri Oct 2, 2025
c0369e6
feat: radio button with history query option or history executed option
01Dri Oct 2, 2025
bc1f9d3
refactor: renaming executed history to last opened history
01Dri Oct 2, 2025
5fcd012
feat: text
01Dri Oct 2, 2025
7ba4f8d
feat: last opened history
01Dri Oct 4, 2025
e573656
feat: created a base History model
01Dri Oct 7, 2025
9e182a2
feat: base history model in MainView and refactoring code to replace …
01Dri Oct 7, 2025
3681340
feat: toggle history
01Dri Oct 9, 2025
4f2db28
faet: query action save
01Dri Oct 9, 2025
06711d3
feat: Saving actions for history
01Dri Oct 9, 2025
c051c5c
feat: new history logic in MainViewModel
01Dri Oct 9, 2025
b290055
feat: up
01Dri Oct 9, 2025
6aa35d5
merge dev
01Dri Oct 9, 2025
156cb30
merge
01Dri Oct 9, 2025
d122276
feat: clean imports
01Dri Oct 9, 2025
50f5e85
feat: code quality
01Dri Oct 10, 2025
545c420
code quality
01Dri Oct 10, 2025
8e8e9d3
code quality
01Dri Oct 10, 2025
9e1b8c1
feat: Populate new history system with legacy query history
01Dri Oct 11, 2025
bf2acfe
feat: code quality
01Dri Oct 11, 2025
95122e9
feat: code quality
01Dri Oct 11, 2025
e6cae1a
feat: helper
01Dri Oct 11, 2025
e468c48
feat: fix erros
01Dri Oct 11, 2025
d7579cc
fix erros
01Dri Oct 11, 2025
690d33e
up
01Dri Oct 11, 2025
a1f82e1
refactor: using count for better performance
01Dri Oct 11, 2025
a3b7c68
up
01Dri Oct 11, 2025
2b7c204
up
01Dri Oct 11, 2025
cc397d4
Merge branch 'dev' into feature/history_mode
01Dri Oct 11, 2025
e3527f4
Add RecordKey for precise history matching and refactor
Jack251970 Oct 13, 2025
7fa78f0
Code cleanup
Jack251970 Oct 13, 2025
b84ca9b
Improve code quality
Jack251970 Oct 14, 2025
f6d5a27
Refactor and enhance history management system
Jack251970 Oct 14, 2025
693bae7
Optimize query result selection handling
Jack251970 Oct 14, 2025
787ccad
Refactor history handling with async ResultHelper
Jack251970 Oct 14, 2025
66fe0b8
Adjust design-time height in SettingsPaneGeneral.xaml
Jack251970 Oct 14, 2025
0131b92
The HistoryStyle property is used to distinguish history items
01Dri Oct 15, 2025
ced824d
is equals
01Dri Oct 15, 2025
d5a2695
Update the history item if it equals the last added item or already e…
01Dri Oct 15, 2025
9f652c3
History items filtered based on HistoryStyle.
01Dri Oct 15, 2025
8e96d1a
HistoryStyle enum values
01Dri Oct 15, 2025
f31abe8
PopulateHistoryFromLegacyHistory with HistoryStyle
01Dri Oct 15, 2025
764c674
code quality
01Dri Oct 15, 2025
a8d3cdf
SubTitle equals
01Dri Oct 15, 2025
9ca7c84
Revert modifications and returning actions
01Dri Oct 15, 2025
10d353d
Returning actions
01Dri Oct 15, 2025
4b6ee4e
Improve code quality
Jack251970 Oct 15, 2025
1298b76
Track user-selected results for ranking purposes
Jack251970 Oct 15, 2025
c73689f
Fix spelling
Jack251970 Oct 15, 2025
629c2eb
Record user-selected results for ranking
Jack251970 Oct 15, 2025
b784a14
Update tooltip text for `historyStyleTooltip`
Jack251970 Oct 15, 2025
83cab76
Fix typos
Jack251970 Oct 15, 2025
df4f08b
Add exception logging to ResultHelper catch block
Jack251970 Oct 15, 2025
b13c29a
Record user selection after successful execution
Jack251970 Oct 15, 2025
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
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
<!-- Work around https://github.com/dotnet/runtime/issues/109682 -->
<!-- Workaround https://github.com/dotnet/runtime/issues/109682 -->
<CETCompat>false</CETCompat>
</PropertyGroup>
</Project>
26 changes: 26 additions & 0 deletions Flow.Launcher.Infrastructure/UserSettings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Flow.Launcher.Infrastructure.Hotkey;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.Storage;
using Flow.Launcher.Localization.Attributes;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedModels;

Expand Down Expand Up @@ -513,6 +514,21 @@ public bool ShowAtTopmost
[JsonConverter(typeof(JsonStringEnumConverter))]
public LastQueryMode LastQueryMode { get; set; } = LastQueryMode.Selected;

private HistoryStyle _historyStyle = HistoryStyle.Query;
[JsonConverter(typeof(JsonStringEnumConverter))]
public HistoryStyle HistoryStyle
{
get => _historyStyle;
set
{
if (_historyStyle != value)
{
_historyStyle = value;
OnPropertyChanged();
}
}
}

[JsonConverter(typeof(JsonStringEnumConverter))]
public AnimationSpeeds AnimationSpeed { get; set; } = AnimationSpeeds.Medium;
public int CustomAnimationLength { get; set; } = 360;
Expand Down Expand Up @@ -695,4 +711,14 @@ public enum DialogJumpFileResultBehaviours
FullPathOpen,
Directory
}

[EnumLocalize]
public enum HistoryStyle
{
[EnumLocalizeKey(nameof(Localize.queryHistory))]
Query,

[EnumLocalizeKey(nameof(Localize.executedHistory))]
LastOpened
}
}
2 changes: 1 addition & 1 deletion Flow.Launcher/Flow.Launcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
</Target>

<Target Name="RemoveDuplicateAnalyzers" BeforeTargets="CoreCompile">
<!-- Work around https://github.com/dotnet/wpf/issues/6792 -->
<!-- Workaround https://github.com/dotnet/wpf/issues/6792 -->
<ItemGroup>
<FilteredAnalyzer Include="@(Analyzer-&gt;Distinct())" />
<Analyzer Remove="@(Analyzer)" />
Expand Down
44 changes: 44 additions & 0 deletions Flow.Launcher/Helper/ResultHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Flow.Launcher.Core.Plugin;
using Flow.Launcher.Plugin;
using Flow.Launcher.Storage;

namespace Flow.Launcher.Helper;

#nullable enable

public static class ResultHelper
{
public static async Task<Result?> PopulateResultsAsync(LastOpenedHistoryItem item)
{
return await PopulateResultsAsync(item.PluginID, item.Query, item.Title, item.SubTitle, item.RecordKey);
}

public static async Task<Result?> PopulateResultsAsync(string pluginId, string rawQuery, string title, string subTitle, string recordKey)
{
var plugin = PluginManager.GetPluginForId(pluginId);
if (plugin == null) return null;
var query = QueryBuilder.Build(rawQuery, PluginManager.NonGlobalPlugins);
if (query == null) return null;
try
{
var freshResults = await plugin.Plugin.QueryAsync(query, CancellationToken.None);
// Try to match by record key first if it is valid, otherwise fall back to title + subtitle match
if (string.IsNullOrEmpty(recordKey))
{
return freshResults?.FirstOrDefault(r => r.Title == title && r.SubTitle == subTitle);
}
else
{
return freshResults?.FirstOrDefault(r => r.RecordKey == recordKey) ??
freshResults?.FirstOrDefault(r => r.Title == title && r.SubTitle == subTitle);
}
}
catch
{
return null;
}
}
}
4 changes: 4 additions & 0 deletions Flow.Launcher/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@
<system:String x:Key="homePageToolTip">Show home page results when query text is empty.</system:String>
<system:String x:Key="historyResultsForHomePage">Show History Results in Home Page</system:String>
<system:String x:Key="historyResultsCountForHomePage">Maximum History Results Shown in Home Page</system:String>
<system:String x:Key="historyStyle">History Style</system:String>
<system:String x:Key="historyStyleTooltip">Choose the type of history to show in the History and Home Page</system:String>
<system:String x:Key="queryHistory">Query history</system:String>
<system:String x:Key="executedHistory">Last opened history</system:String>
<system:String x:Key="homeToggleBoxToolTip">This can only be edited if plugin supports Home feature and Home Page is enabled.</system:String>
<system:String x:Key="showAtTopmost">Show Search Window at Foremost</system:String>
<system:String x:Key="showAtTopmostToolTip">Overrides other programs' 'Always on Top' setting and displays Flow in the foremost position.</system:String>
Expand Down
5 changes: 3 additions & 2 deletions Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
using Flow.Launcher.Plugin.SharedModels;
using Flow.Launcher.ViewModel;
using iNKORE.UI.WPF.Modern;
using iNKORE.UI.WPF.Modern.Controls;

Check warning on line 29 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`NKORE` is not a recognized word. (unrecognized-spelling)
using DataObject = System.Windows.DataObject;
using Key = System.Windows.Input.Key;
using MouseButtons = System.Windows.Forms.MouseButtons;
Expand Down Expand Up @@ -116,7 +116,7 @@
{
var handle = Win32Helper.GetWindowHandle(this, true);
_hwndSource = HwndSource.FromHwnd(handle);
_hwndSource.AddHook(WndProc);

Check warning on line 119 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Wnd` is not a recognized word. (unrecognized-spelling)
Win32Helper.HideFromAltTab(this);
Win32Helper.DisableControlBox(this);
}
Expand Down Expand Up @@ -322,6 +322,7 @@
break;
case nameof(Settings.ShowHomePage):
case nameof(Settings.ShowHistoryResultsForHomePage):
case nameof(Settings.HistoryStyle):
if (_viewModel.QueryResultsSelected() && string.IsNullOrEmpty(_viewModel.QueryText))
{
_viewModel.QueryResults();
Expand Down Expand Up @@ -373,7 +374,7 @@
{
try
{
_hwndSource.RemoveHook(WndProc);

Check warning on line 377 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Wnd` is not a recognized word. (unrecognized-spelling)
}
catch (Exception)
{
Expand Down Expand Up @@ -586,9 +587,9 @@

#endregion

#region Window WndProc

Check warning on line 590 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

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

private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)

Check warning on line 592 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Wnd` is not a recognized word. (unrecognized-spelling)
{
switch (msg)
{
Expand Down Expand Up @@ -812,14 +813,14 @@
Header = Localize.iconTrayOpen() + " (" + _settings.Hotkey + ")",
Icon = openIcon
};
var gamemodeIcon = new FontIcon { Glyph = "\ue7fc" };

Check warning on line 816 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`gamemode` is not a recognized word. (unrecognized-spelling)
var gamemode = new MenuItem

Check warning on line 817 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`gamemode` is not a recognized word. (unrecognized-spelling)
{
Header = Localize.GameMode(),
Icon = gamemodeIcon

Check warning on line 820 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`gamemode` is not a recognized word. (unrecognized-spelling)
};
var positionresetIcon = new FontIcon { Glyph = "\ue73f" };
var positionreset = new MenuItem

Check warning on line 823 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`positionreset` is not a recognized word. (unrecognized-spelling)
{
Header = Localize.PositionReset(),
Icon = positionresetIcon
Expand Down Expand Up @@ -859,7 +860,7 @@

public void UpdatePosition()
{
// Initialize call twice to work around multi-display alignment issue- https://github.com/Flow-Launcher/Flow.Launcher/issues/2910
// Initialize call twice to workaround multi-display alignment issue- https://github.com/Flow-Launcher/Flow.Launcher/issues/2910
if (_viewModel.IsDialogJumpWindowUnderDialog())
{
InitializeDialogJumpPosition();
Expand All @@ -883,7 +884,7 @@

private void InitializePosition()
{
// Initialize call twice to work around multi-display alignment issue- https://github.com/Flow-Launcher/Flow.Launcher/issues/2910
// Initialize call twice to workaround multi-display alignment issue- https://github.com/Flow-Launcher/Flow.Launcher/issues/2910
InitializePositionInner();
InitializePositionInner();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ public bool PortableMode
public List<LastQueryModeData> LastQueryModes { get; } =
DropdownDataGeneric<LastQueryMode>.GetValues<LastQueryModeData>("LastQuery");

public List<HistoryStyleLocalized> HistoryStyles { get; } = HistoryStyleLocalized.GetValues();

public bool EnableDialogJump
{
get => Settings.EnableDialogJump;
Expand Down Expand Up @@ -213,6 +215,7 @@ private void UpdateEnumDropdownLocalizations()
DropdownDataGeneric<SearchWindowAligns>.UpdateLabels(SearchWindowAligns);
DropdownDataGeneric<SearchPrecisionScore>.UpdateLabels(SearchPrecisionScores);
DropdownDataGeneric<LastQueryMode>.UpdateLabels(LastQueryModes);
HistoryStyleLocalized.UpdateLabels(HistoryStyles);
DropdownDataGeneric<DoublePinyinSchemas>.UpdateLabels(DoublePinyinSchemas);
DropdownDataGeneric<DialogJumpWindowPositions>.UpdateLabels(DialogJumpWindowPositions);
DropdownDataGeneric<DialogJumpResultBehaviours>.UpdateLabels(DialogJumpResultBehaviours);
Expand Down
16 changes: 16 additions & 0 deletions Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,22 @@
SelectedValuePath="Value" />
</ui:SettingsCard>

<ui:SettingsCard
Margin="0 14 0 0"
Description="{DynamicResource historyStyleTooltip}"
Header="{DynamicResource historyStyle}">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Glyph="&#xE81C;" />
</ui:SettingsCard.HeaderIcon>

<ComboBox
MaxWidth="200"
DisplayMemberPath="Display"
ItemsSource="{Binding HistoryStyles}"
SelectedValue="{Binding Settings.HistoryStyle}"
SelectedValuePath="Value" />
</ui:SettingsCard>

<ui:SettingsCard
Margin="0 14 0 0"
Description="{DynamicResource autoRestartAfterChangingToolTip}"
Expand Down
5 changes: 3 additions & 2 deletions Flow.Launcher/Storage/HistoryItem.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System;
using System;

namespace Flow.Launcher.Storage
{
[Obsolete("Use LastOpenedHistoryItem instead. This class will be removed in future versions.")]
public class HistoryItem
{
public string Query { get; set; }
Expand Down Expand Up @@ -42,4 +43,4 @@ private string DateTimeAgo(DateTime dt)
return string.Empty;
}
}
}
}
31 changes: 31 additions & 0 deletions Flow.Launcher/Storage/LastOpenedHistoryItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using Flow.Launcher.Plugin;

namespace Flow.Launcher.Storage;

public class LastOpenedHistoryItem
{
public string Title { get; set; } = string.Empty;
public string SubTitle { get; set; } = string.Empty;
public string PluginID { get; set; } = string.Empty;
public string Query { get; set; } = string.Empty;
public string RecordKey { get; set; } = string.Empty;
public DateTime ExecutedDateTime { get; set; }

public bool Equals(Result r)
{
if (string.IsNullOrEmpty(RecordKey) || string.IsNullOrEmpty(r.RecordKey))
{
return Title == r.Title
&& SubTitle == r.SubTitle
&& PluginID == r.PluginID
&& Query == r.OriginQuery.RawQuery;
}
else
{
return RecordKey == r.RecordKey
&& PluginID == r.PluginID
&& Query == r.OriginQuery.RawQuery;
}
}
}
50 changes: 40 additions & 10 deletions Flow.Launcher/Storage/QueryHistory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,63 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using Flow.Launcher.Plugin;

namespace Flow.Launcher.Storage
{
public class History
{
[JsonInclude]
public List<HistoryItem> Items { get; private set; } = new List<HistoryItem>();
#pragma warning disable CS0618 // Type or member is obsolete
public List<HistoryItem> Items { get; private set; } = [];
#pragma warning restore CS0618 // Type or member is obsolete

private int _maxHistory = 300;
[JsonInclude]
public List<LastOpenedHistoryItem> LastOpenedHistoryItems { get; private set; } = [];

private readonly int _maxHistory = 300;

public void PopulateHistoryFromLegacyHistory()
{
if (Items.Count == 0) return;
// Migrate old history items to new LastOpenedHistoryItems
foreach (var item in Items)
{
LastOpenedHistoryItems.Add(new LastOpenedHistoryItem
{
Query = item.Query,
ExecutedDateTime = item.ExecutedDateTime
});
}
Items.Clear();
}

public void Add(string query)
public void Add(Result result)
{
if (string.IsNullOrEmpty(query)) return;
if (Items.Count > _maxHistory)
if (string.IsNullOrEmpty(result.OriginQuery.RawQuery)) return;
if (string.IsNullOrEmpty(result.PluginID)) return;

// Maintain the max history limit
if (LastOpenedHistoryItems.Count > _maxHistory)
{
Items.RemoveAt(0);
LastOpenedHistoryItems.RemoveAt(0);
}

if (Items.Count > 0 && Items.Last().Query == query)
// If the last item is the same as the current result, just update the timestamp
if (LastOpenedHistoryItems.Count > 0 &&
LastOpenedHistoryItems.Last().Equals(result))
{
Items.Last().ExecutedDateTime = DateTime.Now;
LastOpenedHistoryItems.Last().ExecutedDateTime = DateTime.Now;
}
else
{
Items.Add(new HistoryItem
LastOpenedHistoryItems.Add(new LastOpenedHistoryItem
{
Query = query,
Title = result.Title,
SubTitle = result.SubTitle,
PluginID = result.PluginID,
Query = result.OriginQuery.RawQuery,
RecordKey = result.RecordKey,
ExecutedDateTime = DateTime.Now
});
}
Expand Down
Loading
Loading