From 09a975a842a5a5106a25fb140f43465a590c5dcb Mon Sep 17 00:00:00 2001 From: mavrothal Date: Sat, 6 Dec 2014 07:22:50 +0200 Subject: [PATCH] Support for default theme. From BK's patch We can now provide a default theme file. See http://bkhome.org/news/?viewDetailed=00127 and http://www.murga-linux.com/puppy/viewtopic.php?p=812827#812827 --- woof-code/3builddistro | 50 ++++++++++++++++++--------------- woof-code/3builddistro-Z | 50 ++++++++++++++++++--------------- woof-code/support/choose_themes | 38 +++++++++++++++++++++---- 3 files changed, 86 insertions(+), 52 deletions(-) diff --git a/woof-code/3builddistro b/woof-code/3builddistro index 8ebfb50fd3d..5d0a7733c9d 100755 --- a/woof-code/3builddistro +++ b/woof-code/3builddistro @@ -2022,6 +2022,19 @@ rm -rf rootfs-complete/etc/cron.daily 2>/dev/null echo echo "Continuing to setup `pwd`/rootfs-complete..." echo +#141204 optional file... +DEFAULT_THEME_GTK2='' +DEFAULT_THEME_JWM='' +DEFAULT_THEME_OPENBOX='' +DEFAULT_THEME_WALLPAPER='' +DEFAULT_THEME_DESK_ICONS='' +DEFAULT_THEME_ROX_TEXT_FOREGROUND='black' +DEFAULT_THEME_ROX_TEXT_SHADOW='thin' #none, thin, or thick +DEFAULT_THEME_ROX_TEXT_FONT='DejaVu Sans 10' +DEFAULT_THEME_XORG_TEXT_DPI= #141206 +if [ -f default-theme ];then +. ./default-theme +fi #w478 now have a gui for theme selection... eval "`../support/choose_themes`" #...returns BACKGROUNDIMAGE, DESKICONS, GTKTHEME, JWMTHEME. @@ -3048,38 +3061,29 @@ fi #130326 now permanently 96... 130327 reintroduce a choice... ##130129 /root/.Xresources has dpi set to 78 in all prior pups. In future, might prefer 96... -DPILINE="$(grep '^Xft\.dpi:' rootfs-complete/root/.Xresources)" -DPIVALUE=$(echo -n "$DPILINE" | tr '\t' ' ' | tr -s ' ' | cut -f 2 -d ' ') -#if [ $DPIVALUE -lt 96 ];then +#141206 now have DEFAULT_THEME_XORG_TEXT_DPI (usually =96). +if [ "$DEFAULT_THEME_XORG_TEXT_DPI" != "" ];then #141206 + dpisizeflag="$DEFAULT_THEME_XORG_TEXT_DPI" +else + DPILINE="$(grep '^Xft\.dpi:' rootfs-complete/root/.Xresources)" + DPIVALUE=$(echo -n "$DPILINE" | tr '\t' ' ' | tr -s ' ' | cut -f 2 -d ' ') echo echo "rootfs-complete/root/.Xresources has this line:" echo "$DPILINE" echo "which sets the displayed size of fonts on the screen (but not bitmap fonts)." -# echo "All puppies up until January 2013 have the value of '78', however, in future, -#especially with smaller high-resolution screens, a higher value (hence bigger -#font) would be better. We plan to standardise on the value of '96' for bigger -#font display. Just press ENTER only if you want to keep '${DPIVALUE}', or any printable -#character then ENTER for '96'. -#Choose '96' if you would like your pup to display with bigger fonts, even for -#large screens, or you are targeting running on a high-res small screen." -# echo -n "Press ENTER key for '${DPIVALUE}' dpi: " -# read dpisizeflag -# if [ "$dpisizeflag" ];then -# sed -i -e 's%^Xft\.dpi:.*%Xft.dpi: 96%' rootfs-complete/root/.Xresources -# fi -#fi -DPINEXT1=`expr $DPIVALUE + 6` -DPINEXT2=`expr $DPINEXT1 + 6` -echo "To accept this size, just press ENTER key." -echo "However, if you would like fonts to display bigger on the screen, type in + DPINEXT1=`expr $DPIVALUE + 6` + DPINEXT2=`expr $DPINEXT1 + 6` + echo "To accept this size, just press ENTER key." + echo "However, if you would like fonts to display bigger on the screen, type in a value now. The value should be in steps of 6, for example ${DPINEXT1} or ${DPINEXT2}. The default size is ${DPIVALUE}, you might try the next-up, ${DPINEXT1}." -echo -n "Press ENTER key for '${DPIVALUE}' dpi, or type a value: " -read dpisizeflag + echo -n "Press ENTER key for '${DPIVALUE}' dpi, or type a value: " + read dpisizeflag +fi if [ "$dpisizeflag" ];then #130512 scsijon: fix size... fsPTN='s%^Xft\.dpi:.*%Xft.dpi: '"${dpisizeflag}%" sed -i -e "$fsPTN" rootfs-complete/root/.Xresources - echo "...ok, now ${dpisizeflag}" + echo "...ok, dpi now ${dpisizeflag}" fi #130226 wary: /usr/bin/X was missing... diff --git a/woof-code/3builddistro-Z b/woof-code/3builddistro-Z index 54025dc54e6..db5ca1fb612 100755 --- a/woof-code/3builddistro-Z +++ b/woof-code/3builddistro-Z @@ -1271,6 +1271,19 @@ rm -rf rootfs-complete/etc/cron.daily 2>/dev/null echo echo "Continuing to setup `pwd`/rootfs-complete..." echo +#141204 optional file... +DEFAULT_THEME_GTK2='' +DEFAULT_THEME_JWM='' +DEFAULT_THEME_OPENBOX='' +DEFAULT_THEME_WALLPAPER='' +DEFAULT_THEME_DESK_ICONS='' +DEFAULT_THEME_ROX_TEXT_FOREGROUND='black' +DEFAULT_THEME_ROX_TEXT_SHADOW='thin' #none, thin, or thick +DEFAULT_THEME_ROX_TEXT_FONT='DejaVu Sans 10' +DEFAULT_THEME_XORG_TEXT_DPI= #141206 +if [ -f default-theme ];then +. ./default-theme +fi #w478 now have a gui for theme selection... eval "`../support/choose_themes`" #...returns BACKGROUNDIMAGE, DESKICONS, GTKTHEME, JWMTHEME. @@ -2140,38 +2153,29 @@ fi #130326 now permanently 96... 130327 reintroduce a choice... ##130129 /root/.Xresources has dpi set to 78 in all prior pups. In future, might prefer 96... -DPILINE="$(grep '^Xft\.dpi:' rootfs-complete/root/.Xresources)" -DPIVALUE=$(echo -n "$DPILINE" | tr '\t' ' ' | tr -s ' ' | cut -f 2 -d ' ') -#if [ $DPIVALUE -lt 96 ];then +#141206 now have DEFAULT_THEME_XORG_TEXT_DPI (usually =96). +if [ "$DEFAULT_THEME_XORG_TEXT_DPI" != "" ];then #141206 + dpisizeflag="$DEFAULT_THEME_XORG_TEXT_DPI" +else + DPILINE="$(grep '^Xft\.dpi:' rootfs-complete/root/.Xresources)" + DPIVALUE=$(echo -n "$DPILINE" | tr '\t' ' ' | tr -s ' ' | cut -f 2 -d ' ') echo echo "rootfs-complete/root/.Xresources has this line:" echo "$DPILINE" echo "which sets the displayed size of fonts on the screen (but not bitmap fonts)." -# echo "All puppies up until January 2013 have the value of '78', however, in future, -#especially with smaller high-resolution screens, a higher value (hence bigger -#font) would be better. We plan to standardise on the value of '96' for bigger -#font display. Just press ENTER only if you want to keep '${DPIVALUE}', or any printable -#character then ENTER for '96'. -#Choose '96' if you would like your pup to display with bigger fonts, even for -#large screens, or you are targeting running on a high-res small screen." -# echo -n "Press ENTER key for '${DPIVALUE}' dpi: " -# read dpisizeflag -# if [ "$dpisizeflag" ];then -# sed -i -e 's%^Xft\.dpi:.*%Xft.dpi: 96%' rootfs-complete/root/.Xresources -# fi -#fi -DPINEXT1=`expr $DPIVALUE + 6` -DPINEXT2=`expr $DPINEXT1 + 6` -echo "To accept this size, just press ENTER key." -echo "However, if you would like fonts to display bigger on the screen, type in + DPINEXT1=`expr $DPIVALUE + 6` + DPINEXT2=`expr $DPINEXT1 + 6` + echo "To accept this size, just press ENTER key." + echo "However, if you would like fonts to display bigger on the screen, type in a value now. The value should be in steps of 6, for example ${DPINEXT1} or ${DPINEXT2}. The default size is ${DPIVALUE}, you might try the next-up, ${DPINEXT1}." -echo -n "Press ENTER key for '${DPIVALUE}' dpi, or type a value: " -read dpisizeflag + echo -n "Press ENTER key for '${DPIVALUE}' dpi, or type a value: " + read dpisizeflag +fi if [ "$dpisizeflag" ];then #130512 scsijon: fix size... fsPTN='s%^Xft\.dpi:.*%Xft.dpi: '"${dpisizeflag}%" sed -i -e "$fsPTN" rootfs-complete/root/.Xresources - echo "...ok, now ${dpisizeflag}" + echo "...ok, dpi now ${dpisizeflag}" fi #130226 wary: /usr/bin/X was missing... diff --git a/woof-code/support/choose_themes b/woof-code/support/choose_themes index 58cfc9d1487..a7db614595a 100755 --- a/woof-code/support/choose_themes +++ b/woof-code/support/choose_themes @@ -1,33 +1,59 @@ #!/bin/sh #called from 3builddistro +#141204 now have file 'default-theme' (see 3builddistro). -BI_ITEMS="" +BI_ITEMS=""; DEFITEM="" +if [ "$DEFAULT_THEME_WALLPAPER" ];then #141204 + DEFITEM="$(echo -n "$DEFAULT_THEME_WALLPAPER" | cut -f 2 -d ':')" + [ -f rootfs-complete/usr/share/backgrounds/${DEFITEM} ] && BI_ITEMS="${DEFITEM}" +fi for ONEITEM in `ls -1 rootfs-complete/usr/share/backgrounds | tr '\n' ' '` do + [ "$ONEITEM" == "$DEFITEM" ] && continue #141204 BI_ITEMS="${BI_ITEMS}${ONEITEM}" done -GT_ITEMS="" +GT_ITEMS=""; DEFITEM="" +if [ "$DEFAULT_THEME_GTK2" ];then #141204 + DEFITEM="$(echo -n "$DEFAULT_THEME_GTK2" | cut -f 2 -d ':')" + [ -d rootfs-complete/usr/share/themes/${DEFITEM}/gtk-2.0 ] && GT_ITEMS="${DEFITEM}" +fi for ONEITEM in `ls -1 rootfs-complete/usr/share/themes/*/gtk-2.0 | grep '^rootfs-complete/usr/share/themes' | cut -f 5 -d '/'` do + [ "$ONEITEM" == "$DEFITEM" ] && continue #141204 GT_ITEMS="${GT_ITEMS}${ONEITEM}" done -DI_ITEMS="" +DI_ITEMS=""; DEFITEM="" +if [ "$DEFAULT_THEME_DESK_ICONS" ];then #141204 + DEFITEM="$(echo -n "$DEFAULT_THEME_DESK_ICONS" | cut -f 2 -d ':')" + [ "$DEFITEM" ] && [ -d rootfs-complete/usr/local/lib/X11/themes/${DEFITEM} ] && DI_ITEMS="${DEFITEM}" +fi for ONEITEM in `find rootfs-complete/usr/local/lib/X11/themes -maxdepth 1 -mindepth 1 -type d | rev | cut -f 1 -d '/' | rev` do + [ "$ONEITEM" == "$DEFITEM" ] && continue #141204 DI_ITEMS="${DI_ITEMS}${ONEITEM}" done -JT_ITEMS="" -for ONEITEM in `ls -1 rootfs-complete/root/.jwm/themes/*-jwmrc | rev | cut -f 1 -d '/' | cut -f 2-9 -d '-' | rev` +JT_ITEMS=""; DEFITEM="" +if [ "$DEFAULT_THEME_JWM" ];then #141204 + DEFITEM="$(echo -n "$DEFAULT_THEME_JWM" | cut -f 2 -d ':')" + [ -f rootfs-complete/root/.jwm/themes/${DEFITEM}-jwmrc ] && JT_ITEMS="${DEFITEM}" +fi +for ONEITEM in `ls -1 rootfs-complete/root/.jwm/themes/*-jwmrc | rev | cut -f 1 -d '/' | cut -f 2-99 -d '-' | rev` do + [ "$ONEITEM" == "$DEFITEM" ] && continue #141204 JT_ITEMS="${JT_ITEMS}${ONEITEM}" done -OB_ITEMS="" +OB_ITEMS=""; DEFITEM="" +if [ "$DEFAULT_THEME_OPENBOX" ];then #141204 + DEFITEM="$(echo -n "$DEFAULT_THEME_OPENBOX" | cut -f 2 -d ':')" + [ "$DEFITEM" ] && [ -d rootfs-complete/usr/share/themes/${DEFITEM}/openbox-3 ] && OB_ITEMS="${DEFITEM}" +fi for ONEITEM in `ls -1 rootfs-complete/usr/share/themes | tr '\n' ' '` do + [ "$ONEITEM" == "$DEFITEM" ] && continue #141204 [ ! -e rootfs-complete/usr/share/themes/${ONEITEM}/openbox-3 ] && continue OB_ITEMS="${OB_ITEMS}${ONEITEM}" done