How are options for Default Applications gathered?

Hi all,

I have a question that I hope is quite simple to answer: How does KDE get the list of applications it offers me in the “System Settings” / “Default Applications”?

I want to write an app that detects what browsers are available, and I don’t want to reinvent the wheel, if at all possible - as I’ll do so poorly.

Point me to the code that scans for .desktop files in various paths and filters by “Categories contains WebBrowser”, please :slight_smile:

The settings UI is in plasma-desktop/componentchooser: kcms/componentchooser · master · Plasma / Plasma Desktop · GitLab

It uses KSharedConfig to open ~/.mimeapps.list, KService to manage .desktop files, and KApplicationTrader to manage the mimetypes themselves.

It’s actually a great showcase of how KDE Frameworks libraries make the lives of C++ developers easier.

1 Like