Skip to content
Advertisement

How can I put my GTK application in the desktop menus?

I started with programming a little time ago and I created my first running application with GTK 3.0. I did not use Glade, I do not know if worth highlight it. My code is working perfectly, but now I have a doubt, how can I make my own desktop menu application? I mean, I want that my application running up without compile in a terminal with GTK 3.0 compiler, but yes with a double click.

I have been seen these examples provided by GNOME Developer Center, but I confess that did not understand it: https://developer.gnome.org/integration-guide/stable/desktop-files.html.en#ex-sample-desktop-file

The idea is to create a file containing this sequence of lines:

[Desktop Entry]

Type=Application

Encoding=UTF-8

Name=Sample Application Name

Comment=A sample application

Exec=application

Icon=application.png

Terminal=false

This file is my executable or it is a different file which points to my executable? If it is my executable, where can I insert it?

Thank you!

Advertisement

Answer

So basically this file will create a desktop entry for those configurations you provide for the corresponding directives in the file. Judging by your question, you are unable to find where to place your application executable in that directive.

Exec="/absolute/path/to/your/executable/file"

And the Name directive will hold the information of your application name. This is the one you will be querying for in your gnome applications search (which appears when you press the windows key).

This file will contain a .desktop extension. And this file itself is not executable. This will point to your application, making the gnome/ubuntu system understand that such application exists.

This will not directly create a desktop shortcut as in Windows, rather this will index your application which you can run from the application menu (ubuntu or gnome)

If you aren’t sure where to place the file here’s a hint from the documentation you linked.

Place this file in the /usr/share/applications directory so that it is accessible by everyone, or in ~/.local/share/applications if you only wish to make it accessible to a single user

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement