Author Topic: [SOLVED] Editing the system menu (menu.xml doesn't work)  (Read 1031 times)

Offline antares

  • Jr. Member
  • **
  • Posts: 19
[SOLVED] Editing the system menu (menu.xml doesn't work)
« on: January 21, 2012, 12:54:16 PM »
I have identical menu.xml files under:

~/.config/openbox
/etc/skel/.config/openbox/
/etc/xdg/openbox/

And a different one under:

/usr/share/lxde/openbox/menu.xml

However, none of these matches my lxpanel menu, which is why obmenu, lxmed and manually editing the files were ineffective. After looking around, I found out that the structure of my menu (which is what I was trying to change) was inside /etc/xdg/menus/applications.menu. Altering this file didn't bring about any changes, and so I copied the "menus" folder (with changes to applications.menu) to my ~/.config.

The result: the menu now only shows "Logout" and "Run". I restored everything to what it was before, without any luck.

Does anyone have a clue as to why menu.xml is not recognized as the defaulf menu file on my system?

Thank you in advance.
« Last Edit: January 22, 2012, 06:47:50 AM by antares »

Offline antares

  • Jr. Member
  • **
  • Posts: 19
Re: menu.xml does not correspond to my lxpanel menu
« Reply #1 on: January 21, 2012, 01:52:17 PM »
I managed to restore the menu by deleting the files in ~/.cache/menus.

However, the question still remains. Why is it that I have "Acessories / Multimedia / Office" etc in menu.xml (read by lxmed and obmenu, which don't work for me) when, in reality, my menu reads "More applications / Graphics / Sound / Video" etc?

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: menu.xml does not correspond to my lxpanel menu
« Reply #2 on: January 21, 2012, 05:37:44 PM »
Unless you set it to do so (right click the desktop > Desktop Preferences > Advanced tab), LXDE does not use the openbox menu. I'd advise against enabling openbox menu, as doing so will cause you problems.     

You are not clear on what exactly you are trying to accomplish. Please state your question clearly and give details. Give details about what you have done. Which version of LXDE are you using?       

Default menu structure (top down):     
More Applications
Archiving
Editors
File Tools
Games
Graphics
Internet
Office
Software Center
Sound
Video     

Offline antares

  • Jr. Member
  • **
  • Posts: 19
Re: menu.xml does not correspond to my lxpanel menu
« Reply #3 on: January 21, 2012, 08:42:13 PM »
Thank you for the reply.

I want to change the structure of the menu, e.g. combining "Graphics", "Sound" and "Video" into a single id, such as "Multimedia" (turning the first 3 into submenus under "Multimedia").

I tried to achieve that by altering /etc/xdg/menus/applications.menu, which didn't work. But every single file, be it applications.menu or menu.xml, is now restored to their original versions.

I'm running pclinuxos-lxde-2011.09.

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: menu.xml does not correspond to my lxpanel menu
« Reply #4 on: January 21, 2012, 09:01:01 PM »
Exactly what changes did you make to /etc/xdg/menus/applications.menu and did you do then as root?     

Offline antares

  • Jr. Member
  • **
  • Posts: 19
Re: menu.xml does not correspond to my lxpanel menu
« Reply #5 on: January 21, 2012, 09:38:59 PM »
The menu has the exact same standard structure you listed. Applications.menu and every other file are unchanged.

What I did (and undid) was altering /etc/xdg/menus/applications.menu as root. Nothing changed. I copied the file to ~/.config/menus. The menu disappeared. I undid everything and deleted ~/.cache/menus, and all was back to normal.

In /etc/xdg/menus/applications.menu,

This:
Code: [Select]
<Menuname>Graphics</Menuname>
<Menuname>Sound</Menuname>
<Menuname>Video</Menuname>

became this:
Code: [Select]
<Menuname>Multimedia</Menuname>
And this:
Code: [Select]
<Menu>
   <Name>Graphics</Name>
      <Layout>...</Layout>
      <Directory>...</Directory>
      <Include>...</Include>
</Menu>
<Menu>
   <Name>Sound</Name>
      <Layout>...</Layout>
      <Directory>...</Directory>
      <Include>...</Include> 
</Menu>
<Menu>
   <Name>Video</Name>
      <Layout>...</Layout>
      <Directory>...</Directory>
      <Include>...</Include> 
</Menu>

became this:
Code: [Select]
<Menu>
   <Name>Multimedia</Name>
      <Layout>
         <Menuname>Graphics</Menuname>
         <Menuname>Sound</Menuname>
         <Menuname>Video</Menuname>
      </Layout>
      <Directory>...</Directory>
      <Include>...</Include>
      <Menu>
         <Name>Graphics</Name>
            <Directory>...</Directory>
            <Include>...</Include>
       </Menu>
       <Menu>
          <Name>Sound</Name>
            <Directory>...</Directory>
            <Include>...</Include>
        </Menu>
        <Menu>
          <Name>Video</Name>
            <Directory>...</Directory>
            <Include>...</Include>
        </Menu>
</Menu>

[...] means I didn't change anything that was inside those tags.

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: menu.xml does not correspond to my lxpanel menu
« Reply #6 on: January 22, 2012, 06:18:25 AM »
Do you have Geany installed? It is an IDE and editor that will probably work better for you than leafpad for editing xml files.     

Any road, before you start, back up your current applications.menu. Copy it to your /home/you or rename it applications.menu-bak. This is so that if you need to restore it you can easily copy it back to /etc/xdg/menus or rename it again to remove the -bak.     
The file is 659 lines long. Moderate length (not in the thousands ;) :D). It may take a while as you should go slow and careful in editing it.     

For every <Menuname>***</Menuname> you change in the first 19 or so lines, you must change its corresponding entry(ies) in the file further down; i.e. its <Menu> to </Menu>. This will include <Directory> and <Category> entries between <Menu> and </Menu> for all sections. For every <Menuname>***</Menuname> entry you change, you must make the needed changes in its corresponding <Menu> to </Menu> entry. For every <Menuname>***</Menuname> entry you remove, you must remove its corresponding <Menu> to </Menu> entry.     

After saving your changes as applications.menu, reboot.     

Editing xml is not an easy task. It is easy to make mistakes. Take your time.     

Offline antares

  • Jr. Member
  • **
  • Posts: 19
Re: menu.xml does not correspond to my lxpanel menu
« Reply #7 on: January 22, 2012, 06:45:44 AM »
Will install Geany and will edit the file again. Thanks for your time, mate.

I'll also mark this as solved and change the title of the post into a more accurate description. I still haven't changed the menu but if applications.menu is the right file, my question is answered and now it's only a matter of getting to it.

Thanks again.

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: [SOLVED] Editing the system menu (menu.xml doesn't work)
« Reply #8 on: January 22, 2012, 06:55:32 AM »
Good luck with it. As I said, editing xml is not easy. Geany can show you your mistakes. Fixing them may not be so easy.     

Offline antares

  • Jr. Member
  • **
  • Posts: 19
Re: [SOLVED] Editing the system menu (menu.xml doesn't work)
« Reply #9 on: January 22, 2012, 09:00:07 AM »


Edited /etc/xdg/menus/applications.menu and copied it to ~/.config/menus/ to tweak the menu in my user lxpanel.

Thanks, Neal.

Offline Hootiegibbon

  • Hero Member
  • *****
  • Posts: 4151
Re: [SOLVED] Editing the system menu (menu.xml doesn't work)
« Reply #10 on: January 22, 2012, 09:08:42 AM »
antares

Just a note of caution regarding manual editing of the xdg_menu locations, these will be over written if the install of any app involves running "xdg_menu && update-menus -v" - or either one of those commands.

I think you need to set up/alter the .desktopfile and then use xdg-desktop-menu --(un)install command to successfully (and permanently) alter  the xdg menu system

Jase


I am Hootiegibbon, undisputed champion fo the typo

My .dotfiles