我怎样才能把我的GTK应用程序放在桌面菜单中? [英] How can I put my GTK application in the desktop menus?

查看:150
本文介绍了我怎样才能把我的GTK应用程序放在桌面菜单中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从一段时间开始编程,并使用GTK 3.0创建了我的第一个正在运行的应用程序。我没有使用格莱德,我不知道是否值得强调它。我的代码工作得很好,但现在我有疑问了,我该如何制作自己的桌面菜单应用程序?我的意思是,我希望我的应用程序在没有使用GTK 3.0编译器的终端中编译时运行,但双击是。



我已经看到GNOME开发人员中心提供的这些示例,但我承认并不理解它: https://developer.gnome.org/integration-guide/stable/desktop-files.html .en#ex-sample-desktop-file



这个想法是创建一个包含这一系列行的文件:



[Desktop Entry]



Type = Application < code
$ b $ p $编码= UTF-8



名称=示例应用程序名称



Comment =示例应用程序 $ b code $ c $ Exec = code $

Icon = application.png



终端= false



这个文件是我的可执行文件,还是指向我的可执行文件的不同文件?如果是我的可执行文件,我可以在哪里插入它?



谢谢!

解决方案

因此,基本上这个文件将为您为文件中相应指令提供的配置创建一个桌面条目。

  Exec =/绝对/路径/ to / your / executable / file

code>指令将保存您的应用程序名称的信息。这是您在gnome应用程序搜索中查询的那个(当您按下windows键时出现)。



这个文件将包含一个 .desktop 扩展名。而这个文件本身不可执行。这将指向您的应用程序,从而使gnome / ubuntu系统明白此类应用程序存在。



这不会像在Windows中那样直接创建桌面快捷方式,您可以从应用程序菜单(ubuntu或gnome)运行的应用程序



如果您不确定将文件放置在何处,这是您链接的文档提示。


将此文件放在/ usr / share / applications目录中,以便每个人都可以访问它,或者在〜/ .local / share /应用程序,如果你只希望让一个用户访问它


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!

解决方案

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

这篇关于我怎样才能把我的GTK应用程序放在桌面菜单中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆