The first thing is that you have to know the command to run the application. Of many applications, the command is the same as the name of the application, as it appears in Dash, but that is definitely not always the case.
Find the command to run an application
To find the command to run an application, you can look into its desktop file, located in /usr/share/applications; open the file with gedit (drop it over an open gedit window) and look for a line, starting with: Exec=. If you, for example, look into the file: /usr/share/applications/gnome-system-monitor.desktop, you will see that the command to run it is:
gnome-system-monitor
Creating a keyboard shortcut to run the application
Open "System Settings" > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" to add the command you found in the corresponding .desktop file. Click on the right side in the new entry and type the desired key combination.
Automatically generate a list of all applications and their corresponding commands
Just as an extra (I already had the script), you can use a script below to create a list of all installed applications (names), their corresponding .desktop files and the command to run it. The output looks like:
#!/usr/bin/python3
import os
dtfile_list = os.listdir("/usr/share/applications")
for item in dtfile_list:
if item.endswith(".desktop"):
with open("/usr/share/applications/"+item) as commandlist_source:
searchlines = commandlist_source.readlines()
try:
command_data = ([line for line in searchlines if line.startswith("Name=")][0]\
.replace("Name=", "").replace("\n", ""),
[line for line in searchlines if line.startswith("Exec=")][0]\
.replace("Exec=", "").replace("\n", ""))
print(command_data[0]," || ", item, " || ", command_data[1])
except Exception:
pass
In case you'd like to use it: copy the script into an empty file, save it as get_comnmands.py and run it in a terminal window by the command:
To add a custom keyboard board shortcut open System Settings and select Keyboard -> Shortcuts tab -> Custom Shortcuts.
Open any application, for example Eclipse, and check in the System Monitor app to find the name of the command to start that application from the terminal. For example, the command to start Eclipse is eclipse.
Click the + button in the lower left corner of the Shortcuts pane to add a new keyboard shortcut.
A new little Custom Shortcut window will open up. After where it says Name: type Eclipse. After where it says Command: type eclipse with a lowercase e. Click the Apply button to apply the new keyboard shortcut.
Click the Eclipse shortcut that you added to the list of custom shortcuts where it says Disabled, which will make New accelerator... appear after where it says Eclipse instead of Disabled. Press any keyboard shortcut combination to assign it to Eclipse.
In order to undo an existing keyboard shortcut, click the existing keyboard shortcut in the list of shortcuts and undo it using the Backspace key.
The first thing is that you have to know the command to run the application. Of many applications, the command is the same as the name of the application, as it appears in Dash, but that is definitely not always the case.
Find the command to run an application
To find the command to run an application, you can look into its desktop file, located in
/usr/share/applications
; open the file with gedit (drop it over an open gedit window) and look for a line, starting with:Exec=
. If you, for example, look into the file:/usr/share/applications/gnome-system-monitor.desktop
, you will see that the command to run it is:Creating a keyboard shortcut to run the application
Open "System Settings" > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" to add the command you found in the corresponding .desktop file. Click on the right side in the new entry and type the desired key combination.
Automatically generate a list of all applications and their corresponding commands
Just as an extra (I already had the script), you can use a script below to create a list of all installed applications (names), their corresponding .desktop files and the command to run it. The output looks like:
etc.
The script:
In case you'd like to use it: copy the script into an empty file, save it as
get_comnmands.py
and run it in a terminal window by the command:Go to System Settings → Keboard, select Shortcuts tab and add a new custom shortcut for this operation.
To add a custom keyboard board shortcut open System Settings and select Keyboard -> Shortcuts tab -> Custom Shortcuts.
Open any application, for example Eclipse, and check in the System Monitor app to find the name of the command to start that application from the terminal. For example, the command to start Eclipse is
eclipse
.Click the + button in the lower left corner of the Shortcuts pane to add a new keyboard shortcut.
A new little Custom Shortcut window will open up. After where it says Name: type
Eclipse
. After where it says Command: typeeclipse
with a lowercase e. Click the Apply button to apply the new keyboard shortcut.Click the Eclipse shortcut that you added to the list of custom shortcuts where it says Disabled, which will make New accelerator... appear after where it says Eclipse instead of Disabled. Press any keyboard shortcut combination to assign it to Eclipse.
In order to undo an existing keyboard shortcut, click the existing keyboard shortcut in the list of shortcuts and undo it using the Backspace key.