diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index dc2133118..1ecdb23c3 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -1798,6 +1798,7 @@ export class AppSearchProvider { this.id = 'applications'; this.isRemoteProvider = false; this.canLaunchSearch = false; + this.maxResults = 6; this._systemActions = new SystemActions.getDefault(); diff --git a/js/ui/search.js b/js/ui/search.js index b938b0327..071f6332b 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -472,6 +472,8 @@ class GridSearchResults extends SearchResultsBase { child: this._grid, x_align: Clutter.ActorAlign.CENTER, })); + + this._maxResults = provider.maxResults ?? -1; } _onDestroy() { @@ -510,11 +512,18 @@ class GridSearchResults extends SearchResultsBase { } _getMaxDisplayedResults() { - let width = this.allocation.get_width(); + const width = this.allocation.get_width(); if (width === 0) - return -1; + return this._maxResults; - return this._grid.layout_manager.columnsForWidth(width); + const nCols = this._grid.layout_manager.columnsForWidth(width); + if (nCols < 0) + return this._maxResults; + + if (this._maxResults < 0) + return nCols; + + return Math.min(nCols, this._maxResults); } _clearResultDisplay() {