Add pinned launcher items
This commit is contained in:
@@ -100,7 +100,7 @@ public partial class LauncherPopup : Window
|
||||
}
|
||||
|
||||
bool expandMenusByDefault = config.Items.Count <= 2;
|
||||
foreach (LauncherItem item in config.Items)
|
||||
foreach (LauncherItem item in GetDisplayItems(config.Items))
|
||||
{
|
||||
ItemsPanel.Children.Add(CreateItemControl(item, 0, expandMenusByDefault));
|
||||
}
|
||||
@@ -137,7 +137,7 @@ public partial class LauncherPopup : Window
|
||||
};
|
||||
|
||||
StackPanel children = new();
|
||||
foreach (LauncherItem child in item.Children)
|
||||
foreach (LauncherItem child in GetDisplayItems(item.Children))
|
||||
{
|
||||
children.Children.Add(CreateItemControl(child, depth + 1, expandMenusByDefault, allowEdit));
|
||||
}
|
||||
@@ -231,6 +231,11 @@ public partial class LauncherPopup : Window
|
||||
return item.Type != LauncherItemType.Menu && !string.IsNullOrWhiteSpace(item.Target);
|
||||
}
|
||||
|
||||
private static IEnumerable<LauncherItem> GetDisplayItems(IEnumerable<LauncherItem> items)
|
||||
{
|
||||
return items.OrderByDescending(item => item.IsFavorite);
|
||||
}
|
||||
|
||||
private void SearchBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
string query = SearchBox.Text.Trim();
|
||||
@@ -273,7 +278,7 @@ public partial class LauncherPopup : Window
|
||||
|
||||
private static void CollectMatches(IEnumerable<LauncherItem> items, string query, List<LauncherItem> matches)
|
||||
{
|
||||
foreach (LauncherItem item in items)
|
||||
foreach (LauncherItem item in GetDisplayItems(items))
|
||||
{
|
||||
bool isLaunchable = item.Type != LauncherItemType.Menu;
|
||||
if (isLaunchable && Matches(item, query))
|
||||
|
||||
Reference in New Issue
Block a user