Users startÂ programs on Linux with “launchers”. These files contain specific instructions for how the Linux operating system should run the program and how the icon should look, among other things. On Linux, if you want to create application menu shortcuts, you’ll find that it’s a bitÂ more difficult, compared to Mac or Windows, as users can’t just right-click on a program and select the “create shortcut” option. Instead, if you’d like to create application menu shortcuts on the Linux desktop, it’s an involved process that takes a bit of know-how.
Application Menu Shortcuts – Terminal
Perhaps the quickest way to create application menu shortcuts on the Linux desktop is to create one in the terminal. Going the terminal route is less user-friendly, as there’ isn’t a nice GUI editor to assign app categories, and no icon chooser, etc.
The first step to creating a new application shortcut in Linux is to create an empty Desktop file. In the terminal, use the touch command to create a new shortcut.
touch ~/Desktop/example.desktop chmod +x ~/Desktop/example.desktop
The new shortcut icon is on the desktop, but it has no program instructions. Let’s fix this by editing the new file in the Nano text editor.
The first line for any application shortcut is “Name”. This line will give the application shortcut its name in the menus. In Nano text editor, give your shortcut a name.
‘); if (navigator.appVersion.indexOf(“Mac”)!=-1) document.write(”);
Following “Name,” the next line in the shortcut to add is “Comment.” This line is optional but very useful as it allows the menu to display some information about the shortcut.
Comment=This is an example launcher
With “Name” and “Comment” out of the way, we can get to the real meat of the launcher. In the Nano text editor, add the “Exec” line.
The “Exec” line tells your Linux OS where the program is, and how it should start.
Exec is very versatile and can launch Python, Bash, and just about anything else you can think of. For example, to run a shell or bash script via the shortcut, do:
Exec= sh /path/to/sh/script.sh
Alternatively, set your app shortcut to run a Python program with:
Once the “Exec” line is set to your liking, add the “Type” line.
Need to set your custom shortcut up with an icon? Use the “Icon” line.
Now that Name, Comment, Exec, and Icon are set, it’s safe to save the custom shortcut. Using the Ctrl + O keyboard combination, save the app shortcut. Then, exit Nano with Ctrl + X.
Install your custom app shortcut system-wide with:
sudo mv ~/Desktop/example.desktop /usr/share/applications
Application Menu Shortcuts – Alacarte
There are many menu editors on Linux. For the most part, they all work similarly and do the same thing. For best results, we recommend using the Alacarte app. It’s easy to use, works on everything and can be installed on even the most obscure Linux distributions (due to it’s relationship to the Gnome project).
Alacarte may already be installed on your Linux PC. Check and see by pressing Alt + F2, typing “alacarte” and clicking enter. If the app launches, you’ve already got it installed. If nothing happens, you’ll need to install it. Follow the instructions below to get it working.
sudo apt install alacarte
sudo apt-get install alacarte
sudo pacman -S alacarte
sudo dnf install alacarte -y
sudo zypper install alacarte
Not able to find the Alacarte menu editor app on your Linux distribution? Visit the souce code site and build it yourself!
Making shortcuts with the Alacarte menu editor is refreshingly simple. To start off, click on a category. In this example, we’ll make a new shortcut in the “Internet” category.
In the “Internet” category, click the “New Item” button. Selecting the “New Item” option will open up “Launcher Properties”.
In the “Launcher Properties” windows, there are a few things to fill out. The first thing to fill out is “Name”. Write in the name of the launcher in the “Name” section. Then, move on to “Command.”
The “Command” section is where the user specifies what the shortcut will do. Click the “browse” button to search for a shell script, binary, python app, etc and load it in. Alternatively, write in a command, like one of the following:
When the launcher’s “Command” section is set, write a comment in the “Comment” section and then select “OK” to finish. After clicking the “OK” button, Alacarte will instantly save and enable your new app shortcut on the Linux desktop!