Thursday, April 19, 2012

Conky in FreeBSD 9.0-RELEASE


I've posted quite a bit on this topic for earlier versions of FreeBSD with this post being the most complete.
However, I'm now using FreeBSD 9.0-RELEASE and Conky is running very nicely.
Inparticular, I now have a Gmail notifier working as well as including a current moon phase indication in the weather section.
See the screenshot to see how it looks.

The steps to get it installed are as follows:

1. Install conky from /usr/ports/sysutils/conky
Make sure you select Xft from the compile options

2. Install conkyforecast from /usr/ports/deskutils/conkyforecast

3. Install conkyemail from /usr/ports/deskutils/conkyemail

4. In your home directory, create a folder called scripts. Here you need to enter two scripts.
One is conkyip, which finds your external IP.

Here it is:

#!/bin/sh
# eigene öffentliche ip anzeigen

wget http://checkip.dyndns.org/ -q -O - |
grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>'
Of course, it needs to be made executable.

The second is called  gmail_parser.py which you can copy from this thread post.

5. To activate the cpu temperature sensors, add this line
coretemp_load="YES"
to /boot/loader.conf

6. I'm using an nVidia gfx card, so nvidia-settings gives me my GPU tempetraure.
If you have an nVidia card, install nidia-settings from /usr/ports/x11/nvidia-settings.
If your card is not nVidia, you'll have to do a little googling.

7. To get your Gmail mail to be read you need to install py-feedpasers from /usr/ports/textproc/py-feedparser

8. I found that conky tends to freeze shortly after launch. But if relaunched generally keeps going.
So, I started small script to start conky after a 10 second sleep in Startup_Applications.
Then I added another script with the following content to restart conky after 30 seconds.
#! /bin/sh
sleep 30
killall -9 conky && conky

and that's about it.

Here's my .conkyrc Variables that you will/may have to change are marked in red.



 
# Use Xft?
use_xft yes

# Xft font when Xft is enabled
xftfont Bitstream Vera Sans Mono:size=10

# Text alpha when using Xft
xftalpha 0.8

# Update interval in seconds
update_interval 1.0

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

# Create own window instead of using desktop (required in nautilus)
own_window no
own_window_hints below

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
minimum_size 300 0
maximum_width 300

# Draw shades?
draw_shades yes

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no
draw_graph_borders yes

# Stippled borders?
stippled_borders 8

# border margins
border_margin 4

# border width
border_width 1

# Default colors and also border colors
default_color yellow
default_shade_color black
default_outline_color white

# own window options
own_window yes
own_window_transparent yes
own_window_type override
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 10
gap_y 15

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer right

# colours
color1 white
# light blue
color2 6892C6
# yellow
#E77320
color3 FC8820
# green
color4 78BF39
# red
color5 CC0000

text_buffer_size 2048

# variable is given either in format $variable or in ${variable}. Latter
# allows characters right after the variable and must be used in network
# stuff because of an argument

# stuff after 'TEXT' will be formatted on screen

TEXT

${font Bitstream Vera Sans Mono:size=14 :bold}${execi 1800 conkyForecast --location=EIXX0026 --datatype=CT}${font}
${color white}${font ConkyWeather:style=Bold:size=40}${execi 1800 conkyForecast --location=EIXX0026 --datatype=WF} ${goto 90}${font ConkyWindNESW:size=40}${execi 1800 conkyForecast --location=EIXX0026 --datatype=BS}${goto 200}${font moon phases:size=35}${execi 1800 conkyForecast --location=EIXX0026 --datatype=MF}${font}
${execi 1800 conkyForecast --location=EIXX0026 --datatype=HT --centeredwidth=4}/${execi 1800 conkyForecast --location=EIXX0026 --datatype=LT --centeredwidth=4} ${execi 1800 conkyForecast --location=EIXX0026 --datatype=WS --metrespersecond} - ${execi 1800 conkyForecast --location=EIXX0026 --datatype=WD} ${goto 175}${execi 1800 conkyForecast --location=EIXX0026 --datatype=MP}${font}


${color #00ff00}SYSTEM${color}
${color red}CPU0: ${alignr} ${cpu cpu0}%
${color}CPU1: ${alignr} ${cpu cpu1}%
CPU2: ${alignr} ${cpu cpu2}%
${color green}${cpugraph 20}

${color #00ff00}CPU Usage $alignr PID CPU%
${color}${top name 1} $alignr ${top pid 1} ${top cpu 1}
${top name 2} $alignr ${top pid 2} ${top cpu 2}
${top name 3} $alignr ${top pid 3} ${top cpu 3}

${color #00ff00}Mem usage $alignr PID MEM%
${color}${top_mem name 1} $alignr ${top_mem pid 1} ${top_mem mem 1}
${top_mem name 2} $alignr ${top_mem pid 2} ${top_mem mem 2}
${top_mem name 3} $alignr ${top_mem pid 3} ${top_mem mem 3}

RAM: $alignr $mem/$memmax
${color green}${membar 3}${color}
Swap: $alignr $swap / $swapmax
${color green}${swapbar 3}${color}

${color #00ff00}Partitions$color
ROOT: $alignr ${fs_used /} / ${fs_size /}
${color green}${fs_bar 3 /}${color}
/tmp: $alignr ${fs_used /tmp} / ${fs_size /tmp}
${color green}${fs_bar 3 /var}${color}
/var: $alignr ${fs_used /var} / ${fs_size /var}
${color green}${fs_bar 3 /tmp}${color}
/usr: $alignr ${fs_used /usr} / ${fs_size /usr}
${color green}${fs_bar 3 /usr}${color}

${color #00ff00}CPU Freq, CPU and GPU Temperatures.
${color}CPU Frequency: ${alignr}${freq_g} GHz$color
Core0 Temperature:${color} ${alignr} ${execi 30 sysctl -n dev.cpu.0.temperature | cut -c 1-2}°C
Core1 Temperature:${color} ${alignr} ${execi 30 sysctl -n dev.cpu.1.temperature | cut -c 1-2}°C
GPU Temperature: $alignr ${execi 30 nvidia-settings -q [gpu:0]/GPUCoreTemp | grep '):' | awk '{print $4}' | sed 's/\.//'}°C

${color #00ff00}Network
${color}Download Speed: $alignr ${downspeed em0}
# Total Down: $alignr ${totaldown em0}
Upload Speed: $alignr ${upspeed em0}
${color}IP on LAN $alignr ${addr em0}
External IP: ${alignr}${execi 3600 /usr/home/paul/scripts/conkyip}

 ${color #00ff00}GMail
${color #0000ff}${execpi 60 python ~/scripts/gmail_parser.py gmail_username gmail_password 3}
${color}${font :size=36}$alignc${time %H:%M:%S}
${voffset -30}${font :size=15}$alignc${time %d %b. %Y}
${font :bold:size=10}$alignc${time %A}

No comments:

Post a Comment