Ubuntu – show battery status for Openbox
Tech April 14th, 2010
There are several ways to show your battery status in Openbox.
Here I use conky, which has many useful function like weather cast, network status also… here I just want it to show my battery status, cpu, ram and dates on my desktop screen.
Ok, first of all, install conky via Terminal emulator (select from the right click menu – root menu)
sudo apt-get install conky
Now you can run it by typing
conky
As you can see now, by default conky does not show your battery status. To let it do that, create a .conkyrc file in your home directory
gedit ~/.conkyrc
Paste the following code into .conkyrc file, save it and restart conky (ctrol+c, type conky again in the terminal):
Code ref: Various sources from the Internet and my own experience by studyihttp://conky.sourceforge.net/variables.html
# Use Xft?use_xft yesxftfont DejaVu Sans:size=8xftalpha 0.8text_buffer_size 2048# Update interval in secondsupdate_interval 4# 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 yesown_window_transparent yesown_window_type normalown_window_hints undecorated,below,sticky,skip_taskbar,skip_pager# Use double buffering (reduces flicker, may not work for everyone)double_buffer yes# Minimum size of text areaminimum_size 180 0#maximum_width 200# Draw shades?draw_shades no# Draw outlines?draw_outline no# Draw borders around textdraw_borders no# Stippled borders?stippled_borders 0# border marginsborder_margin 5# border widthborder_width 1# Default colors and also border colorsdefault_color grey#default_shade_color black#default_outline_color greyown_window_colour grey# Text alignment, other possible values are commented#alignment top_leftalignment top_right#alignment bottom_left#alignment bottom_right# Gap between borders of screen and text# same thing as passing -x at command linegap_x 25gap_y 25# Subtract file system buffers from used memory?no_buffers yes# set to yes if you want all text to be in uppercaseuppercase no# number of cpu samples to average# set to 1 to disable averagingcpu_avg_samples 2# number of net samples to average# set to 1 to disable averagingnet_avg_samples 2# Force UTF8? note that UTF8 support required XFToverride_utf8_locale yes# Add spaces to keep things from moving about? This only affects certain objects.use_spacer none#################################Dates################################TEXT${alignc 35}${font Arial Black:size=12}${time %A, %d-%m-%Y}${font}${alignc 35}${font Arial Black:size=12} ${time %H:%M:%S}${font}#################################System Default conky config################################${color grey}Acpi temp:$color $acpitemp C${color grey}RAM Usage:$color $mem/$memmax – $memperc% ${membar 10}${color grey}CPU Usage:$color $cpu% ${cpubar 6}${color grey}Processes:$color $processes ${color grey}Running:$color $running_processes$hr#################################${color grey}File systems:#/ $color${#fs_used /}/${fs_size /} ${fs_bar 6 /}################################${color grey}Name PID CPU% MEM%${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}$hr${color grey}Networking:Up:$color ${upspeed eth0} ${color grey} – Down:$color ${downspeed eth0}#################################Battery################################$hr${color grey}Time left or until charged:$color ${color red} ${battery_time BAT0} $color${color grey}Battery:$color${battery_bar 6,150 BAT0}${color} ${battery BAT0}${color grey}Uptime:$color $uptime#################################Weather Can Tho VMXX0004################################
Tags: battery, conky, laptopbattery, ubuntu



