Skip to content

Commit

Permalink
Support for default theme. From BK's patch
Browse files Browse the repository at this point in the history
  • Loading branch information
mavrothal committed Dec 6, 2014
1 parent 3ac363a commit 09a975a
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 52 deletions.
50 changes: 27 additions & 23 deletions woof-code/3builddistro
Expand Up @@ -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.
Expand Down Expand Up @@ -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...
Expand Down
50 changes: 27 additions & 23 deletions woof-code/3builddistro-Z
Expand Up @@ -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.
Expand Down Expand Up @@ -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...
Expand Down
38 changes: 32 additions & 6 deletions 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="<item>${DEFITEM}</item>"
fi
for ONEITEM in `ls -1 rootfs-complete/usr/share/backgrounds | tr '\n' ' '`
do
[ "$ONEITEM" == "$DEFITEM" ] && continue #141204
BI_ITEMS="${BI_ITEMS}<item>${ONEITEM}</item>"
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="<item>${DEFITEM}</item>"
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}<item>${ONEITEM}</item>"
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="<item>${DEFITEM}</item>"
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}<item>${ONEITEM}</item>"
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="<item>${DEFITEM}</item>"
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}<item>${ONEITEM}</item>"
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="<item>${DEFITEM}</item>"
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}<item>${ONEITEM}</item>"
done
Expand Down

0 comments on commit 09a975a

Please sign in to comment.