Skip to content

[FEATURE] - Pinned Results#4347

Draft
01Dri wants to merge 89 commits intoFlow-Launcher:devfrom
01Dri:feature/pinned-results
Draft

[FEATURE] - Pinned Results#4347
01Dri wants to merge 89 commits intoFlow-Launcher:devfrom
01Dri:feature/pinned-results

Conversation

@01Dri
Copy link
Copy Markdown
Contributor

@01Dri 01Dri commented Mar 12, 2026

Changes

  • New option to add a result or a query to pinned results.

  • Added two visual styles for pinned results:

    • List
    • Grid

Observations

  • Added logic to filter out pinned results when querying after a plugin is uninstalled.
  • Added Keyboard navigation of Ctrl + G when using the Grid style.
  • Pinned Results or queries to the List or Grid.

Preview

example.1.mp4
example.2.mp4

Future

  • Add resources for preview panel in xaml theme file & theme setting page (Need onesounds's help).

@prlabeler prlabeler bot added the enhancement New feature or request label Mar 12, 2026
@01Dri 01Dri closed this Mar 12, 2026
@github-actions github-actions bot added this to the 2.2.0 milestone Mar 12, 2026
@01Dri 01Dri changed the title [FEATURE~[´Ç [FEATURE Mar 12, 2026
@01Dri 01Dri changed the title [FEATURE [FEATURE] - Pinned Results Mar 12, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 12, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a "Pinned Results" feature: new storage and pinned-result model, settings and UI (list/grid), ViewModel and MainWindow wiring for pin/unpin and execution, ResultHelper signature change, PluginManager helper, and a small uninstall-flow change capturing uninstall result.

Changes

Cohort / File(s) Summary
Storage & Model
Flow.Launcher/Storage/Pinned.cs, Flow.Launcher/Storage/PinnedResultItem.cs
New pinned-results storage and item type: max-10 collection, add/upsert/dedup, AddOrRemove/Remove/Exists, equality by result or result+query, DeepCopy, LastPinnedAt/Query/IsQuery, and plugin ico-path refresh via PluginManager.
ViewModel & App logic
Flow.Launcher/ViewModel/MainViewModel.cs, Flow.Launcher/App.xaml.cs
MainViewModel integrated pinned lifecycle, exposed PinnedResults and IsContextMenuVisible, added context-menu pin/unpin actions, persistence and refresh flows; App startup refreshes/shows pinned results at init points.
UI & Presentation
Flow.Launcher/MainWindow.xaml, Flow.Launcher/MainWindow.xaml.cs, Flow.Launcher/Languages/en.xaml
Added Pinned Results UI block (ListBox/UniformGrid) with selection/click handling and ExecutePinnedResult handler; added localization keys for pinned-results UI.
Settings & Preferences
Flow.Launcher.Infrastructure/UserSettings/Settings.cs, Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml, Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs
New settings: EnablePinnedResults, ShouldCleanPinnedResultsFromUninstalledPlugins, PinnedResultsLayout enum/property; UI toggle and layout selector plus PinnedLayoutData/PinnedLayouts.
Result Processing
Flow.Launcher/Helper/ResultHelper.cs
Replaced concrete overload with generic PopulateResultsAsync<T>(T item, string query) where T : Result and updated call sites to pass explicit query.
Plugin subsystem
Flow.Launcher.Core/Plugin/PluginManager.cs, Flow.Launcher.Core/Plugin/PluginInstaller.cs
Added PluginManager.GetAllPluginsIds(); PluginInstaller now captures UninstallPluginAsync result into a boolean and sets Settings.ShouldCleanPinnedResultsFromUninstalledPlugins accordingly (uses boolean early-return pattern).

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as MainWindow UI
    participant VM as MainViewModel
    participant Storage as Pinned Storage
    participant PluginMgr as PluginManager

    User->>UI: Pin item (click / context menu)
    UI->>VM: OnPinnedItemClick / Pin command
    VM->>Storage: Add(result, query)
    Storage->>PluginMgr: Resolve plugin directory / ico path
    PluginMgr-->>Storage: Directory / IDs
    Storage-->>VM: Item added/updated
    VM->>Storage: Persist pinned storage

    UI->>VM: RefreshPinnedResults (startup / query change)
    VM->>Storage: GetPinnedResultItems(query)
    Storage-->>VM: Filtered pinned items
    VM->>UI: Render PinnedResults (List/Grid)

    User->>UI: Click pinned item
    UI->>VM: ExecutePinnedResult(item)
    VM->>VM: result.ExecuteAsync(ActionContext)
    VM->>UI: Hide window if requested
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Suggested reviewers

  • jjw24
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.53% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title '[FEATURE] - Pinned Results' accurately and concisely describes the main feature being added, aligning well with the changeset's core objective.
Description check ✅ Passed The pull request description clearly details the new pinned results feature, including the ability to pin results or queries, two visual styles (List and Grid), plugin uninstallation filtering, and keyboard navigation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

5 issues found across 13 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs">

<violation number="1" location="Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs:151">
P2: PinnedLayouts dropdown is added but its labels are never refreshed in UpdateEnumDropdownLocalizations, so changing language won’t update this dropdown’s localized labels.</violation>
</file>

<file name="Flow.Launcher.Infrastructure/UserSettings/Settings.cs">

<violation number="1" location="Flow.Launcher.Infrastructure/UserSettings/Settings.cs:393">
P2: Public backing auto-property will be serialized separately, creating an unintended extra settings key and bypassing `OnPropertyChanged` when deserialized.</violation>
</file>

<file name="Flow.Launcher/Storage/Pinned.cs">

<violation number="1" location="Flow.Launcher/Storage/Pinned.cs:18">
P2: Evicts the oldest pin before checking for an existing pin, which can drop an unrelated item when re-pinning an already pinned result at max capacity.</violation>

<violation number="2" location="Flow.Launcher/Storage/Pinned.cs:53">
P2: AddOrRemove uses query-aware existence but query-unaware removal, which can remove the wrong pinned item when same result is pinned under multiple queries.</violation>
</file>

<file name="Flow.Launcher/Storage/PinnedResultItem.cs">

<violation number="1" location="Flow.Launcher/Storage/PinnedResultItem.cs:69">
P2: DeepCopy rebuilds OriginQuery from the serialized Query string, which is empty for non-query pinned items, losing the original OriginQuery copied from the underlying Result.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Ensure _lastpos is updated before selecting ListBoxItem and executing MouseSelectCommand in both ResultGrid.xaml.cs and ResultListBox.xaml.cs. Pass true for MouseSelectCommand in ResultGrid and false in ResultListBox for correct context.
@Jack251970
Copy link
Copy Markdown
Member

@01Dri Another issue is that the height of the main window of the empty query will change if we choose to display pinned Grid.

Hi Jack, I don’t think I understand the issue. Could you explain it to me? Thanks!

@01Dri Another issue is that the height of the main window of the empty query will change if we choose to display pinned Grid.

Hi Jack, I don’t think I understand the issue. Could you explain it to me? Thanks!

I polished and made several adjustments to your changes.

无标题

As you can see in this figure, when I enable the grid, the main window has larger height under empty search than that under non-empty search. I think we should adjust the query item number under empty search.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Flow.Launcher/ViewModel/MainViewModel.cs">

<violation number="1" location="Flow.Launcher/ViewModel/MainViewModel.cs:167">
P2: Changing UseGlyphIcons/ShowBadges no longer triggers QueryResults(), but ResultViewModel doesn’t listen to Settings changes for ShowGlyph/ShowBadge. This can leave visible results stale until the next query. Consider re-querying (or otherwise refreshing result view models) when these settings change.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Refactor property change handling in MainViewModel.cs so that changes to ShowBadges and ShowBadgesGlobalOnly now trigger QueryResults(), ensuring UI updates reflect badge settings instantly. Also, separate MaxResultsToShow handling for clarity.
Changed PinnedGridReservedResultCount from int to double for more precise reserved result calculation. Updated MaxHeight logic to use Math.Floor for correct item count. Switched to ResultsSelected method for selection checks. Added comment clarifying pinned grid margin calculation.
Move PinnedGridHeightForEmptyQuery PropertyChanged trigger into the PinnedGridReservedResultCount getter to only notify on actual value changes. Update ResultsViewModel to listen for PinnedGridHeightForEmptyQuery changes, improving efficiency and clarity.
Updated the Border margin in PinnedResultGrid.xaml and aligned the PinnedGridHeightForEmptyQuery calculation in MainViewModel.cs to ensure consistent layout spacing.
Centralize UpdatePreviewAsync calls by triggering them via a PropertyChanged handler for PreviewSelectedItem, reducing code duplication. Adjust selection and index reset logic to ensure correct preview behavior when switching between grid and list modes.
Add null checks before assigning SelectedItem from Results, History, and PinnedResults to PreviewSelectedItem. This ensures PreviewSelectedItem is only updated when a valid item is selected, avoiding unintended null assignments.
@Jack251970 Jack251970 removed the review in progress Indicates that a review is in progress for this PR label Mar 28, 2026
Jack251970
Jack251970 previously approved these changes Mar 28, 2026
@Jack251970
Copy link
Copy Markdown
Member

@01Dri Please help me check and test this feature? I have polished UI and fixed some issues with preview panel.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Flow.Launcher/ViewModel/MainViewModel.cs">

<violation number="1" location="Flow.Launcher/ViewModel/MainViewModel.cs:178">
P1: Preview refresh is wired to `Settings.PropertyChanged` using `nameof(PreviewSelectedItem)`, so the new trigger is effectively unreachable and preview updates can stop after selection changes.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

UpdatePreviewAsync is now called directly in the PreviewSelectedItem setter to ensure immediate updates. Added a debug log for easier troubleshooting.
Jack251970
Jack251970 previously approved these changes Mar 28, 2026
Prevent value from being set to 0 when reserving results for the pinned grid layout by using Math.Max(1, ...). This guarantees at least one result is always reserved, even with low MaxResultsToShow settings.
@01Dri
Copy link
Copy Markdown
Contributor Author

01Dri commented Mar 28, 2026

@Jack251970 I think I found two issues. First, in grid mode, it seems that the history results are appearing too far down in the results list. Additionally, the history results are not being displayed when the home page is disabled, even though "Show history results" is enabled. I will investigate this further.

@01Dri
Copy link
Copy Markdown
Contributor Author

01Dri commented Mar 28, 2026

@Jack251970 I think I found two issues. First, in grid mode, it seems that the history results are appearing too far down in the results list. Additionally, the history results are not being displayed when the home page is disabled, even though "Show history results" is enabled. I will investigate this further.

Regarding the first issue, after comparing it with the current version, it appears to be normal behavior.

About the second issue, I would like to confirm with you: when the home page is disabled and "Show History Results on Home Page" is enabled, should the flow display the history results or not?

@Jack251970
Copy link
Copy Markdown
Member

@Jack251970 I think I found two issues. First, in grid mode, it seems that the history results are appearing too far down in the results list. Additionally, the history results are not being displayed when the home page is disabled, even though "Show history results" is enabled. I will investigate this further.

Regarding the first issue, after comparing it with the current version, it appears to be normal behavior.

About the second issue, I would like to confirm with you: when the home page is disabled and "Show History Results on Home Page" is enabled, should the flow display the history results or not?

I think they should not be displayed.

@Jack251970
Copy link
Copy Markdown
Member

@01Dri Hi, would you remind if I change this PR to draft for onesounds to work on the theme design part?

@01Dri
Copy link
Copy Markdown
Contributor Author

01Dri commented Mar 29, 2026

@01Dri Hi, would you remind if I change this PR to draft for onesounds to work on the theme design part?

Sure, no problem.

@Jack251970 Jack251970 marked this pull request as draft March 29, 2026 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Support for pinning results

4 participants