#!/bin/zsh

# wminfo plugin: top CPU usage related command output

# command: wminfo -p conky.top.wmi -u 3 -b#000000 -f#ff0000

#
# CONFIGURATION SECTION BEGINS HERE
#

Round_Down="off"

#
# CONFIGURATION SECTION ENDS HERE
#

datafile="$HOME/.wminfo/conky.tmp"
label="TOP"

if [ -z "$(grep "^${label}: " "${datafile}")" ]
then
cat <<EOF
$0: no "${label}" entries were found in ${datafile} file.
         
         
         
         
EOF
    exit
fi

top=`grep "^${label}: " $datafile`

top=${top//${label}:  /}

if [ "$Round_Down" = "on" ]
then
    top=${top//.?? / }   #   0 X
else
    top=${top//[0-9] / } # 0.0 X
fi

echo -e $top
echo

