From 852a0a89ac536b7937c9013166216531cd45b6d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 7 Feb 2025 15:54:15 +0100 Subject: [PATCH] appDisplay: Filter apps in default folder We currently create the default folder with the corresponding app list, regardless of whether the apps are actually part of the default install or not. This matters when a user explicitly install such an app later, as it will be hidden away in the folder rather than appended to the app grid as expected. To avoid that, only add currently-installed apps to the folder when creating it. Part-of: --- js/ui/appDisplay.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 9801b7134..b08d9af5d 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -1418,12 +1418,16 @@ class AppDisplay extends BaseAppView { if (this._folderSettings.get_strv('folder-children').length > 0) return; + const appSys = Shell.AppSystem.get_default(); const folders = Object.keys(DEFAULT_FOLDERS); this._folderSettings.set_strv('folder-children', folders); const {path} = this._folderSettings; for (const folder of folders) { const {name, categories, apps} = DEFAULT_FOLDERS[folder]; + const filteredApps = apps + ? apps.filter(id => appSys.lookup_app(id) != null) + : []; const child = new Gio.Settings({ schema_id: 'org.gnome.desktop.app-folders.folder', path: `${path}folders/${folder}/`, @@ -1432,8 +1436,8 @@ class AppDisplay extends BaseAppView { child.set_boolean('translate', true); if (categories) child.set_strv('categories', categories); - if (apps) - child.set_strv('apps', apps); + if (filteredApps.length > 0) + child.set_strv('apps', filteredApps); } }