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.

OpenBox Conky Battery show

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 yes
xftfont DejaVu Sans:size=8
xftalpha 0.8
text_buffer_size 2048
# Update interval in seconds
update_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 yes
own_window_transparent yes
own_window_type normal
own_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 area
minimum_size 180 0
#maximum_width 200
# Draw shades?
draw_shades no
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_margin 5
# border width
border_width 1
# Default colors and also border colors
default_color grey
#default_shade_color black
#default_outline_color grey
own_window_colour grey
# 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 25
gap_y 25
# 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 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
################################

That’s it.
PS: You can also read this post on my Google docs (publicly viewable)

Tags: , , ,

Cuong Dang © 2006-2010 | Say Hello | Site's contents is licensed under a CCA 3.0 | Powered by Wordpress | Theme by.