Creating a Custom Application Launcher in Ubuntu 22

How to Create a Desktop Shortcut (For a terminal command)

Note that the following instructions are for a terminal command. Skip ahead if you want instructions for an AppImage executable. To create a desktop shortcut in Ubuntu 22, first open a terminal window and follow these steps.

Navigate to your Desktop directory:

cd ~/Desktop

Create a new desktop file using the text editor of your choice, for example gedit.

gedit my_program.desktop

In the text editor, add the following lines:

[Desktop Entry]
Name=My Program
Exec=gnome-terminal --command=/path/to/my/program
Icon=/path/to/my/icon.png
Terminal=false
Type=Application
Encoding=UTF-8
Category=Utility;

Replace My Program with the name of your program and /path/to/my/program with the actual path to the program you want to run. Note that you can't just type in programs in your system path - it has to be a full path to the program. If you have an icon file, replace /path/to/my/icon.png with the path to the icon file. If you don't have an icon file, you can leave that line out.

Save the file and exit the text editor. Make the file executable by running chmod +x my_program.desktop

Finally, right click the the newly created desktop icon and select "Allow Launching". After you do that you can double click the icon and your program will run.

How to Add the Shortcut to the Side Launcher

After creating the desktop shortcut, you won't be able to drag and drop the shortcut into the launcher on the left. Before you can do that you'll need to copy the desktop shortcut into your user's application folder ~/.local/share/applications/. You can do that with this terminal command.

cp ~/Desktop/my_program.desktop ~/.local/share/applications/my_program.desktop

After doing that, you should be able to click the applications link in the bottom left of your screen and see the new program in the list. From there, you can drag and drop the shortcut in the launcher in the sidebar.

How to Create a Desktop Shortcut (For an AppImage)

To start a shortcut to an AppImage, you can follow the steps above but use the configuration below in your .desktop file. Note that the Encoding, Category, and trailing semicolon are important, otherwise your application might not launch correctly. Also note that the terminal is set to false. Thanks to Heyan Maurya for the guidance here.

[Desktop Entry]
Name=Obsidian
Exec=/home/user/Obsidian-1.3.5.AppImage
Icon=/home/user/obsidian.png
Type=Application
Terminal=false
Encoding=UTF-8
Category=Utility;