The python script below reads the (English or international*) interface names from all desktop files in /usr/share/applications
, as well as their Categories
-section. It lists all found applications, according to their categories. Since many applications do have multiple categories, applications can appear in more than one category.
If the application has no Categories=
mention, it is mentioned in the Uncategorized
-section down in the list.
*Note Some applications (like Thunderbird) have an extensive list of interface names, for each and every language. This script, as it is, reads the first interface name, which is the internationally used one. The script can be altered to read the name in a specific language (if present), or automatically read the system's language, but that would need a bit more extensive coding :)
To use it:
Copy the script below, past it into an empty file, save it as applist.py
. run it by the command (in a terminal window):
python3 /path/to/script/applist.py
The script:
#!/usr/bin/env python3
import os
uncategorized = []
categories = []
data = []
for item in os.listdir("/usr/share/applications"):
if item.endswith(".desktop"):
with open("/usr/share/applications/"+item) as data_source:
lines = data_source.readlines()
interface_name = [l.replace("\n", "").replace("Name=", "") \
for l in lines if l.startswith("Name=")][0]
if len([l for l in lines if l.startswith("Categories")]) == 0:
uncategorized.append(interface_name)
else:
subcats = [item for item in [l.replace("\n", "").replace(
"Categories=", "") for l in lines if l.startswith(
"Categories=")][0].split(";") if item != ""]
data.append([interface_name, subcats])
categories = categories + subcats
categories = sorted([item for item in set(categories)])
for item in categories:
applications = [subdata[0] for subdata in data if item in subdata[1]]
print(item)
for app in applications:
print(" "+app)
print("Uncategorized")
for item in uncategorized:
print(" "+item)
To give an impression of the output:
A small section of my output:
Audio
Audacity
MuseScore
PulseAudio Volume Control
Rhythmbox
AudioVideo
Cheese
VLC media player
Audacity
Rhythmbox
MuseScore
Videos
OpenShot Video Editor
Brasero
PulseAudio Volume Control
Rhythmbox
AudioVideoEditing
Audacity
MuseScore
OpenShot Video Editor
BoardGame
Mahjongg
Calculator
Calculator
for f in /usr/share/applications/*.desktop; do echo -n $f|sed -e 's!/usr/share/applications/!!g;s/.desktop/::/g';echo $(cat $f |grep -i categories|sed -e 's/Categories=//g;s/\;/ /g'); done
I would suggest you have a look at the code of the GUI app/launcher you use.