Desktop Entry File

This page refers on how to create desktop icon

A desktop entry file, commonly referred to as a ".desktop" file, is a text-based configuration file used in Linux environments to define how a specific application or program should appear and behave in the desktop environment's application launcher, menus, and related interfaces. These files provide metadata about the application and specify various properties such as the application name, icon, command to run, categories, and more.

Here's what you might find in a typical desktop entry file:

  1. Name: The human-readable name of the application.

  2. Comment: A brief description or comment about the application.

  3. Icon: The path to the icon file that represents the application.

  4. Exec: The command to run when the application is launched.

  5. Terminal: Specifies whether the application should run in a terminal window.

  6. Type: Describes the type of application (e.g., Application, Link, Directory).

  7. Categories: Defines the categories or menus where the application should appear (e.g., Development, Multimedia, System).

  8. MimeType: Lists the MIME types that the application can handle.

  9. StartupNotify: Specifies whether the desktop environment should show a startup notification for the application.

  10. StartupWMClass: Helps the desktop environment associate running instances of the application with the correct desktop entry.

These files are typically stored in the /usr/share/applications directory for system-wide applications and in the ~/.local/share/applications directory for user-specific applications.

Desktop entry files play a crucial role in providing a standardized way to integrate applications into the desktop environment, ensuring that applications are listed correctly in menus, search results, and application launchers. They also help maintain a consistent user experience by providing information like application names, descriptions, and icons.

For instance, when you search for or access an application through your desktop environment's application menu, what you're interacting with is largely influenced by the information stored in these desktop entry files.

I apologize for the confusion. If the ~/.local/share/applications directory doesn't exist on your version of Ubuntu, you can use the system-wide /usr/share/applications directory to create a desktop file. Here's how:

  1. Create a Desktop File:

    Open a terminal and run the following command to create a .desktop file in the system-wide applications directory:

    sudo nano /usr/share/applications/android-studio.desktop
  2. Add Content to the Desktop File:

    Copy and paste the following content into the text editor:

    [Desktop Entry]
    Version=1.0
    Type=Application
    Name=Android Studio
    Exec=/usr/local/android-studio/bin/studio.sh
    Icon=/usr/local/android-studio/bin/studio.png
    Categories=Development;IDE;
    Terminal=false
    StartupWMClass=android-studio

    Make sure to adjust the Icon path if necessary to match the actual path of the Android Studio icon on your system.

  3. Save and Exit:

    After pasting the content, press Ctrl + O to save the file and then press Enter. Then press Ctrl + X to exit the text editor.

  4. Make the Desktop File Executable:

    Run the following command to make the .desktop file executable:

    sudo chmod +x /usr/share/applications/android-studio.desktop

You should now be able to find the Android Studio icon in your application menu under the Development category and use it to launch Android Studio.

Last updated