feat: New option to show executed results in settings

This commit is contained in:
01Dri 2025-10-01 23:05:41 -03:00
parent 8bac530504
commit 3cc4f13f4d
4 changed files with 59 additions and 9 deletions

View file

@ -230,6 +230,21 @@ namespace Flow.Launcher.Infrastructure.UserSettings
}
}
private bool _showHistoryExecutedResultsForHomePage = false;
public bool ShowHistoryExecutedResultsForHomePage
{
get => _showHistoryExecutedResultsForHomePage;
set
{
if (_showHistoryExecutedResultsForHomePage != value)
{
_showHistoryExecutedResultsForHomePage = value;
OnPropertyChanged();
}
}
}
public int MaxHistoryResultsToShowForHomePage { get; set; } = 5;
public bool AutoRestartAfterChanging { get; set; } = false;

View file

@ -165,6 +165,7 @@
<system:String x:Key="homePage">Home Page</system:String>
<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="historyExecutedResultsForHomePage">Show History Executed Results in Home Page</system:String>
<system:String x:Key="historyResultsCountForHomePage">Maximum History Results Shown in Home Page</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>

View file

@ -381,18 +381,31 @@
OnContent="{DynamicResource enable}" />
</cc:ExCard.SideContent>
<cc:Card Title="{DynamicResource historyResultsCountForHomePage}" Type="InsideFit">
<ui:NumberBox
Width="120"
Margin="0 0 0 0"
Maximum="100"
Minimum="0"
SmallChange="5"
SpinButtonPlacementMode="Compact"
ValidationMode="InvalidInputOverwritten"
Value="{Binding MaxHistoryResultsToShowValue}" />
<StackPanel Orientation="Vertical">
<ui:NumberBox
Width="120"
Margin="0 0 0 0"
Maximum="100"
Minimum="0"
SmallChange="5"
SpinButtonPlacementMode="Compact"
ValidationMode="InvalidInputOverwritten"
Value="{Binding MaxHistoryResultsToShowValue}" />
</StackPanel>
</cc:Card>
</cc:ExCard>
<cc:Card
Title="{DynamicResource historyExecutedResultsForHomePage}"
Margin="0 14 0 0"
Icon="&#xE81C;"
Sub="{DynamicResource homePageToolTip}">
<ui:ToggleSwitch
IsOn="{Binding Settings.ShowHistoryExecutedResultsForHomePage}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}" />
</cc:Card>
<cc:Card
Title="{DynamicResource defaultFileManager}"
Margin="0 14 0 0"

View file

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using Flow.Launcher.Plugin;
namespace Flow.Launcher.Storage;
public class ExecutedHistory
{
[JsonInclude]
public List<Result> Items { get; private set; } = new List<Result>();
private int _maxHistory = 300;
public void Add(Result result)
{
Items.Add(result);
}
}