#!, OpenBox and Conky

Posted: November 25, 2013 in Ideas, IT, Linux, Scripting, Thoughts
Tags: , , , , , , , ,
OpenBox + Conky on CrunchBang

OpenBox + Conky on CrunchBang

I asked a question regarding CrunchBang last night in the largest Linux group on Facebook and after some serious debate, I set off in installing it on my Lenovo S9 netbook.

I couldn’t be more pleased. It’s extremely stable, very fast and I must say that it looks pretty damn good!

Now, I’m relatively new to the Openbox window manager, having only used it briefly with Arch. So with that said…

Over a couple cups of coffee and with plenty of distractions, I spent a couple hours hacking Conky – a “light weight system monitor” – which comes installed on #! (CrunchBang).

The above screenshot is what it is looking like, so far.

I still need to work out a few bugs and add a bit more functionality, such getting it to correctly parse the code for displaying the relevant file system information. Right now, it is currently displaying the same information twice for both of the mounted drives. By design, it’s supposed to display information regarding a mounted USB drive onto the second line and bar graph. The inbound network connections are missing, as well.

The more difficult issues appear to be with utilizing acpitemp to monitor CPU temperatures and handling the battery status (charge remaining, etc). This will require a bit of research into how the software parses the information from the sensors.

It’s going take a bit more work but so far so good! I’m really liking it. I would HIGHLY recommend you try out, not only #!, but OpenBox as well! It’s lightweight and very fast, as well as looking rather sharp. It would be well worth making the switch.

I’ve included the source in this post as well, for any of you that may want to hack around with it, yourselves. So here goes…

EDIT 6:15am 11/25/13:¬†I have fixed the bugs mentioned above. The battery indicator now works, the hard drive information is now correct for the external USB drive, and the incoming networking stats are now being displayed properly. Now to add some more functionality and presumably, more bugs ūüôā I have updated the code appropriately.

 

  1. # Conky sample configuration
  2. #
  3. # the list of variables has been removed from this file in favour
  4. # of keeping the documentation more maintainable.
  5. # Check http://conky.sf.net for an up-to-date-list.
  6. # set to yes if you want Conky to be forked in the background
  7. background no
  8. temperature_unit fahrenheit
  9. text_buffer_size 2048
  10. # X font when Xft is disabled, you can pick one with program xfontsel
  11. #font 5×7
  12. #font 6×10
  13. #font 7×13
  14. #font 8×13
  15. #font 9×15
  16. #font *mintsmild.se*
  17. #font -*-*-*-*-*-*-34-*-*-*-*-*-*-*
  18. # Use Xft?
  19. use_xft yes
  20. # Xft font when Xft is enabled
  21. #xftfont Bitstream Vera Sans Mono:size=8
  22. xftfont Eurostile:size=7
  23. # Text alpha when using Xft
  24. xftalpha 0.7
  25. # Print everything to stdout?
  26. # out_to_console no
  27. # MPD host/port
  28. # mpd_host localhost
  29. # mpd_port 6600
  30. # mpd_password tinker_bell
  31. # Print everything to console?
  32. # out_to_console no
  33. # mail spool
  34. #mail_spool $MAIL
  35. # Update interval in seconds
  36. update_interval 2.5
  37. # This is the number of times Conky will update before quitting.
  38. # Set to zero to run forever.
  39. total_run_times 0
  40. # Create own window instead of using desktop (required in nautilus)
  41. own_window yes
  42. # If own_window is yes, you may use type normal, desktop or override
  43. own_window_type override
  44. # Use pseudo transparency with own_window?
  45. own_window_transparent yes
  46. # If own_window_transparent is set to no, you can set the background colour here
  47. own_window_colour hotpink
  48. # If own_window is yes, these window manager hints may be used
  49. own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
  50. # Use double buffering (reduces flicker, may not work for everyone)
  51. double_buffer yes
  52. # Minimum size of text area
  53. minimum_size 260 5
  54. # Draw shades?
  55. draw_shades no
  56. # Draw outlines?
  57. draw_outline no
  58. # Draw borders around text
  59. draw_borders no
  60. # Draw borders around graphs
  61. draw_graph_borders no
  62. # Stippled borders?
  63. stippled_borders 3
  64. # border margins
  65. border_margin 9
  66. # border width
  67. border_width 10
  68. # Default colors and also border colors
  69. default_color grey
  70. default_shade_color black
  71. default_outline_color black
  72. # Text alignment, other possible values are commented
  73. #alignment top_left
  74. alignment top_right
  75. #alignment bottom_left
  76. #alignment bottom_right
  77. #alignment none
  78. # Gap between borders of screen and text
  79. # same thing as passing -x at command line
  80. gap_x 10
  81. gap_y 0
  82. # Subtract file system buffers from used memory?
  83. no_buffers yes
  84. # set to yes if you want all text to be in uppercase
  85. uppercase no
  86. # number of cpu samples to average
  87. # set to 1 to disable averaging
  88. cpu_avg_samples 2
  89. # number of net samples to average
  90. # set to 1 to disable averaging
  91. net_avg_samples 2
  92. # Force UTF8? note that UTF8 support required XFT
  93. override_utf8_locale no
  94. # Add spaces to keep things from moving about?  This only affects certain objects.
  95. use_spacer yes
  96. # Shows the maximum value in scaled graphs.
  97. show_graph_scale no
  98. # Shows the time range covered by a graph.
  99. show_graph_range no
  100. # Allow each port monitor to track at most this many connections (if 0 or not set, default is 256)
  101. #max_port_monitor_connections 256
  102. # Maximum number of special things, e.g. fonts, offsets, aligns, etc.
  103. #max_specials 512
  104. # Maximum size of buffer for user text, i.e. below TEXT line.
  105. #max_user_text 16384
  106. # Timing interval for music player thread, e.g. mpd, audacious
  107. #music_player_interval (update_interval is default)
  108. # Strictness of if_up. One of: up, link or address. The later ones imply the further ones.
  109. # Defaults to up.
  110. #if_up_strictness address
  111. # variable is given either in format $variable or in ${variable}. Latter
  112. # allows characters right after the variable and must be used in network
  113. # stuff because of an argument
  114. # stuff after ‘TEXT’ will be formatted on screen
  115. TEXT
  116. ${font arial black:size=10}${color orange}SYSTEM${color}${font arial black:size=9}INFORMATION${color orange} ${hr 2}$color$font
  117. $nodename¬†–¬†$sysname¬†$kernel¬†on¬†$machine
  118. ${color lightgrey}Distro: ${pre_exec cat /etc/issue | grep CrunchBang | cut -c1-25} $machine
  119. ${color lightgrey}Uptime:$color $uptime ${color lightgrey}- Load:$color $loadavg
  120. ${color lightgrey}Battery: ${battery_percent BAT0}%   ${battery_bar BAT0}$color
  121. ${font arial black:size=10}${color orange}CPU${color}${font arial black:size=9}INFORMATION${color orange} ${hr 2}$color$font
  122. ${color lightgrey}CPU Temp:¬†${acpitemp}F ¬†HDD Temp:¬†${execi 600 sudo hddtemp –unit=F /dev/sda | cut -c 36-38}
  123. ${color lightgrey}CPU Usage:${color #cc2222} $cpu% ${cpubar}
  124. ${color red}${cpugraph 0000ff 00ff00}
  125. ${color}Name              PID     CPU%   MEM%
  126. ${color #ddaa00} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
  127. ${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
  128. ${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
  129. ${color}Mem usage
  130. ${color #ddaa00} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
  131. ${color lightgrey} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
  132. ${color lightgrey} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
  133. ${font arial black:size=10}${color orange}MEMORY${color}${font arial black:size=9}INFORMATION${color orange} ${hr 2}$color$font
  134. ${color lightgrey}RAM Usage:$color¬†$mem/$memmax¬†–¬†$memperc%¬†${membar}
  135. ${color lightgrey}Swap Usage:$color¬†$swap/$swapmax¬†–¬†$swapperc%¬†${swapbar}
  136. ${color lightgrey}Processes:$color $processes  ${color grey}Running:$color $running_processes
  137. ${font arial black:size=10}${color orange}DISK${color}${font arial black:size=9}INFORMATION${color orange} ${hr 2}$color$font
  138. ${font arial black:size=9}VOLUME${goto 116}TYPE${goto 180}USED${alignr 1}SIZE$font
  139. ${font arial black:size=9}ROOT:$font${goto 120}${fs_type /}${goto 190}${fs_used /}${alignr}${fs_size /}
  140. ${fs_bar 4 /}$color
  141. ${font arial black:size=9}External:$font${goto 120}${fs_type /media/ext/}${goto 190}${fs_used /media/ext/}${alignr}${fs_size /media/ext/}
  142. ${fs_bar 4 /}$color
  143. ${font arial black:size=10}${color orange}NETWORK${color}${font arial black:size=9}INFORMATION${color orange} ${hr 2}$color$font
  144. ${font arial black:size=7}LOCAL:$font${addr wlan0} $alignr ${color}
  145. ${font arial black:size=7}DOWN: $font$color${downspeed wlan0} k/s ${alignr}${font arial black:size=7}UP:$font${upspeed wlan0} k/s
  146. ${downspeedgraph wlan0 25,140 0000ff 00ff00} ${alignr}${upspeedgraph wlan0 25,140 0000ff 00ff00}$color
  147. ${font arial black:size=9}TOTAL: $font${totaldown wlan0} ${alignr}${font arial black:size=9}TOTAL: $font${totalup wlan0}
  148. ${color orange}${hr 2}$color
  149. ${color #ddaa00}${addr wlan0}${alignr}#Connections
  150. $color Inbound: ${tcp_portmon 1 32767 count}  Outbound: ${tcp_portmon 32768 61000 count}${alignr}ALL:${tcp_portmon 1 65535 count}
  151. ${color #ddaa00}Inbound Connection ${alignr} Local Service/Port$color
  152. ${tcp_portmon 32768 61000 rhost 0} ${alignr} ${tcp_portmon 32768 61000 rservice 0}
  153.  ${tcp_portmon 32768 61000 rhost 1} ${alignr} ${tcp_portmon 32768 61000 rservice 1}
  154.  ${tcp_portmon 32768 61000 rhost 2} ${alignr} ${tcp_portmon 32768 61000 rservice 2}
  155.  ${tcp_portmon 32768 61000 rhost 3} ${alignr} ${tcp_portmon 32768 61000 rservice 3}
  156.  ${tcp_portmon 32768 61000 rhost 4} ${alignr} ${tcp_portmon 32768 61000 rservice 4}
  157. ${color #ddaa00}Outbound Connection ${alignr} Remote Service/Port$color
  158.  ${tcp_portmon 32768 61000 rhost 0} ${alignr} ${tcp_portmon 32768 61000 rservice 0}
  159.  ${tcp_portmon 32768 61000 rhost 1} ${alignr} ${tcp_portmon 32768 61000 rservice 1}
  160.  ${tcp_portmon 32768 61000 rhost 2} ${alignr} ${tcp_portmon 32768 61000 rservice 2}
  161.  ${tcp_portmon 32768 61000 rhost 3} ${alignr} ${tcp_portmon 32768 61000 rservice 3}
  162.  ${tcp_portmon 32768 61000 rhost 4} ${alignr} ${tcp_portmon 32768 61000 rservice 4}
  163. ${color orange}${hr 2}$color
  164. #${color}TODO:
  165. #${execi 20 cat /home/john/TODO.txt | fold -w40 }

 

Here’s the final screenshot of Conky running alongside htop, after I fixed the bugs.

Screenshot - 11252013 - 06:33:27 AM

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s