123456789101112131415161718192021222324252627282930313233343536373839 |
- #! /bin/bash
- SEP="|"
- # If we're in a cron job, we need to set up an environment,
- # and if we're not in a cron job, the variable $- will contain the letter "i".
- [[ $- == *i* ]] || {
- PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$HOME/bin
- }
- convert_percent_to_bar() {
- nboxes=10
- filled=$(echo "($1+5)/$nboxes" | bc)
- unfilled=$(echo $nboxes-$filled | bc)
- echo -n $(yes ■ | head -$filled | tr '\n' ' ' | sed 's/ //g')
- echo -n $(yes □ | head -$unfilled | tr '\n' ' ' | sed 's/ //g')
- }
- register=()
- xsetrootd="$HOME"/xsetroot.d
- for f in "${xsetrootd}"/*; do
- . "$f"
- done
- while true; do
- nfuns=${#register[*]}
- statusline=""
- if (( nfuns != 0 )); then
- statusline="$(${register[0]})"
- fi
- if (( nfuns > 1 )); then
- for fn in ${register[@]/${register[0]}}; do
- statusline+="${SEP}$($fn)"
- done
- fi
- xsetroot -name "$statusline"
- sleep 1
- done
|