You are currently viewing [Linux] Create App Shortcut for Application in Linux

[Linux] Create App Shortcut for Application in Linux

🐧 Speedy Access: Creating Custom App Shortcuts in Ubuntu (Linux)

Tired of diving through the application menu every time you want to launch your favorite program? Creating a desktop shortcut (or launcher) in Ubuntu is a simple process that can significantly speed up your workflow. This guide will walk you through how to create these custom shortcuts for any application installed on your system.

Why Use Custom Shortcuts?

Custom shortcuts are incredibly useful for:

  • Quick Launching: Open frequently used apps like VS Code, Pycharm, or custom scripts with a single click.
  • Organization: Group specific launchers on your desktop or add them to custom panels/docks.
  • Customization: Use a different icon or change the application’s launch parameters.

The Core Concept: The .desktop File

In Linux environments like Ubuntu, application shortcuts are defined by a plain text file ending with the extension .desktop. These files are essentially configuration files that tell the system how to launch an application, what icon to use, and where to place it in the menus.

Step 1: Create the .desktop File

  • Open Terminal: Press Ctrl + Alt + T.
  • Create the File: Use a text editor to create a new file on your desktop.
    nano ~/Desktop/MyCustomApp.desktop

Step 2: Edit the .desktop File

Open the .desktop file you placed on your desktop using a text editor (e.g., Gedit, VS Code, or Nano). You will see a file structured with key-value pairs under different sections.

The file will look like this, you will need to change the template content to yours

[Desktop Entry]
Version=1.0
Name=Pycharm <-- **Set the App Name**
Comment=Launch my special app  <-- **Set the App Description**
Exec=/path/to/your/app/executable  ; <-- **CHANGE THIS to the full path**
Icon=/path/to/your/app/icon.png  ; <-- **CHANGE THIS (Optional) or use a system icon name**
Terminal=false
Type=Application
Categories=Development;IDE;  <-- **Set the App Category, for Pycharm we can set Development;IDE;**

Step 3: Make the Launcher Executable

chmod +x ~/Desktop/MyCustomApp.desktop

Step 4: Run the Shortcut!

After setting the permissions, you may see the icon change to the application’s correct graphic.

  1. Double-click the new shortcut on your desktop.
  2. The first time you run it, Ubuntu might display a dialog asking, “Do you trust this application?” Click “Trust and Launch.”

Step 5: Make the Shortcut searchable in search bar

In KDE, to make the shortcut can be search in searchbar, you need to move your shortcut file to shared applications folder

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