Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.


  Search this Thread
Old 05-17-2006, 03:28 AM   #1
Registered: Oct 2004
Posts: 98

Rep: Reputation: 15
Exclamation How do you get a KDE .desktop file to show in menu?

I am trying to create a binary RPM that will install and app, icons, etc. and put an icon in the Menu.

I am able to get everything else working. All the files go where they should, etc. And the newapp.desktop (which I'll call it for this example) is in the /usr/share/applications directory with the other KDE .desktop shortcuts.

Now when I go to the menu it doesn't show up! I even tried rebooting and it still doesn't show up. I've noticed other KDE apps in RPMs would add icons to the menu. How do they do that?

I'm trying to put let's say "newapp" in the Multimedia/Graphics menu. here's the newapp.desktop file:

[Desktop Entry]
GenericName=My New Application
Any help would be very much appreciated. I'm stumped.
Old 05-17-2006, 05:51 AM   #2
LQ Guru
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 75
Mandriva uses its own menu structure so many apps won't appear in the Mandriva menu unless they are designed for their menu. You could use menudrake to add the app to the menu or look into the structure of the Mandriva menu and change your .desktop file into their format.
Old 05-17-2006, 11:17 AM   #3
Registered: Oct 2004
Posts: 98

Original Poster
Rep: Reputation: 15
Unfortunately, I already knew that. I am looking for how they did it. My desktop file is exactly the same format as the ones that installed and put an icon in the menu just fine. It should have worked but didn't. Even Open Office put menu items in ok. And the structure above is exactly like those files as well.

Problem is, nothing works even though it should.

I need more detailed information.
Old 05-17-2006, 11:26 AM   #4
LQ Guru
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 75
Look at the Mandriva Cooker website. I remember reading some articles about how to build rpms and configure menu entries.
Old 05-17-2006, 12:45 PM   #5
Registered: Oct 2004
Posts: 98

Original Poster
Rep: Reputation: 15
Sorry, but that doesn't help me because that is a huge site and I have no idea where to look. Searches only turn up things that have no relevance to what I need to get done. I've also been googling, reading web sites (incluing Mandriva sites), and even followed the instructions in this site:

I been reading up until 4am last night and started reading again around 11am this morning. I STILL can't get it working. Even though I added this to the RPM spec file:

cat << EOF > $RPM_BUILD_ROOT%{_menudir}/newapp
?package(xbase):command="/usr/bin/newapp" \
icon="/usr/share/apps/newapp/newapp_48x48.png" needs="X11" section="Multimedia/Graphics" \
title="NewApp" longtitle="My new application" \
accept_url="false" \
It still isn't working. Note that I uninstall the package before I make changes and rebuild, reinstall. I remove the BUILD/usr/lib/menu/newapp file and remove the generated rpm before I rebuild as well. So everything is fresh every time.

It would be very helpful if someone would kindly give me a URL to the answer, or some code examples or something.

Last edited by RavenLX; 05-17-2006 at 02:36 PM.
Old 05-17-2006, 02:51 PM   #6
Registered: Oct 2004
Posts: 98

Original Poster
Rep: Reputation: 15
Lightbulb The Solution: How To Get RPM To Create KDE Menu Items

Ok, I've finally solved the problem after more googling and reading. Here is an example .spec file that one can use to build RPMs that will put a menu item into the KDE menu. It's heavily commented for your convenience.

Note that if this still doesn't work, you can always right click on the KDE menu, edit menu, then click the Save (diskette) icon and then after it's done, the icon should be in the menu. Though you shouldn't have to do this if you put it together based on this spec file as it should place the icon in the menu and update it automatically.

Also this assumes that you are creating a $HOME/rpm directory with the appropriate BUILD, SOURCE, SPEC, etc. directories. In the BUILD directory, create a subdirectory for your application. Make sure it's the same as the application name. as that is what it uses here.


# RPM Spec file for Mandriva 2006 and KDE 3.4.2
# By Fuzzie Dice <>
# Example RPM Spec File for installing applications into Mandriva 2006 with KDE
# This will also create the necessary menu items so that users can immediately
# see the menu item.
# IMPORTANT: Be sure to edit this file and save it as YOUR_APP.spec before you use it!
# Areas to add items are in ALL_CAPITAL_LETTERS

# Headers: Note that if you're doing this for a different architecture,
#          Specify it in the %define _target_cpu YOUR_ARCH
%define name YOUR_APP_NAME
%define version APP_VERSION
%define release 1mdk
%define _target_cpu i586

# Information about the application
# NOTE: Change the License if different from GPL
Name: %{name}
Version: %{version}
Release: %{release}
BuildRoot: %{_topdir}/BUILD/%{name}
License: GPL

# This optional line will make sure certain dependencies are met.
# Use >= to be sure that the item is at least the specified version or later.
# Requires: qt4-common >= 4.0.1


# This area sets up the KDE Menu system and will update the menu
# during installation or uninstallation.
cat << EOF > $RPM_BUILD_ROOT%{_menudir}/%{name}
?package(%{name}): needs=x11 icon="ABSOLUTE_PATH_TO_ICON_FOR_MENU" section="SECTION_PATH_SUCH_AS Multimedia/Graphics" title=YOUR_APP_NAME longtitle="LONG_MENU_DESCRIPTION" command="ABSOLUTE_PATH_TO_APP_EXECUTABLE"

cat << EOF > $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop
[Desktop Entry]
# Adjust this line to place in whatever menu category appropriate.
# This may be different from the 'section' above.

# Update KDE menu so user can see icon immediately after installing

# Update KDE menu so icon is removed immediately after uninstalling

# These are the files that will be installed into the system
# Note that you should have all of the directory structure in your
# RPM BUILD directory. This includes any that will create the above
# files, such as /usr/lib/menu and /usr/share/applications.
# Create the directories yourself even if you don't put anything in
# them yourself. This spec file needs them to be at least present.
%dir /usr

# This is a changelog which is to be updated whenever you make changes
# to the RPM Build.
- Change #1
- Change #2
- Change #3
- etc.
Hope this helps others who may have run into this problem. Took me an all-night stint and most of today on the computer plus a lot of googling and trial and error to get this to work.

Last edited by RavenLX; 05-17-2006 at 05:51 PM. Reason: Corrected BuildRoot directory info.


icon, kde, kmenu, menu, rpm, spec

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
KDE Gnome Desktop Menu Edits (right click on desktop) jdier Linux - Software 11 08-03-2006 06:05 AM
kde 3.3 desktop menu with sub-menu nicflatterie Linux - General 7 05-07-2006 10:10 PM
KDE + show desktop iain.ross Linux - Newbie 2 01-03-2005 11:13 AM
KDE and Show mount icons on desktop Lokheed Linux - Software 0 12-08-2004 02:52 AM
'show desktop' icon in KDE Kix Linux - Newbie 2 11-15-2004 03:53 PM > Forums > Linux Forums > Linux - Distributions > Mandriva

All times are GMT -5. The time now is 10:29 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration