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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3632>
This commit is contained in:
Florian Müllner 2025-02-07 15:54:15 +01:00 committed by Marge Bot
parent 38c6293f4f
commit 852a0a89ac

View File

@ -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);
}
}