mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
CmdPal: Filtering out pinned apps on search (#40785)
Closes #40781 Filters out TopLevelCommands whose Id matches an app coming from the `AllAppsCommandProvider.Page.GetItems()`. Hate adding processing there, but without adding some type of `bool HideMeOnSearch` to something low enough (like ICommandItem), I don't see another way to distinguish these.
This commit is contained in:
@@ -164,6 +164,11 @@ public partial class MainListPage : DynamicListPage,
|
||||
if (_includeApps)
|
||||
{
|
||||
IEnumerable<IListItem> apps = AllAppsCommandProvider.Page.GetItems();
|
||||
var appIds = apps.Select(app => app.Command.Id).ToArray();
|
||||
|
||||
// Remove any top level pinned apps and use the apps from AllAppsCommandProvider.Page.GetItems()
|
||||
// since they contain details.
|
||||
_filteredItems = _filteredItems.Where(item => item.Command is not AppCommand);
|
||||
_filteredItems = _filteredItems.Concat(apps);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,9 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using ManagedCommon;
|
||||
using Microsoft.CmdPal.Ext.Apps.Programs;
|
||||
using Microsoft.CmdPal.Ext.Apps.Properties;
|
||||
using Microsoft.CmdPal.Ext.Apps.Utils;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
using Windows.Services.Maps;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.System.Com;
|
||||
using Windows.Win32.UI.Shell;
|
||||
@@ -18,11 +16,11 @@ using WyHash;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.Apps;
|
||||
|
||||
internal sealed partial class AppCommand : InvokableCommand
|
||||
public sealed partial class AppCommand : InvokableCommand
|
||||
{
|
||||
private readonly AppItem _app;
|
||||
|
||||
internal AppCommand(AppItem app)
|
||||
public AppCommand(AppItem app)
|
||||
{
|
||||
_app = app;
|
||||
|
||||
|
||||
@@ -3,13 +3,11 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.CmdPal.Ext.Apps.Programs;
|
||||
using Microsoft.CommandPalette.Extensions;
|
||||
using Microsoft.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.Apps;
|
||||
|
||||
internal sealed class AppItem
|
||||
public sealed class AppItem
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user