dotfiles-old/.config/bemenu/bemenu-colorgen.sh

41 lines
814 B
Bash
Raw Normal View History

2022-03-10 03:42:22 +00:00
#!/bin/sh
BEMENUOPTS_FILE="$HOME/.config/bemenu/bemenu_opts.sh"
HEIGHT="22" #height in pixels to make the bemenu prompt
! [ -f "$1" ] && echo "input base16 color file for first argument." && exit
NB=""
NF=""
HB=""
HF=""
SB=""
SF=""
TB=""
TF=""
FB=""
FF="#ffffff"
IFS='
'
COUNT=0
for LINE in $(cat "$1")
do
case $COUNT in
0) NB="$LINE" && HB="$LINE" && TB="$LINE" && FB="$LINE";;
1) SB="$LINE";;
6) HF="$LINE" && SF="$LINE";;
10) NF="$LINE" && TF="$LINE";;
esac
COUNT=$((COUNT + 1))
done
echo "bemenu colors updated."
echo "#!/bin/sh" > "$BEMENUOPTS_FILE"
echo "#generated from: $1" >> "$BEMENUOPTS_FILE"
echo "export BEMENU_OPTS=\"-H $HEIGHT --nb $NB --nf $NF --hb $HB --hf $HF --sb $SB --sf $SF --tb $TB --tf $TF --fb $FB --ff $FF\"" >> "$BEMENUOPTS_FILE"