choose_themes 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #!/bin/sh
  2. #called from 3builddistro
  3. #141204 now have file 'default-theme' (see 3builddistro).
  4. BI_ITEMS=""; DEFITEM=""
  5. if [ "$DEFAULT_THEME_WALLPAPER" ];then #141204
  6. DEFITEM="$(echo -n "$DEFAULT_THEME_WALLPAPER" | cut -f 2 -d ':')"
  7. [ -f rootfs-complete/usr/share/backgrounds/${DEFITEM} ] && BI_ITEMS="<item>${DEFITEM}</item>"
  8. fi
  9. for ONEITEM in `ls -1 rootfs-complete/usr/share/backgrounds | tr '\n' ' '`
  10. do
  11. [ "$ONEITEM" == "$DEFITEM" ] && continue #141204
  12. BI_ITEMS="${BI_ITEMS}<item>${ONEITEM}</item>"
  13. done
  14. GT_ITEMS=""; DEFITEM=""
  15. if [ "$DEFAULT_THEME_GTK2" ];then #141204
  16. DEFITEM="$(echo -n "$DEFAULT_THEME_GTK2" | cut -f 2 -d ':')"
  17. [ -d rootfs-complete/usr/share/themes/${DEFITEM}/gtk-2.0 ] && GT_ITEMS="<item>${DEFITEM}</item>"
  18. fi
  19. for ONEITEM in `ls -1 rootfs-complete/usr/share/themes/*/gtk-2.0 | grep '^rootfs-complete/usr/share/themes' | cut -f 5 -d '/'`
  20. do
  21. [ "$ONEITEM" == "$DEFITEM" ] && continue #141204
  22. GT_ITEMS="${GT_ITEMS}<item>${ONEITEM}</item>"
  23. done
  24. DI_ITEMS=""; DEFITEM=""
  25. if [ "$DEFAULT_THEME_DESK_ICONS" ];then #141204
  26. DEFITEM="$(echo -n "$DEFAULT_THEME_DESK_ICONS" | cut -f 2 -d ':')"
  27. [ "$DEFITEM" ] && [ -d rootfs-complete/usr/local/lib/X11/themes/${DEFITEM} ] && DI_ITEMS="<item>${DEFITEM}</item>"
  28. fi
  29. for ONEITEM in `find rootfs-complete/usr/local/lib/X11/themes -maxdepth 1 -mindepth 1 -type d | rev | cut -f 1 -d '/' | rev`
  30. do
  31. [ "$ONEITEM" == "$DEFITEM" ] && continue #141204
  32. DI_ITEMS="${DI_ITEMS}<item>${ONEITEM}</item>"
  33. done
  34. JT_ITEMS=""; DEFITEM=""
  35. if [ "$DEFAULT_THEME_JWM" ];then #141204
  36. DEFITEM="$(echo -n "$DEFAULT_THEME_JWM" | cut -f 2 -d ':')"
  37. [ -f rootfs-complete/root/.jwm/themes/${DEFITEM}-jwmrc ] && JT_ITEMS="<item>${DEFITEM}</item>"
  38. fi
  39. for ONEITEM in `ls -1 rootfs-complete/root/.jwm/themes/*-jwmrc | rev | cut -f 1 -d '/' | cut -f 2-99 -d '-' | rev`
  40. do
  41. [ "$ONEITEM" == "$DEFITEM" ] && continue #141204
  42. JT_ITEMS="${JT_ITEMS}<item>${ONEITEM}</item>"
  43. done
  44. OB_ITEMS=""; DEFITEM=""
  45. if [ "$DEFAULT_THEME_OPENBOX" ];then #141204
  46. DEFITEM="$(echo -n "$DEFAULT_THEME_OPENBOX" | cut -f 2 -d ':')"
  47. [ "$DEFITEM" ] && [ -d rootfs-complete/usr/share/themes/${DEFITEM}/openbox-3 ] && OB_ITEMS="<item>${DEFITEM}</item>"
  48. fi
  49. for ONEITEM in `ls -1 rootfs-complete/usr/share/themes | tr '\n' ' '`
  50. do
  51. [ "$ONEITEM" == "$DEFITEM" ] && continue #141204
  52. [ ! -e rootfs-complete/usr/share/themes/${ONEITEM}/openbox-3 ] && continue
  53. OB_ITEMS="${OB_ITEMS}<item>${ONEITEM}</item>"
  54. done
  55. export MAIN_DIALOG="
  56. <vbox>
  57. <text><label>Choose the default themes...</label></text>
  58. <hbox>
  59. <text><label>Background image (ref: usr/share/backgrounds):</label></text>
  60. <combobox>
  61. <variable>BACKGROUNDIMAGE</variable>
  62. ${BI_ITEMS}
  63. </combobox>
  64. </hbox>
  65. <hbox>
  66. <text><label>GTK theme (ref: usr/share/themes/*/gtk-2.0):</label></text>
  67. <combobox>
  68. <variable>GTKTHEME</variable>
  69. ${GT_ITEMS}
  70. </combobox>
  71. </hbox>
  72. <hbox>
  73. <text><label>Desk icons (ref: usr/local/lib/X11/themes):</label></text>
  74. <combobox>
  75. <variable>DESKICONS</variable>
  76. ${DI_ITEMS}
  77. </combobox>
  78. </hbox>
  79. <hbox>
  80. <text><label>JWM theme (ref: root/.jwm/themes):</label></text>
  81. <combobox>
  82. <variable>JWMTHEME</variable>
  83. ${JT_ITEMS}
  84. </combobox>
  85. </hbox>
  86. <hbox>
  87. <text><label>Openbox theme (ref: usr/share/themes/*/openbox-3):</label></text>
  88. <combobox>
  89. <variable>OBTHEME</variable>
  90. ${OB_ITEMS}
  91. </combobox>
  92. </hbox>
  93. <hbox>
  94. <button ok></button>
  95. </hbox>
  96. </vbox>
  97. "
  98. gtkdialog3 --center --program=MAIN_DIALOG