LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices


Reply
  Search this Thread
Old 05-17-2006, 02:28 AM   #1
RavenLX
Member
 
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:

Code:
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=/usr/bin/newapp
Icon=/usr/share/apps/newapp/newapp_48x48.png
Path=
Terminal=false
GenericName=My New Application
Name=NewApp
X-DCOP-ServiceType=Multi
Categories=Applications;Graphics;
Any help would be very much appreciated. I'm stumped.
 
Old 05-17-2006, 04:51 AM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
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, 10:17 AM   #3
RavenLX
Member
 
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, 10:26 AM   #4
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Look at the Mandriva Cooker website. I remember reading some articles about how to build rpms and configure menu entries.
 
Old 05-17-2006, 11:45 AM   #5
RavenLX
Member
 
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:

http://www.rpm.org/hintskinks/buildtree/mdk-rpm/#AEN642

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:

Code:
%install
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" \
multiple_files="false" 
EOF
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 01:36 PM.
 
Old 05-17-2006, 01:51 PM   #6
RavenLX
Member
 
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.

Code:

# DEFAULT.SPEC
# RPM Spec file for Mandriva 2006 and KDE 3.4.2
# By Fuzzie Dice <fuzziedice6000@yahoo.com>
#
# 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}
Summary: SHORT_DESCRIPTION_OF_YOUR_APPLICATION
Source: URL_WHERE_PEOPLE_CAN_GET_SOURCE_FILES
URL: URL_OF_APPLICATION_WEB_SITE
Group: RPM_DATABASE_GROUP_TO_PLACE_ENTRY_IN
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

%description
PUT_APPLICATION_LONG_DESCRIPTION_HERE

# This area sets up the KDE Menu system and will update the menu
# during installation or uninstallation.
%install
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"
EOF

cat << EOF > $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=ABSOLUTE_PATH_TO_APP_EXECUTABLE_AND_ANY_COMMAND_LINE_OPTIONS
Icon=ABSOLUTE_PATH_TO_ICON_FOR_MENU
Terminal=false
Name=YOUR_APP_NAME
Comment=APP_SHORT_DESCRIPTION
# Adjust this line to place in whatever menu category appropriate.
# This may be different from the 'section' above.
Categories=Application;Graphics;
EOF

# Update KDE menu so user can see icon immediately after installing
%post 
update-menus

# Update KDE menu so icon is removed immediately after uninstalling
%postun
update-menus

# 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.
%files
%defattr(-,root,root,0755) 
%dir /usr
/usr/*

# This is a changelog which is to be updated whenever you make changes
# to the RPM Build.
%changelog 
* DAY MON DD YYYY YOUR_NAME <YOUR_EMAIL_ADDRESS> PROGRAM_VERSION-1mdk
- 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 04:51 PM. Reason: Corrected BuildRoot directory info.
 
  


Reply

Tags
icon, kde, kmenu, menu, rpm, spec



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 05:05 AM
kde 3.3 desktop menu with sub-menu nicflatterie Linux - General 7 05-07-2006 09:10 PM
KDE + show desktop iain.ross Linux - Newbie 2 01-03-2005 10:13 AM
KDE and Show mount icons on desktop Lokheed Linux - Software 0 12-08-2004 01:52 AM
'show desktop' icon in KDE Kix Linux - Newbie 2 11-15-2004 02:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva

All times are GMT -5. The time now is 09:11 PM.

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