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

[{'answer_id': 74003, 'author': 'akdom', 'author_id': 145, 'author_profile': 'https://Stackoverflow.com/users/145', 'pm_score': 3, 'selected': False, 'text': "<p>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.</p>\n<p>An example foo.desktop file would be:</p>\n<pre><code>[Desktop Entry]\nEncoding=UTF-8\nGenericName=Generic Piece Of Software\nName=FooBar\nExec=/usr/bin/foo.sh\nIcon=foo.png\nTerminal=false\nType=Application\nCategories=Qt;Gnome;Applications;\n</code></pre>\n<p>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....</p>\n<blockquote>\n<p>Encoding, Name and Exec should speak for themselves.</p>\n<ul>\n<li>Generic name == Brief Description of application.</li>\n<li>Icon == The image to display for the icon</li>\n<li>Terminal == Is this a terminal application, should I start it as one?</li>\n<li>Type == Type of program this is, can be used in placing the icon in a menu.</li>\n<li>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.</li>\n</ul>\n</blockquote>\n<p>There are more attributes you can set, but they aren't strictly necessary.</p>\n<p>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).</p>\n"}, {'answer_id': 75904, 'author': 'SpoonMeiser', 'author_id': 1577190, 'author_profile': 'https://Stackoverflow.com/users/1577190', 'pm_score': 2, 'selected': False, 'text': '<p>akdom has given a fairly good answer, but doesn\'t do its relevance justice.</p>\n\n<p>Many common desktops, including Gnome, KDE and XFCE where relevant, implement the specifications laid out by <a href="http://www.freedesktop.org/" rel="nofollow noreferrer">freedesktop.org</a>. Among these, is the <a href="http://standards.freedesktop.org/desktop-entry-spec/latest/" rel="nofollow noreferrer">Desktop Entry Specification</a> which describes the format of files that define desktop icons, and <a href="http://standards.freedesktop.org/basedir-spec/latest/" rel="nofollow noreferrer">Desktop Base Directory Specification</a> that describes the locations that desktop environments should look to find these files.</p>\n\n<p>Your RPM needs to include a .desktop file, as specified by the <a href="http://standards.freedesktop.org/desktop-entry-spec/latest/" rel="nofollow noreferrer">Desktop Entry Specification</a>, and install it in the correct location as specified either by the <a href="http://standards.freedesktop.org/basedir-spec/latest/" rel="nofollow noreferrer">Desktop Base Directory Specification</a>, or in a distribution specific location (I imagine there will be aliases to use in the spec file for this location).</p>\n'}, {'answer_id': 36131913, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': '<p>To create a desktop icon to an application follow the two steps below.</p>\n\n<ol>\n<li><p>In an Editor create a new file.</p>\n\n<pre><code>gedit ~/.local/share/applications/NameYouWantForApplication.desktop\n</code></pre></li>\n<li><p>Place this section within the file and save it.</p>\n\n<pre><code>[Desktop Entry]\nType=Application\nEncoding=UTF-8\nName=JeremysPentaho\nComment=Whatever Comment You want\nExec=/home/yourname@yourdomain.com/Source/Pentaho/data-integration/spoon.sh\nIcon=/home/yourname@yourdomain.com/Source/Pentaho/data-integration/NameOfmyIconFile.jpg\nTerminal=false\n</code></pre></li>\n</ol>\n'}]
['https://Stackoverflow.com/questions/73930', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']