Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
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
show 1 more comment

1 Answer

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.

filename="MyDesktopFiles.xml"
rm $filename
touch $filename

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

for files in /usr/share/applications/*.desktop; 
do 
  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
done

echo '</items>' >> $filename
echo '</xml>' >> $filename
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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