mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #2062 from VictoriousRaptor/FilterStartMenuPrograms
Prioritize shortcut in start menu
This commit is contained in:
commit
2a1d9de6df
1 changed files with 8 additions and 1 deletions
|
|
@ -608,13 +608,20 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
||||||
|
|
||||||
private static IEnumerable<Win32> ProgramsHasher(IEnumerable<Win32> programs)
|
private static IEnumerable<Win32> ProgramsHasher(IEnumerable<Win32> programs)
|
||||||
{
|
{
|
||||||
|
var startMenuPaths = GetStartMenuPaths();
|
||||||
return programs.GroupBy(p => p.ExecutablePath.ToLowerInvariant())
|
return programs.GroupBy(p => p.ExecutablePath.ToLowerInvariant())
|
||||||
.AsParallel()
|
.AsParallel()
|
||||||
.SelectMany(g =>
|
.SelectMany(g =>
|
||||||
{
|
{
|
||||||
|
// is shortcut and in start menu
|
||||||
|
var startMenu = g.Where(g => g.LnkResolvedPath != null && startMenuPaths.Any(x => FilesFolders.PathContains(x, g.FullPath))).ToList();
|
||||||
|
if (startMenu.Any())
|
||||||
|
return startMenu.Take(1);
|
||||||
|
|
||||||
|
// distinct by description
|
||||||
var temp = g.Where(g => !string.IsNullOrEmpty(g.Description)).ToList();
|
var temp = g.Where(g => !string.IsNullOrEmpty(g.Description)).ToList();
|
||||||
if (temp.Any())
|
if (temp.Any())
|
||||||
return DistinctBy(temp, x => x.Description);
|
return temp.Take(1);
|
||||||
return g.Take(1);
|
return g.Take(1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue