#!/bin/zsh

PICK=`fc-list | sort |dmenu -i -l 25 -fn mOsOul -p Font`
SIZE=`echo 10,12,14,16,9,8,72 | sed s/,/\\\n/g | dmenu -p Size -fn mOsOul-16 -sb orange -sf navy`
if [ "$PICK" ]; then
 FONT=`echo $PICK | cut -d: -f2 | sed -e "s/^ /xft:/"`

 COLORS=('dodgerblue' 'chartreuse' 'aliceblue' 'forestgreen' 'burlywood' 'dark goldenrod' 'indian red' 'firebrick' 'Gainsboro' 'Misty Rose' 'Peach Puff' 'Seashell' 'Slate Gray' 'Tan' 'Tomato')
 DACOLN=$(( $RANDOM % ${#COLORS} ))
 FADECOLN=$(( $RANDOM % ${#COLORS} ))
 DACOL=${COLORS[$DACOLN]}
 FADECOLOR=${COLORS[$FADECOLN]}
 DAFADE=$(( $RANDOM % 25 ))
 DAFADE=$(( $DAFADE + 25 ))
 DASHADE=$(( $RANDOM % 50 ))

 urxvtc -bc -rv -tr -sb +sr -g 80x42 -tint "$DACOL" -fade "$DAFADE" \
        -fadecolor "$FADECOLOR" -tn xterm-256color -cr green -sh "$DASHADE" \
        -fn "$FONT-$SIZE"
 # you should check for the error code and rerun if urxvtd is not running.
fi

