README 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. Hello,
  2. Earlier I noticed that *.dt files contain much the same information as
  3. *.desktop files, so I thought I'd see about automatically converting
  4. from *.desktop to *.dt.
  5. Here's a first try, in the form of a shell script.
  6. It reads one or more desktop files, listed on the command line,
  7. to generate as many .dt files and the corresponding icons.
  8. Each .dt file contains only the action that would start the command.
  9. This does NOT handle quite a few things:
  10. -multiple locales ( for example, Comment[de]= could make an entry in the
  11. right locale).
  12. -putting anything in the right place
  13. -line-wrapped entries
  14. -adding entries to the app manager
  15. -file types and associations
  16. -most sanity checks
  17. That said, this works for me:
  18. cd emptydir
  19. desktop2dt /usr/share/applications/nedit.desktop \
  20. /usr/share/applications/xephem.desktop
  21. mv *.dt ~/.dt/types/
  22. mv *.pm ~/.dt/icons/
  23. touch ~/.dt/appmanager/Desktop_Apps/nedit
  24. touch ~/.dt/appmanager/Desktop_Apps/xephem
  25. chmod +x ~/.dt/appmanager/Desktop_Apps/nedit
  26. chmod +x ~/.dt/appmanager/Desktop_Apps/xephem
  27. and then go to Desktop_Tools > Reload Applications
  28. I'd like to hear any comments you have.
  29. Thanks,
  30. Isaac Dunham
  31. =-=
  32. Hello,
  33. I've been working on desktop2dt some more, and have a version that
  34. works much better.
  35. It can handle icons in subdirectories, installing files (to $DESTDIR/etc/dt
  36. or ~/.dt), and terminal applications.
  37. There are still some missing features:
  38. -line-wrapped entries
  39. -adding entries to the app manager
  40. -file types and associations
  41. Unless we use libmagic, this will be a real pain.
  42. -multiple locales ( for example, Comment[de]= could make an entry in the
  43. right locale).
  44. Currently, it's hard-coded to output action databases in the C locale.
  45. Usage is similar to the last version, except -i installs everything:
  46. desktop2dt -i /usr/share/applications/nedit.desktop \
  47. /usr/share/applications/xephem.desktop
  48. touch ~/.dt/appmanager/Desktop_Apps/nedit
  49. touch ~/.dt/appmanager/Desktop_Apps/xephem
  50. chmod +x ~/.dt/appmanager/Desktop_Apps/nedit
  51. chmod +x ~/.dt/appmanager/Desktop_Apps/xephem
  52. and then go to Desktop_Tools > Reload Applications
  53. If you can test it, that will be a great help. I've tried to stick to POSIX,
  54. but I only tested on Squeeze.
  55. Thanks,
  56. Isaac Dunham
  57. =-=
  58. Hello,
  59. Here's the third revision of the script.
  60. What's new:
  61. * Converts %u, %U, %f, and %F to "%(File)Arg_1%" (with quotes).
  62. * -a option to install in the app manager
  63. (Thanks to Antonis Tsolomis for suggesting these improvements.)
  64. * Slightly improved icon location search (based on PREFIX).
  65. Still needs to handle wrapped lines, but that's the main issue with
  66. processing .desktop files for applications that remains.
  67. HTH,
  68. Isaac Dunham
  69. =-=
  70. Here's a fourth revison of desktop2dt.
  71. Changes:
  72. * export and test were changed for compatability with old shells like
  73. Solaris has
  74. * ~ was changed to $HOME because it didn't always get expanded.
  75. Not yet changed:
  76. I'm inclined to prevent creation of appmanager folders more than 3 deep.
  77. Still no multi-locale stuff. If someone has a way to figure out which
  78. locales to grab (two-letter) and where they go (CDE locale), I'm open to
  79. including it.
  80. Still doesn't handle line wrap. I may be able to deal with this.
  81. The more platforms it's tested on, the better; I'd like to hear from
  82. someone using one of the BSDs.
  83. So far, it's been tested on Debian and Solaris, with at least the
  84. following shells on Debian:
  85. bash, dash, busybox ash, pdksh, mksh, ksh93
  86. This would suggest that it should work on all the BSDs as well.
  87. Besides POSIX sh, find, sed, and grep, it needs imagemagick (or
  88. graphicksmagick + imagemagick-compat).
  89. Thanks,
  90. Isaac Dunham