I'm building an application and it's very important to me to know how to get this information. In LXDE, there is /usr/share/lubuntu/openbox/menu.xml that lists all the programs that can be executed from the LXDE menu.

For that reason, I'd like to know if there is some .xml file that is responsible for the organization of the Ubuntu Dash Home like the one in LXDE?

  • 2
    Won't that comprise all .desktop files? So these should be in /usr/share/applications or in ~/.local/share/applications? So would you really need a .xml file for your purpose? – user25656 Feb 6 '13 at 11:13
  • I think so, because I'd be able to query on it from inside the application. And from the /usr/share/applications I can't get the "keywords" used to execute the applications. – Zignd Feb 6 '13 at 11:20
  • I don't know programming but please see if this thread helps! ubuntuforums.org/showthread.php?p=12282576#post12282576 – user25656 Feb 6 '13 at 11:23
  • Thanks for the link @vasa1, It was very useful. The file returned by your command has some problems, do they can be fixed with more complex command? – Zignd Feb 6 '13 at 11:39
  • Clarification ... it's not my code. MG&TL did the real work. For my purposes, some .desktop files have more than one pair of Name+Exec and when that's not in proper order, there's confusion. I mentioned the LibreOffice .desktop files in this context. Perhaps someone who is good at this stuff may be able to help you! – user25656 Feb 6 '13 at 11:48

I understand from the comments that the OP likes the output from the linked code but would like the information placed into an xml file that can be queried.

Her'es how to modify the script given at Get contents of .desktop files to process the output into an XML file.

rm $filename
touch $filename

echo '<?xml version="1.0"?>' >> $filename
echo '<items>' >> $filename

for files in /usr/share/applications/*.desktop; 
  echo '<item>' >> $filename
  echo '   <name>'$(grep -e "^Name=" $files | sed 's/Name=//g')'</name>' >> $filename   
  echo '   <command>'$(grep -e "^Exec=" $files | sed 's/Exec=//g')'</command>' >> $filename
  echo '</item>' >> $filename

echo '</items>' >> $filename
echo '</xml>' >> $filename

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.