Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. gnome-system-monitor
  2.  
  3. Application name || desktop file || command
  4. ===============================================================
  5. Cheese || cheese.desktop || cheese
  6. Ubuntu Software Center || ubuntu-software-center.desktop || /usr/bin/software-center %u
  7. eBook speaker || eBook-speaker.desktop || eBook-speaker %f
  8. Vuze || azureus.desktop || azureus %f
  9. Mines || gnomine.desktop || gnome-mines
  10. Shotwell || shotwell.desktop || shotwell %U
  11. Synaptic Package Manager || synaptic-kde.desktop || synaptic
  12.  
  13. #!/usr/bin/python3
  14. import os
  15. dtfile_list = os.listdir("/usr/share/applications")
  16. for item in dtfile_list:
  17. if item.endswith(".desktop"):
  18. with open("/usr/share/applications/"+item) as commandlist_source:
  19. searchlines = commandlist_source.readlines()
  20. try:
  21. command_data = ([
  22. line for line in searchlines if line.startswith("Name=")
  23. ][0].replace("Name=", "").replace("n", ""),
  24. [
  25. line for line in searchlines if line.startswith("Exec=")
  26. ][0].replace("Exec=", "").replace("n", ""))
  27. print(command_data[0]," || ", item, " || ", command_data[1])
  28. except Exception:
  29. pass
  30.  
  31. python3 get_commands.py
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement