Bars with text inside (en)

From Conky PitStop

(Difference between revisions)
Jump to: navigation, search
m
(edited spelling error)
 
Line 7: Line 7:
This may not work for you, some people report that with Conky v1.8+ they get errors
This may not work for you, some people report that with Conky v1.8+ they get errors
-
  Trying to use more CPU's than your have.
+
  Trying to use more CPU's than you have.
It does work with Conky v1.8.0 in Debian Squeeze, see the sample at the bottom of: "[[bar-text-bar (en)|bar-text-bar]]"
It does work with Conky v1.8.0 in Debian Squeeze, see the sample at the bottom of: "[[bar-text-bar (en)|bar-text-bar]]"

Latest revision as of 17:20, 13 June 2011

Bars with Text inside

 Language   English   Français   


This may not work for you, some people report that with Conky v1.8+ they get errors

Trying to use more CPU's than you have.

It does work with Conky v1.8.0 in Debian Squeeze, see the sample at the bottom of: "bar-text-bar"



OK, you use "BARs" in your conky, you want to spruce them up a bit. Or you’re new and have no idea about BARS.

“Get outta here Tim, we’re not talking the local pub!”

Bars in conky give a pictorial “bar-graph” of a percent value of certain components of your computer.

There are a few of them: audacious_bar, battery_bar, entropy_bar, fs_bar, fs_bar_free, lua_bar, mpd_bar, smapi_bat_bar, wireless_link_bar and xmms2_bar

And a few I just plain don’t understand, although I don't understand some of the above either:
execbar
- Same as exec, except if the first value return is a value between 0-100, it will use that number for a bar. The size for the bar is currently fixed, but that may change in the future.
execibar
- Same as execbar, except with an interval.

Great, now I don’t know at intervals. Does that mean I know in between those intervals but I’m not conscientiously aware I know?

And I don’t listen to music on my PC, so I don't use the ones related to that function either.

And then there's that entropy_bar – Entropy? Ohhhh ok – Current entropy available for crypto freaks

RIGHT! I looked it up, my advice is: lets continue.

Today I’m going to show you a trick with cpubar, membar and swapbar, because I’ve used those. I have a desktop PC so there is now way I use stuff for a battery, but the principle will work there too as well as for music. And there is nothing entropy-crypto about it.

Text-bars-1.png

This is one of my first “BARS” that I had in conky, they got a little more complicated over time. And believe it or not I’m editing it as I do this exercise for you. Correcting some old errors/ways of doing things.

OK, lets start: first get the info into place, here’s the basic layout, no color, no offsets, just the “goto” & “align” commands. That ${alignr 5} command moves everything after it to the right side of your conky, but the % symbol would overlap the vertical part of the BAR so the 5 brings it left 5 pixels from the right, now it’s “inside” the BAR.

TEXT
${hr 1}
CPU: $running_processes  / $processes${alignr 2}${cpubar cpu0 14,80}
${alignr 5}$cpu%
Load Avg Min: 1:${goto 100}${loadavg 1}${goto 150}5: ${loadavg 2}${alignr 2}15: ${loadavg 3}
RAM: $mem / $memmax${alignr 2}${membar 14,80}
${alignr 5}$memperc%
Buffered: ${buffers}${alignr 2}Cached: ${cached}
SWAP: $swap / ${swapmax}${alignr 2}${swapbar 14,80}
${alignr 5}$swapperc%
${hr 1}
Text-bars-2.png

See that 1% below the first bar. We now have to move that up into the bar with a “voffset” command.

TEXT
${hr 1}
CPU: $running_processes  / $processes${alignr 2}${cpubar cpu0 14,80}
${voffset -16}${alignr 5}$cpu%
Load Avg Min: 1:${goto 100}${loadavg 1}${goto 150}5: ${loadavg 2}${alignr 2}15: ${loadavg 3}
RAM: $mem / $memmax${alignr 2}${membar 14,80}
${alignr 5}$memperc%
Buffered: ${buffers}${alignr 2}Cached: ${cached}
SWAP: $swap / ${swapmax}${alignr 2}${swapbar 14,80}
${alignr 5}$swapperc%
${hr 1}

Testing I find that “-16″ works just fine. Remember: – = up and + = down and the value you use are dependent on the font you are using. My default font for this exercise is: Zekton:size=9

Text-bars-3.png

There we are. The % value is now in the BAR, but for me, just my opinion that “Load Avg” line is just too close, so lets move it down 5 pixels, and RAM too while we are at it.

TEXT
${hr 1}CPU: $running_processes  / $processes${alignr 2}${cpubar cpu0 14,80}
${voffset -16}${alignr 5}$cpu%
${voffset 5}Load Avg Min: 1:${goto 100}${loadavg 1}${goto 150}5: ${loadavg 2}${alignr 2}15: ${loadavg 3}
${voffset 5}RAM: $mem / $memmax${alignr 2}${membar 14,80}
${alignr 5}$memperc%
Buffered: ${buffers}${alignr 2}Cached: ${cached}
SWAP: $swap / ${swapmax}${alignr 2}${swapbar 14,80}
${alignr 5}$swapperc%
${hr 1}
Text-bars-4.png

Now that’s beginning to look like something.

OK lets do the rest in the same fashion

TEXT
${hr 1}
CPU: $running_processes  / $processes${alignr 2}${cpubar cpu0 14,80}
${voffset -16}${alignr 5}$cpu%
${voffset 5}Load Avg Min: 1:${goto 100}${loadavg 1}${goto 150}5: ${loadavg 2}${alignr 2}15: ${loadavg 3}
${voffset 5}RAM: $mem / $memmax${alignr 2}${membar 14,80}
${voffset -16}${alignr 5}$memperc%
${voffset 5}Buffered: ${buffers}${alignr 2}Cached: ${cached}
${voffset 5}SWAP: $swap / ${swapmax}${alignr 2}${swapbar 14,80}
${voffset -16}${alignr 5}$swapperc%
${hr 1}
Text-bars-5.png

Well, that looks nice. Bland but a nice layout.

Colour! HUSTON, We need colour! <<— note Canadian spelling.

Well, colouring is your option. This is what created that very first image you see above:

TEXT
${color0}${hr 1}${color}
${voffset 5}${color2}CPU:${alignc}${color}$running_processes ${color1} /${color} $processes${alignr 2}${color2}${cpubar cpu0 14,80}${color}
${color1}${voffset -16}${alignr 5}$cpu%${color}
${voffset 2}${color1}Load Avg (${color3}Min${color1}):${alignr 2}${color3}1: ${color}${loadavg 1}   ${color3}5: ${color}${loadavg 2}   ${color3}15: ${color}${loadavg 3}
${voffset 5}${color2}RAM:${color} $mem ${color2} /${color}$memmax${alignr 2}${color2}${membar 14,80}${color}
${color1}${voffset -16}${alignr 5}$memperc%${color}
${voffset 2}${color1}Buffered: ${color}${buffers}${alignr 2}${color1}Cached:${color} ${cached}
${voffset 5}${color2}SWAP: ${color}$swap ${color2}/ ${color}${swapmax}${alignr 2}${color2}${swapbar 14,80}${color}
${color1}${voffset -16}${alignr 5}$swapperc%
${color0}${hr 1}${color}

However when I pop that into my conky today … YUK! I’ve changed my colour codes since then, and I’m sure you don’t want this, I know I don’t!

Text-bars-6.png

However take a close look at the “Load Avg Min” lines and you’ll see where I made changes for this exercise. And of course you’ll see where and how to add colours.

OK, you have the layout. And to mis-quote one of my favourite quotes:

“Use the colours, Luke!”

Happy conkying!

Personal tools
Namespaces
Variants
Actions
Navigation
English
Français
Toolbox