Skip to content

Sort appchooser list #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2025
Merged

Sort appchooser list #17

merged 1 commit into from
Jun 9, 2025

Conversation

ChrisLauinger77
Copy link
Owner

No description provided.

@ChrisLauinger77 ChrisLauinger77 requested a review from Copilot June 9, 2025 06:48
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the AppChooser by filtering out hidden apps and sorting the remaining entries alphabetically.

  • Filters the full list of apps to include only those that should be shown
  • Sorts apps by their display name (case-insensitive)
  • Updates the rendering loop to use the filtered & sorted list
Comments suppressed due to low confidence (1)

[email protected]/prefs.js:50

  • The check app.should_show() is redundant here since apps have already been filtered. You can remove this line to simplify the loop.
if (app.should_show() === false) continue;

Comment on lines +41 to +47
let apps = Gio.AppInfo.get_all();
apps = apps.filter((app) => app.should_show());
apps.sort((a, b) => {
const nameA = a.get_display_name().toLowerCase();
const nameB = b.get_display_name().toLowerCase();
return nameA.localeCompare(nameB);
});
Copy link
Preview

Copilot AI Jun 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider chaining the filter and sort calls directly on the result of get_all(), e.g. const apps = Gio.AppInfo.get_all().filter(...).sort(...); to avoid reassignment and improve readability.

Suggested change
let apps = Gio.AppInfo.get_all();
apps = apps.filter((app) => app.should_show());
apps.sort((a, b) => {
const nameA = a.get_display_name().toLowerCase();
const nameB = b.get_display_name().toLowerCase();
return nameA.localeCompare(nameB);
});
const apps = Gio.AppInfo.get_all()
.filter((app) => app.should_show())
.sort((a, b) => {
const nameA = a.get_display_name().toLowerCase();
const nameB = b.get_display_name().toLowerCase();
return nameA.localeCompare(nameB);
});

Copilot uses AI. Check for mistakes.

@ChrisLauinger77 ChrisLauinger77 merged commit ba3467a into main Jun 9, 2025
2 checks passed
@ChrisLauinger77 ChrisLauinger77 deleted the dev branch June 9, 2025 06:50
ChrisLauinger77 added a commit that referenced this pull request Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant