This tutorial is for those people that like to run gnome and KDE side by side. This will allow you to only show the native apps in the menus within each desktop environment instead of showing everything.

update: I wrote a script to automate this process. If you’d like to use that instead it is available below.

You can run the following commands to make gnome menu backups and KDE menu backups prior to making the changes, if you want to be safe.

mkdir -p ~/.menu-backup{gnome,kde}

cp /usr/share/applications/* ~/.menu-backup/gnome

cp /usr/share/applications/kde/* ~/.menu-backup/kde

To update the menu listings then run (one continued line):

sudo -i

cd /usr/share/applications/ ; for i in *; do echo “ShowOnlyIn=GNOME” >> $i; done ; cd /usr/share/applications/kde/ ; for i in *; do echo “ShowOnlyIn=KDE” >> $i; done ; exit

The changes should take place immediately and you should now only see the native apps in each menu. Enjoy.

If everything seems to work the way you like you can delete the backup directories with the following commands:

rm -r ~/.menu-backup-gnome

rm -r ~/.menu-backup-kde

I suppose I could write a small shell script to do the work for you.. would anyone prefer that? I got bored and wrote it.

menu-cleaner.sh v0.1

I post tutorials very regularly on this site. You may want to consider subscribing to the RSS feed. Or if you'd prefer these tips sent to your inbox you can use Email Subscriptions.

Related Posts

Random Posts

-->

Comments

30 Responses to “Removing KDE icons in gnome / remove gnome icons in KDE”

  1. Lucian on July 18th, 2007 7:25 pm

    Rock on! I have been asking this everywhere with no reply. Awesome!

  2. Lucian on July 18th, 2007 7:40 pm

    Btw, is this a permanent fix or will I need to run this everytime I install new applications?

  3. Ubuntu Tutorials on July 18th, 2007 7:44 pm

    Lucian - It is not a permanent fix, and I’ll need to update a bit of the code to allow it to cleanly be re-run after new apps are installed.. I’ll try to set some time for that.

  4. Lucian on July 19th, 2007 3:56 am

    Thanks for the reply. What will I need to do manually to run this script again?

    NOTE: I have noticed some changes in the script since last night. Is it now possible to re-run the script or was something else fixed?

  5. Linux Tip: Hide KDE apps in Gnome menus : Teknicks Blog on July 19th, 2007 3:44 pm

    [...] state. Additionally, the script also hides Gnome apps in KDE. Two for the price of one none! Removing KDE icons in gnome / remove gnome icons in KDE [Ubuntu [...]

  6. Techzi » Blog Archive » Linux Tip: Hide KDE apps in Gnome menus on July 19th, 2007 4:15 pm

    [...] state. Additionally, the script also hides Gnome apps in KDE. Two for the price of one none! Removing KDE icons in gnome / remove gnome icons in KDE [Ubuntu [...]

  7. Linux Tip: Hide KDE apps in Gnome menus at SoftSaurus on July 19th, 2007 6:49 pm

    [...] state. Additionally, the script also hides Gnome apps in KDE. Two for the price of one none! Removing KDE icons in gnome / remove gnome icons in KDE [Ubuntu [...]

  8. Enlever les icones KDE du menu Gnome et vice-versa - [ChaChat’s Homepage] on July 19th, 2007 11:12 pm

    [...] Source : Ubuntu-Tutorials [...]

  9. Technology » Blog Archive » Linux Tip: Hide KDE apps in Gnome menus on July 24th, 2007 1:50 am

    [...] Additionally, the script also hides Gnome apps in KDE. Two for the price of one none! Removing KDE icons in gnome / remove gnome icons in KDE [Ubuntu [...]

  10. tidiman07 on July 25th, 2007 8:30 am

    does it work with xfce4 too? Xubuntu-desktop? I’m gonna try it.

  11. Ubuntu Tutorials on July 25th, 2007 10:07 am

    tidiman07 - it does not work with XFCE unless you run it *before* you install XFCE. The problem is the desktop menu icons are located in the same place for XFCE and gnome, whereas KDE places them in a separate directory.

    If I get time to keep working on this I could put something together, but currently it’s gnome and KDE specific

  12. Carthik Sharma on July 26th, 2007 2:54 pm

    I had written about this over a year ago. It is good to see it get around, though.

  13. Freddy Martinez on July 26th, 2007 6:27 pm

    Hi, I am also looking to get this to work on Xfce. I would like to install Xubuntu so I can work with Documentation easier but dislike all the additional icons that clutter up the K menu. Have you done anything with editing the script? Also, a not so elegant solution would be to have the script run in a cron job so that it eventually cleans up the menus for KDE & GNOME.

  14. Hide KDE apps in Gnome menus at SoftSaurus on July 31st, 2007 12:33 pm

    [...] state. Additionally, the script also hides Gnome apps in KDE. Two for the price of one none! Removing KDE icons in gnome / remove gnome icons in KDE [Ubuntu [...]

  15. Brad on October 4th, 2007 9:51 pm

    404 on the script..

  16. Ubuntu Tutorials on October 5th, 2007 7:42 am

    Brad - thank you for pointing that out. I have updated the link. It should work now.

  17. Chris on October 23rd, 2007 2:00 am

    Will this work on Fedora as well? I have both GNOME and KDE on Fedora 7 and I was looking for such a fix.

  18. Ubuntu Tutorials on October 23rd, 2007 6:37 am

    Chris - as far as I know it should work in KDE, although I have not directly tested it.

  19. Chris on October 23rd, 2007 10:07 am

    So far the terminal commands don’t work exactly as they shoud, some of the backing up had to be done manually. Right now I’m out but I’ll try the rest of it when I get home.

  20. rapidoda » Blog Archive » Comment on Removing KDE icons in gnome / remove gnome icons in KDE … on October 23rd, 2007 12:36 pm

    [...] sourced here [...]

  21. Chris on October 25th, 2007 1:36 am

    Ok, so I finally got to run it in the terminal and it returned the following which I don’t know it it is normal or not:
    -bash: kde: Is a directory
    -bash: kde4: Is a directory
    -bash: screensavers: Is a directory
    logout

    And the KDE menus are not hidden nor are the GNOME ones in KDE.

  22. Hide KDE apps in Gnome menus [Linux Tip] at SoftSaurus on October 29th, 2007 2:43 pm

    [...] state. Additionally, the script also hides Gnome apps in KDE. Two for the price of one none! Removing KDE icons in gnome / remove gnome icons in KDE [Ubuntu [...]

  23. Annoym on November 11th, 2007 6:30 pm

    I happen to have the same problem that Chris has.

  24. Zlatan Kadragi? on November 24th, 2007 8:34 am

    The problem in Ubuntu 7.10 is in “ShowOnlyIn=GNOME” and “ShowOnlyIn=KDE”
    That parts should be written as:
    “OnlyShowIn=GNOME” and “OnlyShowIn=KDE” (note: >”“”< )

  25. Jlar on November 27th, 2007 3:11 pm

    Just a little fix. :-P
    If you’re running the commands manually, the first one should be:

    “mkdir -p ~/.menu-backup/{gnome,kde}”

  26. Daniel on December 27th, 2007 3:34 pm

    For those looking for the menu-cleaner.sh script: http://www.programming-designs.com/linux/menu-cleaner.sh

    This tutorial didn’t help in Gutsy so I had to use the script instead.

  27. Lewis on February 20th, 2008 9:44 am

    Do I just copy the entire code above as one line, and do I need both GNOME and KDE already installed (one I’ve seen said to run part of the code first, then install KDE and then run the second part of the code)

  28. michele on July 10th, 2008 8:48 am

    There is a way to go back? i loose my backup and i want the kde apps back on my gnome menu. It’s possible?

  29. locazoreloco on July 26th, 2008 6:00 am

    THIS DOESN’T WORK IN HARDY, HELP!!! I TRIED WITH THE ORIGINAL POST AND THE CHANGES THAT ZLATAN SUGGEST BUT NOTHING HAPPENED!

  30. jersoncito on August 2nd, 2008 2:52 pm

    The script that Daniel said

    http://www.programming-designs.com/linux/menu-cleaner.sh

    worked with KDE4 for me. but I had to change the script with a text editor (kde to kde4)

    Thanks

Leave a Reply




    OSCON


    OSCON 2008

    Subscribe to the RSS feed!


    subscribe to the ubuntu tutorials RSS feed

    Polls


  • Regarding the Ads on Ubuntu Tutorials...

    • I dislike all web-based ads and use AdBlock (or similar) to destroy them! (49%, 155 Votes)
    • I don't mind the text-based ads on ubuntu-tutorials.com and currently view them. (31%, 99 Votes)
    • I would be willing to disable AdBlock (or similar) for this site considering I have found it helpful. (16%, 51 Votes)
    • I subscribe to ubuntu-tutorials.com via RSS or email so ads are a non-issue. (15%, 48 Votes)
    • I'd be willing to use the "Donate" button instead of see ads. (5%, 17 Votes)

    Total Voters: 316

    Loading ... Loading ...

  • Blogroll

  • Ads by Google