Tutorial: List your Desktop/Home Screen Applications

A while back, Kyle shared his cron job for creating an automated daily backup list of all installed packages and libraries:

I thought it might also be helpful to be able to list only the desktop/home screen apps, so I created this small utility. It lists applications in the grid, along with various related sub-settings and utilities. Here’s how I did it:

1 - Save the following text in .local/share/applications (within the home folder), and name it AppList.desktop:

[Desktop Entry]
Exec=gnome-terminal -x bash -c "ls /usr/share/applications | awk -F '\\.desktop' ' { print $1}' - | tee applist.txt; exec bash"

Note that applications created by the user (like this one) are stored in a different directory. If you want to include those in the output list, modify the Exec line to this:
Exec=gnome-terminal -x bash -c "(ls /usr/share/applications && ls /home/purism/.local/share/applications) | awk -F '\\.desktop' ' { print $1}' - | tee applist.txt; exec bash"

2 - Find, or create, an appropriate icon for the launcher, and save it as AppList.png within .local/share/icons. I drew this one with the Drawing application:

The launcher will then appear in your app grid; top row, far right here:

Tapping the icon will open the list in the terminal:

…and also output the list to a text file in your home folder. (It will overwrite itself every time you launch the app):

(And I have no idea why org.freedesktop.IBus.Panel.Emojier.desktop, org.freedesktop.IBus.Panel.Extension.Gtk3.desktop, org.freedesktop.IBus.Setup.desktop got truncated to org.fre, org.fre, org.fre. They’re not truncated in the terminal display.)

By comparison, using Kyle’s package backup prints a much longer list for my L5 (1,610 lines vs. 118), and includes every individual library and snippet:


The argument to awk -F is a regular expression, and the dot (.) in a regular
expression means “match any single character”. So, that means that
org.freedesktop.IBus.Panel.Extension.Gtk3.desktop gets split like so:

   awk sees: org.freedesktop.IBus.Panel.Extension.Gtk3.desktop
   and splits it into:    
    $1 = 'org.fre'
    ('edesktop' matches '.desktop')
    $2 = '.IBus.Panel.Extensions.Gtk3.desktop'

In the ‘Exec’ line of AppList.desktop, try updating like so–
change: awk -F '.desktop' ...
to: awk -F '\\.desktop' ...

(The double-backslash before the dot escapes the dot so it matches only the literal dot character, instead of any character. Caveat: I tested this on my command line and it worked. You might have to fiddle around with the number of slashes when it is inside the .desktop file.)


PS – Nice hack to only list the desktop apps… :slightly_smiling_face:


Beautiful! Works like a charm. And it makes sense, since only the .txt file was affected, not the list in the terminal window.
I’ve altered the OP.


Why do they still call it “desktop applications”?

Wouldn’t it be better to call a “phone face”?

That would go over well in the U.K. they could market it as “phoney McPhone face”!

Well, they have a tendency to call it a “mobile”, so how about a “mobile mug” ?

True, “desktop” is something of a misnomer in this case. I made a couple of modifications to the thread.

Ah but convergence. :wink:

Also, the files are presumably going to continue to be called .desktop files regardless.

1 Like

It was just wordplay on my part, no worries.