Linux桌面快捷方式和安装图标 [英] Linux desktop shortcut and icon from install

查看:192
本文介绍了Linux桌面快捷方式和安装图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装.rpm的过程中,我需要添加什么以创建桌面快捷方式并为该快捷方式分配图标?如果需要脚本,那么使用示例将非常有帮助.

What do I need to add to my .spec file to create the desktop shortcut and assign an icon to the shortcut during install of my .rpm? If a script is required, an example would be very helpful.

推荐答案

您在Linux下将.desktop文件用于图标.放置图标的位置取决于您所使用的发行版和桌面环境.由于我目前正在Fedora 9上运行Gnome,因此我将以这些方式回答.

You use a .desktop file for icons under linux. Where to put the icon depends on what distribution and what desktop environment you are using. Since I'm currently running Gnome on Fedora 9, I will answer it in those terms.

示例foo.desktop文件为:

An example foo.desktop file would be:

[Desktop Entry]
Encoding=UTF-8
GenericName=Generic Piece Of Software
Name=FooBar
Exec=/usr/bin/foo.sh
Icon=foo.png
Terminal=false
Type=Application
Categories=Qt;Gnome;Applications;

.desktop文件应位于Fedora 9 Gnome下,位于/usr/share/applications/中,您可以在.desktop上运行一次定位,以确定应该在发行版中放置的位置. Gnome通常会在KDE图标目录中查找是否还有其他图标....

The .desktop file should under Fedora 9 Gnome be located in /usr/share/applications/ , you can run a locate on .desktop to figure out where you should put in on your distro. Gnome will generally look in the KDE icon directory to see if there are other icons there also....

编码,名称和执行权应该自己说出来.

Encoding, Name and Exec should speak for themselves.

  • 通用名称==应用程序简要说明.
  • 图标==要为图标显示的图像
  • 终端==这是终端应用程序,我应该作为一个终端启动吗?
  • 类型==这是程序的类型,可用于将图标放置在菜单中.
  • 类别==如果不存在用于指定图标的XML文件,则此信息主要用于将图标放置在给定菜单中.每个人对菜单的设置都有一些不同.
  • Generic name == Brief Description of application.
  • Icon == The image to display for the icon
  • Terminal == Is this a terminal application, should I start it as one?
  • Type == Type of program this is, can be used in placing the icon in a menu.
  • Categories == This information is what is mainly used to place the icon in a given menu if an XML file to specify such is not present. The setup for menus is handled a little differently by everyone.

您可以设置更多的属性,但并不是必须的.

There are more attributes you can set, but they aren't strictly necessary.

所使用的图像文件位于/usr/share/icons/目录中的某个位置.您可以解析所有内容,以发现这些东西如何工作的所有奇迹,但基础是您选择图标类型的目录(在我的情况下是gnome),然后将图像放置在适当的目录中(对于.svg图像,以及用于光栅图像的特定尺寸(例如48x48).在Gnome下,所有图像通常都是.png).

The image file used sits somewhere in the bowels of the /usr/share/icons/ directory. You can parse through that to find all the wonders of how such things work, but the basics are that you pick the directory for the icon type (in my case gnome) and place the image within the appropriate directory (there is a scalable directory for .svg images, and specific sizes such as 48x48 for raster images. Under Gnome all images are generally .png).

这篇关于Linux桌面快捷方式和安装图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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