To create a launcher in Ubuntu

Add the execution of a command or an application in the drawer

To create a launcher for custom most have multiple utility. Maybe we can run an application that is not provided for the launch icon in the drawer, or we may wish to run a terminal command, just as if it were an application.

Create the executor

An executor, or launcher, is a text file that contains instructions that describe it, such as the name, version, type, command and icon. To create one, simply open the terminal and use the following command

nano nome.desktop

going to use the name descriptive of the application or action that we have to perform. This will open a text editor where we need to insert these lines (unfortunately, manually written)

[Desktop Entry]
Version=1.00 (non obbligatorio)
Name=nome applicazione
Type=Application
Exec=comando da eseguire
Icon=posizione icona (non obbligatorio)

paying attention to go to replace the values of each single attribute as a Name and Exec. To specify that Exec coincides with the command that we use from the terminal to perform the operation, or launch the program concerned. The Type attribute you need to leave it a single Application, while the Version and the Icon is not necessary to address them.

After you have completed the editing of the text file to use in succession the combination of the characters Ctrl+x, then s, then Enter. We do not close the terminal, we’re not done yet.

Will be created on the location /home to a new text file called with the name.desktop and containing what we have written.

Validate the performer

Before make a copy of it in the system folder, is to put it in the drawer, it is necessary to perform a validation of the file using always from the terminal the command

desktop-file-validate nome.desktop

We will not receive any message, but otherwise we are obliged to correct any errors in our file name.desktop to be able to continue.

Install the performer

After you run the validation of the launcher we can continue on with the installation to be able to view it in the drawer. Called in a concrete way, the operation will copy the file .desktop in system location /usr/share/applications.

Always using the terminal, use the command

sudo desktop-file-install nome.desktop

This command allows us to copy the file name.desktop from the folder /home folder /usr/share/applications.

It will not serve to restart the computer to note the presence of a new icon in our drawer that will have the name that we specified in the Name attribute of the file .desktop. We just have to open it like any other application.

Delete the executor

To delete the launcher there, just go with the permissions of administrator on the folder /usr/share/applications and delete it.

References

We periodically check the functioning of the links in our articles. If you notice any links that do not work, please let us know in the comments. If you enjoyed the article consider supporting the blog with a small donation. Thank you. Patreon / Ko-fi / Liberapay / Paypal

Leave a Reply

Your email address will not be published. Required fields are marked *