Bar-text-bar (en)

From Conky PitStop

(Difference between revisions)
Jump to: navigation, search
 
Line 125: Line 125:
  1. Above the TEXT area, set a default bar size, e.g. "default_bar_size 50 7" is 50 pixels long, 7 pixels high.
  1. Above the TEXT area, set a default bar size, e.g. "default_bar_size 50 7" is 50 pixels long, 7 pixels high.
  2. Where you want the solid bar, use ${execbar echo 100}
  2. Where you want the solid bar, use ${execbar echo 100}
-
50-12.jpg
 
and I tested and found that:
and I tested and found that:
  default_bar_size 0 7
  default_bar_size 0 7
  TEXT
  TEXT
  ${execbar echo 100}
  ${execbar echo 100}
-
created a bar as wide as the conky window and a height of 7
+
created a bar as wide as the conky window with a height of 7
-
AWESOME!  KUDOS to pvsage.
+
'''''AWESOME!  KUDOS to pvsage.'''''
Now while ''default_bar_size 0 2'' is more or less the same as '''${hr 2}''' ''default_bar_size 50 12'' isn't.
Now while ''default_bar_size 0 2'' is more or less the same as '''${hr 2}''' ''default_bar_size 50 12'' isn't.

Latest revision as of 21:05, 26 April 2014

bar-text-bar

 Language   English   Français   


A complete rewrite thanks to some new tricks.

OK so someone asked if it was possible to have:

-- text here --

in conky. Where the was a solid line similar to the ${hr} command.

People started by saying, “No, not possible.” I thought about it for a bit and said to myself, “Yea I can do that!”. With another trick in conky that I have already showed you in "Bars with text inside".

So I set out and experimented and came up with the solution. ${cpubar cpuX} where X is a cpu you do not have. ie: cpu3 for a dual-core

${alignc}${cpubar cpu 5 1,30} cpubar cpuX ${cpubar cpu5 1,30}

as seen in the image on the right.

Fast forward to April 2014 in the CrunchBang Forums

Marenbraga said: I plan to use a bar only as decoration, but I need it filled because of the background color. Any suggestions?

Use: ${membar} with a height no greater than 1 and a width of 0, along with a creative use of font size. Good idea but requires a lot of them to make a real bar

However you can even give it stripes:

Bar-TXT-Bar

The test code that did all that:

default_bar_size 0 12
TEXT
${time %T}${alignr}${time %x}
${alignc}CPU % Usage:
${alignc}1  |  2  |  3  |  A
${alignc}${if_match ${cpu cpu1}<10}00${cpu cpu1}\
${else}${if_match ${cpu cpu1}<100}0${cpu cpu1}\
${else}${color9}${cpu cpu1}${endif}${endif}\
 | ${if_match ${cpu cpu2}<10}00${cpu cpu2}\
${else}${if_match ${cpu cpu2}<100}0${cpu cpu2}\
${else}${color9}${cpu cpu2}${endif}${endif}\
 | ${if_match ${cpu cpu3}<10}00${cpu cpu3}\
${else}${if_match ${cpu cpu3}<100}0${cpu cpu3}\
${else}${color9}${cpu cpu3}${endif}${endif}\
 | ${if_match ${cpu cpu0}<10}00${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100}0${cpu cpu0}\
${else}${cpu cpu0}${endif}${endif}

${alignc}${cpubar cpu4 0,30} cpubar cpu4 ${cpubar cpu4 0,30}
${alignc}${cpubar cpu4 1,30} cpubar cpu4 ${cpubar cpu4 1,30}

${alignc}${membar 1,30} use membar ${membar 1,30}
${font :size=1}${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}
${membar 1,0}${font}
${font :size=1}${color}${membar 1,0}
${membar 1,0}
${membar 1,0}${color blue}
${membar 1,0}
${membar 1,0}${color}
${membar 1,0}
${membar 1,0}${color blue}
${membar 1,0}
${membar 1,0}${color}
${membar 1,0}
${membar 1,0}${color blue}
${membar 1,0}
${membar 1,0}${color}
${membar 1,0}
${membar 1,0}${font}
${alignc}${membar 0,75} Conky PitStop ${membar 0,75}
${membar 0,0}
${alignc}${membar 1,75} Conky PitStop ${membar 1,75}
${membar 1,0}
${alignc}${membar 2,75} Conky PitStop ${membar 2,75}
${membar 3,0}${goto 6}${color red}${membar 1,0}${color}
${membar 2,0}${goto 6}${color blue}${membar 0,0}${color}
${alignc}${membar 1,30} pvsage's idea ${membar 1,30}
${alignc}${membar 1,30} use   execbar ${membar 1,30}
20  ${execbar echo 20}
40  ${execbar echo 40}${goto 150}${voffset -1}${color5}pvsage's idea${color}${voffset 1}
60  ${execbar echo 60}
80  ${execbar echo 80}
100 ${execbar echo 100}${goto 50}${voffset -1}${color 000000}pvsage's idea${color}${voffset 1}
${execbar echo 100}${goto 50}${voffset -1}${color 000000}pvsage's idea${color}${voffset 1}




${alignc}${membar 1,30} pvsage expanded idea ${membar 1,30}
${execbar echo 10}${goto 10}${voffset -1}${color 000000}${cpu}${color}${goto 40}Avg: ${voffset 1}${cpubar cpu0 12}
${execbar echo 10}${goto 10}${voffset -1}${color 000000}${cpu cpu1}${color}${goto 40}  1: ${voffset 1}${cpubar cpu1 12}
${execbar echo 10}${goto 10}${voffset -1}${color 000000}${cpu cpu2}${color}${goto 40}  2: ${voffset 1}${cpubar cpu2 12}
${execbar echo 10}${goto 10}${voffset -1}${color 000000}${cpu cpu3}${color}${goto 40}  3: ${voffset 1}${cpubar cpu3 12}

${hr 10}${goto 20}${voffset 2}${color 000000}and great one too!${color}${voffset -2}

${hr}
${font woodbadge:size=20}${alignc}${color  chocolate}Conky${color}${font}
${color yellow}${voffset -15}${membar 3,70}${alignr 2}${membar 3,70}${color}${voffset 15}
${color red}${voffset -29}${membar 1,70}${alignr 2}${membar 1,70}${color}${voffset 15}
${font woodbadge:size=20}${alignc}${color  chocolate}PitStop${color}${font}
${color yellow}${voffset -15}${membar 3,70}${alignr 2}${membar 3,70}${color}${voffset 15}
${color red}${voffset -29}${membar 1,70}${alignr 2}${membar 1,70}${color}${voffset 15}
${hr}

${alignc}${font woodbadge:size=20}Conky${font}
${font woodbadge:size=20}${alignc}Conky${font}

pvsage said

Another way to do it:
1. Above the TEXT area, set a default bar size, e.g. "default_bar_size 50 7" is 50 pixels long, 7 pixels high.
2. Where you want the solid bar, use ${execbar echo 100}

and I tested and found that:

default_bar_size 0 7
TEXT
${execbar echo 100}

created a bar as wide as the conky window with a height of 7

AWESOME! KUDOS to pvsage.

Now while default_bar_size 0 2 is more or less the same as ${hr 2} default_bar_size 50 12 isn't.

default_bar_size 50 12
TEXT
${alignc}${execbar echo 100}${voffset -1} by pvsage ${voffset 1}${execbar echo 100}
${alignc}${execbar echo 100}${voffset -1} 50     12 ${voffset 1}${execbar echo 100}

Where this differs from ${membar} is ${execbar} does not take height/width parameters only the the default_bar_size can modify it's appearence

50-12

The last two lines in that code:

${alignc}${font woodbadge:size=20}Conky${font}
${font woodbadge:size=20}${alignc}Conky${font}

are simply to show, when you use a font and size different to the default font, in this case:

use_xft yes
xftfont monofur:bold:size=10

it does matter where you put the ${alignc}

Personal tools
Namespaces
Variants
Actions
Navigation
English
Français
Toolbox