An slightly edited version of this script allows multiple selection of applications at once:

The script
#!/usr/bin/env python3
import subprocess
import os
dr = "/usr/share/applications"
apps = []
for f in [f for f in os.listdir(dr) if f.endswith(".desktop")]:
try:
content = open(dr+"/"+f).read()
if not "NoDisplay=true" in content:
lines = content.splitlines()
name = [l for l in lines if l.startswith("Name=")][0].replace("Name=", "")
command = [l for l in lines if l.startswith("Exec=")][0].replace("Exec=", "")
comment = [l for l in lines if l.startswith("Comment=")]
comment = comment[0].replace("Comment=", "") if comment else "No description"
apps.append([name, command, comment])
except:
pass
apps.sort(key=lambda x: x[0]); apps = sum(apps, [])
displ_list = '"'+'" "'.join(apps)+'"'
try:
chosen = subprocess.check_output([
"/bin/bash",
"-c",
'zenity --list '+\
'--multiple '+\
'--column="Applications" '+\
'--column="commands" '+\
'--column="Description" '+\
'--hide-column=2 --height 450 '+\
'--width 500 '+\
'--print-column=2 '+displ_list
]).decode("utf-8").split("|")
for item in chosen:
item = item.strip()
item = item[:item.rfind(" ")] if "%" in item else item
subprocess.Popen([
"/bin/bash", "-c", item
])
except subprocess.CalledProcessError:
pass
To use
- Copy the script below into an empty file, save it as
list_apps.py
Test- run it by the command (open a terminal window, type the command and press Return):
python3 /path/to/list_apps.py
If all works fine, add it to a shortcut key: choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:
python3 /pat/to/list_apps.py
to a shortcut key combination you like.
Explanation
The script lists all .desktop
files in /usr/share/applications
, and checks if the line NoDisplay=true
is in the file (which means it is not meant to be used as a GUI). Then it looks into the files, looks up the application name and the command to run it.
The difference with the linked answer is mainly the fact that the zenity window is set to allow multiple selections.