Thursday, April 18, 2013

OpenBox status bar

I wanted a simple status bar on OpenBox. I ended up using conky with the following .conkyrc:


# window
own_window yes
own_window_class Conky
own_window_type desktop
own_window_transparent yes
alignment top_middle

# stop flickering
double_buffer yes

# size
gap_x 0
gap_y 0
minimum_size 1265 20
#maximum_width 400
text_buffer_size 512

border_width 1
cpu_avg_samples 2
default_color white
default_outline_color white
default_shade_color white
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no
use_xft yes
xftfont Inconsolata:size=12
net_avg_samples 2
no_buffers yes
out_to_console no
out_to_stderr no
extra_newline no
stippled_borders 0
update_interval 1.0
uppercase no
use_spacer none
show_graph_scale no
show_graph_range no

TEXT
${color grey}net:${if_existing /sys/class/net/eth0/operstate up}${color}eth0$else${if_existing /sys/class/net/wlan0/operstate up}$color${exec /home/my_name/scripts/network_stat.py name} ${exec /home/my_name/scripts/network_stat.py strength}${color grey}%${else}none$endif$endif $alignc${color grey}cpu:$color$cpu${color grey}%  ram:$color$memperc${color grey}%  bat:$color$battery_percent${color grey}%  vol:$color${execpi 1 /home/my_name/scripts/volume.sh}  ${color grey}${if_mpd_playing}${execpi 1 mpc | awk 'NR==2 {print $1}' | sed 's/[^a-Z]//g'}${else}not playing${endif} $alignr$alignc${time %a %d %b} $color${time %H:%M}

I made my own scripts network_stat.py to report the wireless connection and quality from iwconfig and and volume.sh to report the un/muted status and volume from amixer get Master.

I adjusted OpenBox using obconf to create a 20 px upper margin so that no program window overlays the conky panel.

No comments:

Post a Comment