#!/bin/sh

speaker_muted=πŸ”‡
speaker_low=πŸ”ˆ
speaker_medium=πŸ”‰
speaker_high=πŸ”Š
brightness_symbol=πŸ”…

DELAY=1m
# Statusbar loop

while true; do
	mbsync -a
	sleep $DELAY
done &

while true; do
	mail
	volume=$(amixer sget Master | awk -F"[][]" 'END{ print $2 }')
	volume_amount=$(printf $volume | tr -d %)
	if [ $volume_amount = 0 ]; then
		volume_symbol=$speaker_muted
	elif [ $volume_amount -lt 30 ]; then
		volume_symbol=$speaker_low
	elif [ $volume_amount -lt 70 ]; then
		volume_symbol=$speaker_medium
	else 
		volume_symbol=$speaker_high
	fi

	xsetroot -name "πŸ“§Messages $(find ~/Mail -path '*/INBOX/new' -type f | wc -l) |
		$volume_symbol$volume  |  $(date +"%c")"
   sleep $DELAY
done