Overclock.net - An Overclocking Community - View Single Post - Share your Config files!!!
View Single Post
post #9 of (permalink) Old 03-29-2012, 11:20 PM
Auroq
New to Overclock.net
 
Auroq's Avatar
 
Join Date: Aug 2008
Location: Utah
Posts: 68
Rep: 7 (Unique: 7)
Just bought a 120GB Patriot Pyro SE and reinstalled everything, so here's my new setup:

338

First is the script for my battery info: batstat (Click to show)
Code:
#!/bin/bash
function get_color {
        if [ "$1" -gt 39 ]; then
                echo '${color Forestgreen}'
        elif [ "$1" -gt 25 ]; then
                echo '${color Yellow}'
        elif [ "$1" -gt 9 ]; then
                echo '${color Firebrick}'
        else
                echo '${color Red3}'
        fi
}

BAT=$(acpi)
BAT=${BAT:11}
count=0
notfull=false
for i in $BAT; do
        if [ "$count" == 0 ]
        then
                status=$i
        elif [ "$count" == 1 ]
        then
                perc=$i
        else
                timestat=$timestat" "$i
                notfull=true
        fi
        count=$(expr $count + 1)
done
status=${status:0: (-1)}
if [ "$notfull" == "true" ]; then
        perc=${perc:0: (-2)}
else
        perc=${perc:0: (-1)}
fi
case $1 in
        "status")
                echo $status
                ;;
        "percent")
                echo $perc
                ;;
        "timestat")
                echo $timestat
                ;;
        "color")
                echo $(get_color $perc)
                ;;
        *)
                ;;
esac

Next script loops through all my git repositories and returns their status. checkgit (Click to show)
Code:
#!/bin/bash
function file_to_array()
{
        old_IFS=$IFS
        IFS=$'\n'
        lines=($(cat $1)) # array
        IFS=$old_IFS
        echo ${lines[@]}
}
function get_length()
{
        echo $1 > ~/.conky/logs/word.tmp
        count=0
        while IFS= read -r -n1 char; do
                count=$(expr $count + 1)
        done < ~/.conky/logs/word.tmp
        echo $count
}

cd ~/workspaces/
FILES=$(pwd)/*
NUM=0
for i in $FILES; do
        cd $i
        if [ -d .git ]; then
                STAT=$(git status)
                name[$NUM]=$(basename $i)
                status[$NUM]=${STAT}
        fi
        NUM=$(expr $NUM + 1)
done
LAST=$(cat ~/.conky/logs/curgit.log)
CUR=$(expr $LAST + 1)
if [ "$CUR" == "$NUM" ]; then
        CUR=1
fi
status[$CUR]=${status[$CUR]:1}
cd ~/.conky/logs
echo ${status[$CUR]} > tmpstat1.tmp
sed 's/#/\\n\\# newline/g' tmpstat1.tmp > tmpstat2.tmp
sed 's/nothing added to commit but/\\n\\# newline nothing added to commit but/g' tmpstat2.tmp >tmpstat3.tmp

numlets=0
for i in $(cat tmpstat3.tmp); do
        if [ "$i" != "newline" ]; then
                finstats=$finstats$(echo " ")$i
        fi
        if [ "$numlets" -gt 25 ]; then
                finstats=$finstats$(echo "\n\\#\t")
                numlets=8
        elif [ "$i" != "newline" ]; then
                        numlets=$(expr $numlets + $(get_length $i))
        fi
done
echo $finstats > tmpstat4.tmp

sed 's/\\n\\#\\n\\#\\t \\n\\#/\\n\\#\\n\\#\\t/g' tmpstat4.tmp > tmpstat5.tmp

echo $CUR > ~/.conky/logs/curgit.log
echo '${font Arial:bold:size=8}''${color Tan3}'${name[$CUR]}
echo -e '$font${color Gray80}'$(cat tmpstat5.tmp)

This one just returns my external IP if I'm connected to the internet. exip (Click to show)
Code:
#!/bin/bash

#IP=$(wget -O - http://whatismyip.org/ | tail)
#IP=$(wget -O - -q icanhazip.com)
IP=$(curl headdetect.com)
if [ "$IP" ]; then
        echo $IP
else
        echo NA
fi

Next is the script to track my torrents in transmission. Credit for the original version of this script goes to 987poiuytrewq on the Ubuntu Forums. I just changed it around to make it easier to get individual variables from within the .conkyrc rather than parsing the script. transmission (Click to show)
Code:
#! /bin/bash

#trim torrent name to this many characters
trim=20

#more settings further down marked with ========================


#get listing of all torrent info from transmission
# NOTE: you need to install transmission-cli AND UNINSTALL transmission-daemon
alltorrents=$(transmission-remote -l | sed -n -e '$b' -e '2,$p')


n=$(echo "$alltorrents" | wc -l)


#parse output to get data
#DO NOT EDIT THIS BIT
TOT=0
for i in `seq $n`
do
        torrent[$i]=$(echo "$alltorrents" | sed -n ''$i'p' | sed 's/   */\//g')

        progress[$i]=$(echo ${torrent[$i]} | awk -F/ '{print $3}' | sed 's/%//')
        percent[$i]=$(echo 'scale=2; '${progress[$i]}'/100' | bc)
        have[$i]=$(echo  ${torrent[$i]} | awk -F/ '{print $4}')
        eta[$i]=$(echo ${torrent[$i]} | awk -F/ '{print $5}')
        up[$i]=$(echo ${torrent[$i]} | awk -F/ '{print $6}')
        down[$i]=$(echo ${torrent[$i]} | awk -F/ '{print $7}')
        ratio[$i]=$(echo ${torrent[$i]} | awk -F/ '{print $8}')
        status[$i]=$(echo ${torrent[$i]} | awk -F/ '{print $9}')
        name[$i]=$(echo ${torrent[$i]} | awk -F/ '{print $10}' )
        #trim and add ellipsis if too long
        if [ `echo ${name[$i]} | wc -m` -gt $trim ]
        then
                
                name[$i]=$(echo ${name[$i]} | cut -c -$trim)...
        fi
        TOT=$(expr $TOT + 1)
done

#convert status to symbols

#output data to conky, using standard conky formating

#some more settings=====================================================
#=======================================================================

#limit output to a certain number of torrents, all is a=$n first four is a=4 etc
a=$n

#progress bar length from right edge of conky
barlength=80

#change colours of listing depending on status and/or add icons
# icons are webding fonts eg pause symbol, down arrow etc
#CHANGE COLORS TO DESIRED OR COMMENT OUT IF NO COLORS WANTED
#movedown=$(echo '14*'$n | bc)
#echo '${voffset -'$movedown'}'
for i in `seq $a`
do
        case ${status[$i]} in
        "Idle")
                icon[$i]='${font Webdings};${font}' 
                color[$i]="B7B7B7"    
                ;;
        "Stopped")
                icon[$i]='${font Webdings}<${font}' 
                color[$i]="B7B7B7"    
                ;;
        "Up & Down")
                icon[$i]='${font Webdings}6${font}' 
                #color[$i]= 
                ;;
        "Downloading")
                icon[$i]='${font Webdings}6${font}' 
                #color[$i]=
                ;;
        "Seeding")
                icon[$i]='${font Webdings}5${font}'
                color[$i]='FFFFFF'
                ;;
        *)
                ;;
        esac
        #test to check we actually got some data back
        if [ -z "$alltorrents" ] 
        then
                #if not, print error message if you like, and exit
                #echo "Can't connect to transmission"
                exit
        fi
done
#===================================================================

        #EDIT THE FOLLOWING BIT TO CONTROL DATA SEEN IN CONKY
        #enclose conky commands with ' '
        #enclose variables from this script with " " or nothing
        #in form ${name[$i]} where $i refers to the torrent number
        #possible variables are:
        #       progress        number 1-100 how much downloaded eg "45"
        #       percent         same but 0-1 eg "0.45"
        #       have            amount downloaded as string  eg "4.1 GB"
        #       eta             estimated time of arrival as string eg "4 hrs"
        #       up              transfer rate up in KB/s eg "21.1"
        #       down            transfer rate down in KB/s eg "21.1"
        #       ratio           transfer ratio for torrent eg "0.88"
        #       status          eg "Downloading"
        #       icon            a small icon indicating status (see above 
        #                       section)
        #       color           color depending on status (see above section)
        #                       eg "FF88AA" NB: must use exactly the format:
        #                       '${color '${color[$i]}'}' to apply the color to 
        #                       a stretch of text, and remember to end it with
        #                       '${color}'
        #       to draw the progress bar, use the exact command (incl single
        #       quotes) '${execbar echo '${percent[%i]'}' and control the
        #       length with '${alignr '$barlength'}' where barlength defined above

if [ $2 ]; then
        NUM=$2
else
        NUM=1   
fi
if [ "$TOT" -lt  "$NUM" ]; then
        exists=false
else
        exists=true
fi
        case $1 in
                "name")
                        echo ${name[$NUM]}
                        ;;
                "progress")
                        echo ${progress[$NUM]}
                        ;;
                "percent")
                        echo ${percent[$NUM]}
                        ;;
                "have")
                        echo ${have[$NUM]}
                        ;;
                "eta")
                        echo ${eta[$NUM]}
                        ;;
                "up")
                        echo ${up[$NUM]}
                        ;;
                "down")
                        echo ${down[$NUM]}
                        ;;
                "ratio")
                        echo ${ratio[$NUM]}
                        ;;
                "status")
                        echo ${status[$NUM]}
                        ;;
                "icon")
                        echo ${icon[$NUM]}
                        ;;
                "color")
                        echo ${color[$NUM]}
                        ;;
                "exists")
                        echo ${exists}          
                        ;;
                *)
                        ;;
        esac

And finally the .conkyrc's
First is the bar on the left: .conkyrcl (Click to show)
Code:
background no
use_xft yes
xftfont 123:size=8
xftalpha 0.1
update_interval 0.7
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 300 0
maximum_width 250
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color gray
default_shade_color red
default_outline_color green
alignment tl
gap_x 0
gap_y 0
no_buffers no
uppercase no
cpu_avg_samples 2
net_avg_samples 1
override_utf8_locale yes
use_spacer none
text_buffer_size 1024

TEXT
#                                               ###HEADER###
${font openlogos:size=25}${color Lightblue}B${font Sega Logo Font:size=20}${color Darkorange1}$alignc${exec echo $USER}${color Lightblue}${font openlogos:size=30}${color gray80}$alignr t
${voffset -65}
#                                               ###SYSTEM###
${font Arial:bold:size=10}${color mintcream}$alignc SYSTEM 
$font${color gray80}$sysname $kernel $alignr $machine
Intel Core i7-2630QM$alignr${freq_g cpu0}Ghz
Uptime $alignr${uptime}
File System $alignr${fs_type}

#                                               ###GRAPHICS###
${font Arial:bold:size=10}${color mintcream}$alignc GRAPHICS
$font${color gray80}Temperature${if_match ${nvidia temp} < 95}${color Forestgreen}${else}${color red3}${endif}${alignr}${nvidia temp}°C / ${nvidia threshold}°C
$font${color gray80}Frequency ${alignr}${nvidia gpufreq}MHz
Memory Frequency ${alignr}${nvidia memfreq}MHz

#                                               ###SSD/HDD###
${font Arial:bold:size=10}${color mintcream}$alignc SSD/HDD
#                                                       #root#
${font Arial:bold:size=8}${color Tan3}/root
$font${color gray80}Read / Write${alignr}${diskio_read /dev/sda5} / ${diskio_write /dev/sda5}
$font${fs_used /root} / ${fs_size /root} ${if_match "${fs_used_perc /root}" > "75"}${color Firebrick}${else}${color ForestGreen}${endif}$alignr ${fs_free_perc /root}% free
${fs_bar /root}
#                                                       #home#
${font Arial:bold:size=8}${color Tan3}/home
$font${color gray80}Read / Write${alignr}${diskio_read /dev/sda6} / ${diskio_write /dev/sda6}
$font${fs_used /home} / ${fs_size /home} ${if_match ${fs_used_perc /home} > 75}${color Firebrick}${else}${color ForestGreen}${endif} $alignr ${fs_free_perc /home}% free
${fs_bar /home}
#                                                       #data#
${font Arial:bold:size=8}${color Tan3}/data
$font${color gray80}Read / Write${alignr}${diskio_read /dev/sdb5} / ${diskio_write /dev/sdb5}
$font${fs_used /data} / ${fs_size /data} ${if_match "${fs_used_perc /data}" > "75"}${color Firebrick}${else}${color ForestGreen}${endif}$alignr ${fs_free_perc /data}% free
${fs_bar /data}

#                                               ###GIT REPOS###
${font Arial:bold:size=10}${color mintcream}$alignc GIT REPOSITORIES$font${color gray80}
${execpi 3 ~/.conky/checkgit | fold -w60}

#                                               ###TRANSMISSION###
#                                                       #Torrent 1#
${if_match "${exec ~/.conky/transmission exists}" == "true"}${font Arial:bold:size=10}${color mintcream}$alignc Transmission$font${color gray80}
${font Arial:bold:size=8}${color Tan3}${exec ~/.conky/transmission name}$font${color gray80}${alignr}${exec ~/.conky/transmission progress}% 
${exec ~/.conky/transmission status}${alignr}${exec ~/.conky/transmission eta}
${if_match "${exec ~/.conky/transmission status}" == "Downloading"}${color Forestgreen}${endif}${execbar ~/.conky/transmission progress}
${color gray80}Down${alignr}${exec ~/.conky/transmission down}
Up${alignr}${exec ~/.conky/transmission up}
${endif}
#                                                       #Torrent 2#
${if_match "${exec ~/.conky/transmission exists 2}" == "true"}${font Arial:bold:size=8}${color Tan3}${exec ~/.conky/transmission name 2}$font${color gray80}${alignr}${exec ~/.conky/transmission progress 2}% 
${exec ~/.conky/transmission status 2}${alignr}${exec ~/.conky/transmission eta 2}
${if_match "${exec ~/.conky/transmission status 2}" == "Downloading"}${color Forestgreen}${endif}${execbar ~/.conky/transmission progress 2}
${color gray80}Down${alignr}${exec ~/.conky/transmission down 2}
Up${alignr}${exec ~/.conky/transmission up 2}
${endif}
#                                                       #Torrent 3#
${if_match "${exec ~/.conky/transmission exists 3}" == "true"}${font Arial:bold:size=8}${color Tan3}${exec ~/.conky/transmission name 3}$font${color gray80}${alignr}${exec ~/.conky/transmission progress 3}% 
${exec ~/.conky/transmission status 3}${alignr}${exec ~/.conky/transmission eta 3}
${if_match "${exec ~/.conky/transmission status 3}" == "Downloading"}${color Forestgreen}${endif}${execbar ~/.conky/transmission progress 3}
${color gray80}Down${alignr}${exec ~/.conky/transmission down 3}
Up${alignr}${exec ~/.conky/transmission up 3}
${endif}

Then the bar on the right: .conkyrcr (Click to show)
Code:
background no
use_xft yes
xftfont 123:size=8
xftalpha 0.1
update_interval 0.7
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 300 0
maximum_width 250
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color gray
default_shade_color red
default_outline_color green
alignment tr
gap_x 00
gap_y 0
no_buffers no
uppercase no
cpu_avg_samples 3
net_avg_samples 2
diskio_avg_samples 3
override_utf8_locale yes
use_spacer none
text_buffer_size 1024
extra_newline
if_up_strictness address

TEXT
#                                               ###CLOCK###
${color Tan2} ${font :size=30}$alignc${time %H:%M}
${voffset -30}${font :bold:size=10}$alignc${time %d %b. %Y}
${font :bold:size=8}$alignc${time %A}

#                                               ###CPU BARS###
${font Arial:bold:size=10}${color mintcream}${alignc}PROCESSORS 
$font${color Red3}CPU1  ${cpu cpu1}% ${if_match ${cpu cpu1} < 10}  ${endif}${cpubar cpu1}
$font${color Red3}CPU2  ${cpu cpu2}% ${if_match ${cpu cpu2} < 10}  ${endif}${cpubar cpu2}
$font${color Orangered3}CPU3  ${cpu cpu3}% ${if_match ${cpu cpu3} < 10}  ${endif}${cpubar cpu3}
$font${color Orangered3}CPU4  ${cpu cpu4}% ${if_match ${cpu cpu4} < 10}  ${endif}${cpubar cpu4}
$font${color Darkorange3}CPU5  ${cpu cpu5}% ${if_match ${cpu cpu5} < 10}  ${endif}${cpubar cpu5}
$font${color Darkorange3}CPU6  ${cpu cpu6}% ${if_match ${cpu cpu6} < 10}  ${endif}${cpubar cpur6}
$font${color Goldenrod3}CPU7  ${cpu cpu7}% ${if_match ${cpu cpu7} < 10}  ${endif}${cpubar cpu7}
$font${color Goldenrod3}CPU8  ${cpu cpu8}% ${if_match ${cpu cpu8} < 10}  ${endif}${cpubar cpu8}

#                                               ###MEMORY BARS###
${font Arial:bold:size=10}${color mintcream}${alignc}MEMORY 
$font${if_match $memperc > 74}${color Firebrick}${else}${color Forestgreen}${endif}MEM $alignc $mem / $memmax $alignr $memperc%
$membar
$font${if_match $swapperc > 74}${color Firebrick}${else}${color Forestgreen}${endif}SWAP $alignc $swap / $swapmax $alignr $swapperc%
$swapbar

#                                               ###TOP PROCESSESS###
${font Arial:bold:size=10}${color mintcream}${alignc}TOP PROCESSES 
#                                                       #by CPU#
${font Arial:bold:size=8}${color snow3}CPU
$font${color Red3}${top name 1}${alignr}${top cpu 1} %
$font${color Orangered3}${top name 2}${alignr}${top cpu 2} %
$font${color Darkorange3}${top name 3}${alignr}${top cpu 3} %
$font${color Goldenrod3}${top name 4}${alignr}${top cpu 4} %
$font${color Yellow3}${top name 5}${alignr}${top cpu 5} %

#                                                       #by memory#
${font Arial:bold:size=8}${color snow3}MEMORY
$font${color Red3}${top_mem name 1}${alignr}${top mem 1} %
$font${color Orangered3}${top_mem name 2}${alignr}${top mem 2} %
$font${color DarkOrange3}${top_mem name 3}${alignr}${top mem 3} %
$font${color Goldenrod3}${top_mem name 4}${alignr}${top mem 4} %
$font${color Yellow3}${top_mem name 5}${alignr}${top mem 5} %

#                                               ###NETWORK###
${font Arial:bold:size=10}${color mintcream}${alignc}NETWORK 
#                                                       #Wireless#
${font Arial:bold:size=8}${color snow3}WIRELESS
${if_match "${addr wlan0}" == "No Address"}$font${color antiquewhite4}${else}$font${color Forestgreen}${endif}Connectivity ${wireless_link_bar wlan0}
SSID${alignr}${wireless_essid wlan0}
IP on wlan0 $alignr ${addr wlan0}
Mac Address${alignr}${wireless_ap wlan0}
External IP$alignr${if_up wlan0}${execi 600 ~/.conky/exip}${else}NA${endif}
Bitrate${alignr}${wireless_bitrate wlan0}
Down $alignr ${downspeed wlan0}
Up $alignr ${upspeed wlan0}
Downloaded: $alignr  ${totaldown wlan0}
Uploaded: $alignr  ${totalup wlan0}

#                                                       #Wired#
${font Arial:bold:size=8}${color snow3}WIRED
${if_match "${addr eth0}" == "No Address"}$font${color antiquewhite4}${else}$font${color Forestgreen}${endif}IP on eth0 $alignr ${addr eth0}
External IP$alignr${if_up eth0}${execi 600 ~/.conky/exip}${else}NA${endif}
Down $alignr ${downspeed eth0}
Up $alignr ${upspeed eth0}
Downloaded: $alignr  ${totaldown eth0}
Uploaded: $alignr  ${totalup eth0}

#                                               ###BATTERY###
${if_match "${exec acpi}" != ""}${font Arial:bold:size=10}${color mintcream}${alignc}Battery
$font${execp ~/.conky/batstat color}${exec ~/.conky/batstat status} ${exec ~/.conky/batstat percent}%${alignr}${execi 10 ~/.conky/batstat timestat}
${battery_bar BAT0}${else}$alignc${font Arial:bold:size=9}${color antiquewhite2}No Battery Present
${endif}

Lastly the startup script that runs on startup: startconky.sh (Click to show)
Code:
#!/bin/bash
conky -d -c ~/.conky/.conkyrcl
conky -d -c ~/.conky/.conkyrcr

Note: All the scripts should be made executable and placed in a .conky folder in the home directory along with the .conkyrc's.

-Auroq
Auroq is offline