Software & AppsOperating SystemLinux

How To Add a Custom Launcher in Unity

Ubuntu 13

In this guide, we will delve into the process of adding a custom launcher in Unity, the default user interface for Ubuntu. The Unity launcher is a key part of the Ubuntu experience, as it allows users to quickly launch and switch between applications. However, there may be times when you want to add a custom launcher for a specific script, command, or application. Here’s how you can do it.

Quick Answer

To add a custom launcher in Unity, you have several options. You can use GUI tools like MenuLibre or Alacarte, manually create a .desktop file, or customize an existing desktop icon. Each method has its own advantages, allowing you to easily customize the Unity launcher to your liking.

Method 1: Using GUI Tools (MenuLibre or Alacarte)

One of the easiest ways to add a custom launcher in Unity is by using a GUI tool like MenuLibre or Alacarte. These tools provide a user-friendly interface for creating and managing launchers.

Installing MenuLibre or Alacarte

To install MenuLibre, open the terminal and run the following command:

sudo apt install menulibre

To install Alacarte, use this command instead:

sudo apt install alacarte

In these commands, sudo is used to execute the command with root privileges, apt is the package handling utility in Ubuntu, and install is the command to install a new package.

Creating a New Launcher

After installing either of these tools, you can open them from the Unity Dash. To create a new launcher, click on the “New Item” button, and fill in the necessary details such as the name of the application, the command to execute, and the icon to display.

Once you’ve filled in these details, click on the “OK” button to create the launcher. The new launcher should now appear in your Unity launcher panel.

Method 2: Manually Creating a .desktop File

If you prefer a more hands-on approach, you can manually create a .desktop file to add a custom launcher in Unity. This method involves creating a text file with specific parameters that define the launcher’s properties.

Creating the .desktop File

Open a text editor and create a new file with the following content:

[Desktop Entry]
Type=Application
Name=<Name of your app>
Exec=<Full path to your executable>
Icon=<Full path to your app's icon>
Terminal=false
StartupNotify=true

In this file, Type specifies the type of the launcher, which is an application in this case. Name is the name of the application as it will appear in the launcher. Exec is the command that will be executed when the launcher is clicked. Icon is the path to the icon that will be displayed for the launcher. Terminal specifies whether the application should run in a terminal window. StartupNotify enables a visual feedback when the application is launched.

Save this file with a .desktop extension, for example, myapp.desktop.

Moving the .desktop File

After creating the .desktop file, you need to move it to the ~/.local/share/applications/ directory. You can do this with the following command:

mv myapp.desktop ~/.local/share/applications/

In this command, mv is the command to move a file, myapp.desktop is the source file, and ~/.local/share/applications/ is the destination directory.

Once the file is in the correct directory, the new launcher should appear in your Unity launcher panel.

Method 3: Dragging an Existing Icon to the Desktop

Another way to add a custom launcher in Unity is by dragging an existing application icon to the desktop, and then customizing it to execute your desired script or program.

Creating the Desktop Icon

To create a desktop icon, simply find the application icon in the Unity Dash, and drag it to the desktop.

Customizing the Desktop Icon

To customize the desktop icon, right-click on it and select “Properties”. In the “Command” field, enter the command to execute your script or program. Click on the “Close” button to save the changes.

To add the customized icon to the Unity launcher, double-click on it to launch the application. Then, right-click on the launcher icon and select “Lock to Launcher”. The icon should now be permanently added to the Unity launcher.

Conclusion

Adding a custom launcher in Unity can be done in several ways, each with its own advantages. Whether you prefer using a GUI tool, manually creating a .desktop file, or customizing an existing desktop icon, you now have the knowledge to customize the Unity launcher to your liking. Happy customizing!

Can I add a custom launcher for any application or command?

Yes, you can add a custom launcher for any application or command by following the methods mentioned in this guide.

Can I change the icon of a custom launcher?

Yes, you can change the icon of a custom launcher. In Method 1, you can select the desired icon while creating the launcher. In Method 2, you can specify the path to the icon in the .desktop file. And in Method 3, you can customize the icon by right-clicking on it and selecting "Properties".

Can I remove a custom launcher from the Unity launcher panel?

Yes, you can remove a custom launcher from the Unity launcher panel. In Method 1, you can use the GUI tool (MenuLibre or Alacarte) to delete the launcher. In Method 2, you can navigate to the ~/.local/share/applications/ directory and delete the .desktop file. And in Method 3, you can right-click on the launcher icon in the Unity launcher and select "Unlock from Launcher".

Will the custom launcher be available for all users on the system?

By default, the custom launcher will be available only for the user who created it. If you want the launcher to be available for all users, you can move the .desktop file to the /usr/share/applications/ directory instead of ~/.local/share/applications/.

Can I customize the behavior of a custom launcher, such as running it in a terminal window?

Yes, you can customize the behavior of a custom launcher. In Method 1, you can specify the desired options while creating the launcher. In Method 2, you can modify the .desktop file and change the values of parameters like Terminal to suit your needs. And in Method 3, you can right-click on the launcher icon, select "Properties", and modify the command to include any desired options.

Leave a Comment

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