Skip to content

Commit

Permalink
Apply app icons only to app items
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverschwendener committed Nov 29, 2018
1 parent 3768f51 commit a412823
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/ts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,20 @@ ipcMain.on(IpcChannels.getSearch, (event: Electron.Event, userInput: string): vo
if (config.useNativeIcons) {
const result = inputValidationService.getSearchResult(userInput);
const iconService = new AppIconService(appIconStore);
const promises = result.map((r) => iconService.getProgramIcon(config.iconSet, r));
const promises = result
.filter((r) => r.icon === config.iconSet.appIcon)
.map((r) => iconService.getProgramIcon(config.iconSet, r));

Promise.all(promises).then((resultsWithIcon: SearchResultItem[]) => {
for (const resultWithIcon of resultsWithIcon) {
const resultItem = result.find((r) => r.executionArgument === resultWithIcon.executionArgument && r.icon === config.iconSet.appIcon);
if (resultItem !== undefined) {
resultItem.icon = resultWithIcon.icon;
}
}

Promise.all(promises).then((searchResults: SearchResultItem[]) => {
updateWindowSize(result.length);
event.sender.send(IpcChannels.getSearchResponse, searchResults);
event.sender.send(IpcChannels.getSearchResponse, result);
});
} else {
const result = inputValidationService.getSearchResult(userInput);
Expand Down

0 comments on commit a412823

Please sign in to comment.