--- /dev/null
+#!/bin/bash
+###############################################################################
+#
+# localHelper.sh
+# Conky local system stats helper
+#
+###############################################################################
+
+# Required for unread mail count and todo list
+# Requires Thunderbird add-on "Unread Count 0.0.3"
+# Requires Thunderbird add-on "Lightning" for todo list
+
+THUNDERBIRD_PROFILE=""
+
+#ICAL_URL=""
+
+# For weather forecast
+# App ID is for OpenWeatherMap.org
+LOCATION=""
+APPID=""
+
+###############################################################################
+## DATA FETCH FUNCTIONS ##
+###############################################################################
+function printVol
+{
+ pct=`amixer sget Master | tail -1 | sed 's/.*\[\([0-9]*\)%.*/\1/g'`
+ len=$1
+ scaled=`expr $pct \* $len / 100`
+
+ retval="|"
+ i=0
+ while [ $i -lt $len ]; do
+ if [ $i -lt $scaled ]; then
+ retval="$retval|"
+ else
+ retval="$retval-"
+ fi
+ i=`expr $i + 1`
+ done
+ retval="$retval|"
+ echo $retval
+}
+
+function printBrightness
+{
+ pct=`cat /sys/class/backlight/*/brightness`
+ len=$1
+ scaled=`expr $pct \* $len / 10`
+
+ retval="|"
+ i=0
+ while [ $i -lt $len ]; do
+ if [ $i -lt $scaled ]; then
+ retval="$retval|"
+ else
+ retval="$retval-"
+ fi
+ i=`expr $i + 1`
+ done
+ retval="$retval|"
+ echo $retval
+}
+
+function mailCounts
+{
+ cat $THUNDERBIRD_PROFILE/unread-counts | cut -d'@' -f1 | \
+ awk -F':' '{print $2":\t"$1}' | grep -v "Local Folders" | sort
+}
+
+function todo
+{
+ if [ $THUNDERBIRD_PROFILE ]; then
+ sqlite3 $THUNDERBIRD_PROFILE/calendar-data/local.sqlite \
+ "SELECT title FROM cal_todos \
+ WHERE ical_status != 'COMPLETED' OR ical_status IS NULL \
+ ORDER BY privacy DESC,todo_due DESC;"
+ fi
+ if [ $ICAL_URL ]; then
+ wget --no-check-certificate -O .ical "$ICAL_URL" 2>/dev/null
+ awk '/BEGIN:/ { type=$0 } \
+ /SUMMARY:/ { if(type == "BEGIN:VTODO") { print $0 }}' .ical | cut -d':' -f2-
+ fi
+}
+
+function weather
+{
+ if [ -f .forecast ]; then
+ lastupdate="`stat .forecast | grep -i modify | cut -d':' -f2-`"
+ lastupdatesec=`date +%s -d"$lastupdate"`
+ currentsec=`date +%s`
+ else
+ currentsec=500
+ lastupdatesec=0
+ fi
+ if [ `expr $currentsec - $lastupdatesec` -gt 300 ]; then
+ curl --connect-timeout 20 "http://api.openweathermap.org/data/2.5/forecast/daily?APPID=$APPID&q=$LOCATION&mode=xml&units=imperial&cnt=5" > .forecast 2>/dev/null
+
+ # If we can't connect, we'll keep using the old forecast.
+ if [ $? -ne 0 ]; then
+ paste -d'|' .dates .precipitation .temperature .clouds
+ fi
+
+ cat .forecast | sed "s/>/>\n/g" | awk -v FS='"' '/time day=/{print $2}' > .dates
+ cat .forecast | sed "s/>/>\n/g" | awk -v FS='"' '/<precipitation/{print $8}' > .precipitation
+ cat .forecast | sed "s/>/>\n/g" | awk -v FS='"' -v OFS='|' '/<temperature/{print $12,$2,$10}' > .temperature
+ cat .forecast | sed "s/>/>\n/g" | awk -v FS='"' '/<clouds/{print $2}' > .clouds
+ echo -n > .days
+ for date in `cat .dates`; do echo `date +%A -d"$date"` >> .days; done
+ fi
+
+ paste -d'|' .days .precipitation .temperature .clouds
+}
+
+function batteryalert
+{
+ if [ ! -e /tmp/batalert ]; then
+ touch /tmp/batalert
+ fi
+ pct="`upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -i "percentage" | sed 's/[^0-9]//g'`"
+ if [ $pct -lt 60 ]; then
+ if [ "`find /tmp/batalert -mmin +5 | wc -l`" -gt 0 ]; then
+ espeak --stdout -s90 -k18 -a200 -v female5 "Low Battery" | \
+ play -t wav - chorus 0.4 0.8 20 0.5 0.10 2 -t \
+ echo 0.9 0.8 33 0.9 \
+ echo 0.7 0.7 10 0.2 \
+ echo 0.9 0.2 55 0.5 \
+ gain 8
+ touch /tmp/batalert
+ fi
+ fi
+}
+
+###############################################################################
+## BEGIN MAIN SCRIPT ##
+###############################################################################
+
+USAGE="USAGE: localHelper.sh <volMeter|brightnessMeter|mailCounts|weather>"
+
+if [ -z $1 ]; then
+ echo $USAGE
+ exit
+fi
+
+case $1 in
+ "volMeter")
+ printVol $2
+ ;;
+ "brightnessMeter")
+ printBrightness $2
+ ;;
+ "mailCounts")
+ mailCounts
+ ;;
+ "todo")
+ todo
+ ;;
+ "weather")
+ weather
+ batteryalert
+ ;;
+esac
--- /dev/null
+conky.config = {
+ alignment = 'top_right',
+ background = false,
+ border_width = 0,
+ cpu_avg_samples = 2,
+ default_color = 'white',
+ default_outline_color = 'white',
+ default_shade_color = 'black',
+ draw_borders = true,
+ draw_graph_borders = true,
+ draw_outline = false,
+ draw_shades = true,
+ use_xft = true,
+ font = 'Audiowide:size=16',
+ gap_x = 0,
+ gap_y = 0,
+ minimum_height = 2160,
+ minimum_width = 800,
+ net_avg_samples = 2,
+ no_buffers = false,
+ double_buffer = true,
+ out_to_console = false,
+ out_to_stderr = false,
+ extra_newline = false,
+ own_window = true,
+ own_window_class = 'Conky',
+ own_window_type = 'desktop',
+ own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
+ own_window_argb_visual = true,
+ own_window_argb_value = 0,
+ own_window_transparent = true,
+ stippled_borders = 0,
+ update_interval = 5.0,
+ uppercase = false,
+ use_spacer = 'none',
+ show_graph_scale = false,
+ show_graph_range = false,
+ xinerama_head = 0
+}
+
+conky.text = [[
+
+### PERSONAL SECTION
+# Clock
+${voffset -50}${color 910}${font Sedan SC:size=96:style=bold}${time %H:%M}
+${voffset -215}${offset 90}${font Sedan SC:size=20:style=bold}${time %Y-%m-%d}
+#
+# Weather
+${voffset -160}${font Audiowide:size=12}
+${offset 400}${exec ~/bin/conkyHelper.sh weather | awk -v FS='|' '{print $1" "$2 " & " $6"\n"$3"° - "$4"° - "$5"°"}' | head -1}
+${offset 450}${exec ~/bin/conkyHelper.sh weather | awk -v FS='|' '{print $1" "$2 " & " $6"\n"$3"° - "$4"° - "$5"°"}' | head -2 | tail -1}
+${voffset 5}
+${offset 400}${exec ~/bin/conkyHelper.sh weather | awk -v FS='|' '{print $1" "$2 " & " $6"\n"$3"° - "$4"° - "$5"°"}' | head -3 | tail -1}
+${offset 450}${exec ~/bin/conkyHelper.sh weather | awk -v FS='|' '{print $1" "$2 " & " $6"\n"$3"° - "$4"° - "$5"°"}' | head -4 | tail -1}
+${voffset 5}
+${offset 400}${exec ~/bin/conkyHelper.sh weather | awk -v FS='|' '{print $1" "$2 " & " $6"\n"$3"° - "$4"° - "$5"°"}' | head -5 | tail -1}
+${offset 450}${exec ~/bin/conkyHelper.sh weather | awk -v FS='|' '{print $1" "$2 " & " $6"\n"$3"° - "$4"° - "$5"°"}' | head -6 | tail -1}
+
+#
+# Email
+${voffset -140}
+UNREAD MAIL:
+${exec ~/bin/conkyHelper.sh mailCounts | grep -v "spam" | grep -v "[^0-9]0$" | awk -v RS="@" -v FS="\n" '{for(i=1; i<8; i++) {print $i}}'}
+#
+
+
+### SYSTEM SECTION
+${voffset 525}
+${font Audiowide:size=16}
+${offset 85}$nodename${offset 32}$uptime
+${offset 85}${battery_bar 16,160 BAT0}
+${font Audiowide:size=10:bold}${voffset -44}${offset 105}${color black}${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep "time to empty" | cut -d':' -f2 | sed 's/^ *//g'}
+${offset 275}${voffset -24}${color 910}${font Audiowide:size=10}\
+Volume: ${exec amixer -c 0 get Master | grep Mono: | cut -d " " -f6 | sed 's/[^0-9]//g'}%
+${offset 450}${voffset -24}Brightness: ${exec cat /sys/class/backlight/acpi_video0/brightness}0%
+
+# CPU data
+${voffset -10}${color 910}${cpugraph cpu0 150,400 #FF1015 #10FF15 1 -l}
+${voffset -180}
+${offset 430}${font Audiowide:size=16}${cpu cpu4}${font Audiowide:size=16}${voffset -4} %
+${offset 430}${font Audiowide:size=16}${cpu cpu3}${font Audiowide:size=16}${voffset -4} %
+${offset 430}${font Audiowide:size=16}${cpu cpu2}${font Audiowide:size=16}${voffset -4} %
+${offset 430}${font Audiowide:size=16}${cpu cpu1}${font Audiowide:size=16}${voffset -4} %
+${voffset -175}
+${offset 530}${font Audiowide:size=16}${freq_g 4}${font Audiowide:size=16}${voffset -4} GHz
+${offset 530}${font Audiowide:size=16}${freq_g 3}${font Audiowide:size=16}${voffset -4} GHz
+${offset 530}${font Audiowide:size=16}${freq_g 2}${font Audiowide:size=16}${voffset -4} GHz
+${offset 530}${font Audiowide:size=16}${freq_g 1}${font Audiowide:size=16}${voffset -4} GHz
+${voffset -150}${offset 10}${font Audiowide:size=24}${acpitemp}°
+
+# MEM data
+${voffset 75}${memgraph 150,400 #FF1015 #10FF15 1}
+${voffset -250}
+${offset 410}${font Audiowide:size=16}${font Audiowide:size=14}MEM: \
+${font Audiowide:size=20}${voffset -14}${offset 10}${memperc}${font Audiowide:size=14}${voffset -4} %
+${offset 415}${voffset 2}${font Audiowide:size=16}${mem} / ${memmax}
+${voffset 5}${offset 410}${font Audiowide:size=16}${font Audiowide:size=14}SWAP: \
+${font Audiowide:size=20}${voffset -14}${offset 10}${swapperc}${font Audiowide:size=14}${voffset -4} %
+${offset 415}${voffset 2}${font Audiowide:size=16}${swap} / ${swapmax}
+
+# Disk Utilization
+${voffset -50}
+${font Audiowide:size=16}/${offset 50}${fs_free /} / ${fs_size /} (${fs_used_perc /}%)
+#${font Audiowide:size=16}media${offset 5}${fs_free /mnt} / ${fs_size /mnt} (${fs_used_perc /mnt}%)
+
+# Network Utilization
+${voffset -30}${upspeedgraph wlp4s0 120,380 #FF1015 #FF1015 1 -l}
+${voffset -120}${offset 160}up
+${voffset -78}${offset 400}${downspeedgraph wlp4s0 120,380 #FF1015 #FF1015 1 -l}
+${voffset -120}${offset 540}down
+
+# Top processes
+${voffset 100}${offset 10}${font Audiowide:size=16}process
+${offset 10}${top name 1}
+${offset 10}${top name 2}
+${offset 10}${top name 3}
+${offset 10}${top name 4}
+${voffset -190}${offset 360}pid
+${offset 350}${top pid 1}
+${offset 350}${top pid 2}
+${offset 350}${top pid 3}
+${offset 350}${top pid 4}
+${voffset -190}${offset 510}cpu
+${offset 500}${top cpu 1}
+${offset 500}${top cpu 2}
+${offset 500}${top cpu 3}
+${offset 500}${top cpu 4}
+${voffset -190}${offset 650}mem
+${offset 630}${top mem 1}
+${offset 630}${top mem 2}
+${offset 630}${top mem 3}
+${offset 630}${top mem 4}
+#${voffset -100}
+]]