Originally Posted by
The Funkbomb
I'm having some trouble with alignment. Was wondering if anyone can help.
Basically, if you look under CPU usage and Mem usage, when the app name has a long name, it shifts everything to the right. Numbers jump back and forth. That's what I'm trying to fix now.
What I'd like to do is create almost like a table.
Like this? See attached.
There are a few things you need to do:
1. - Above TEXT, add these lines:
Code:
short_units yes
pad_percents 2
top_name_width 7 #I use 7 see below
short_units
Shortens units to a single character (kiB->k, GiB->G, etc.). Default is off.
pad_percents
Pad percentages to this many decimals (0 = no padding)
top_name_width
Width for $top name value (defaults to 15 characters).
2. use ${goto xx} to place the numerical outputs, because you have padded the percents outputs to 2 places the ${goto} command will work on the decimal point. So you see when firefox climbs above 9.99% to 10.00 you see the decimal point is still in place.
Now think about it, the "names are limited to 7 spaces" therefore the output for the actual values can be placed with a ${goto}, just make sure you give the output enough room for 99.99 even if it is 0.00
Any more questions just ask.
The code for the images: Warning: opens a new window
Code:
background no
own_window yes
own_window_type normal
own_window_transparent no
own_window_hints skip_taskbar,skip_pager
own_window_title ProcessesBox
double_buffer yes
use_spacer left
override_utf8_locale yes
use_xft yes
xftfont DejaVu Sans Mono:size=9
xftalpha 2.5
update_interval 1.0
uppercase no # set to yes if you want all text to be in uppercase
stippled_borders 3
border_margin 0
border_width 0
default_outline_color black
default_shade_color black
draw_borders no
draw_outline yes # amplifies text if yes
draw_shades yes # shadecolor black
default_color FFDEAD #NavajoWhite
color0 7FFFD4 #Aquamarine
color1 CD5C5C #IndianRed #00CED1 DarkTurquoise #FFA07A LightSalmon #00FFFF Cyan
color2 FF8C00 #Darkorange #D2691E #Chocolate
color3 7FFF00 #Chartreuse
color4 778899 #LightSlateGrey
color5 DCDCDC #Gainsboro
color6 00BFFF #DeepSkyBlue
# colours below used by colorize script
color7 48D1CC #MediumTurquoise
color8 FFFF00 #Yellow
color9 FF0000 #Red
alignment tl # Aligned position on screen: tl, tr, tm, bl, br, bm, ml, mr
gap_x 50
gap_y 90 # -200 for bottom & 35 for top
border_inner_margin 5
border_outer_margin 0
text_buffer_size 256
no_buffers yes # Subtract file system buffers from used memory?
short_units yes
pad_percents 2
top_name_width 7
minimum_size 200 0
TEXT
${goto 10}${font woodbadge:size=15}${color2}CPU${font} ${color6}${cpubar cpu0 3,100}${color} ${cpu cpu0} %
${color3}${goto 10}Name${goto 85}CPU${goto 135}MEM${color}
${voffset 5}${goto 10}${top name 1}${goto 70}${top cpu 1}${goto 120}${top mem 1}
${goto 10}${top name 2}${goto 70}${top cpu 2}${goto 120}${top mem 2}
${goto 10}${top name 3}${goto 70}${top cpu 3}${goto 120}${top mem 3}
${goto 10}${top name 4}${goto 70}${top cpu 4}${goto 120}${top mem 4}
${goto 10}${top name 5}${goto 70}${top cpu 5}${goto 120}${top mem 5}
${goto 10}${top name 6}${goto 70}${top cpu 6}${goto 120}${top mem 6}
${goto 10}${top name 7}${goto 70}${top cpu 7}${goto 120}${top mem 7}
${goto 10}${top name 8}${goto 70}${top cpu 8}${goto 120}${top mem 8}
${goto 10}${top name 9}${goto 70}${top cpu 9}${goto 120}${top mem 9}
${voffset 10}${goto 10}${font woodbadge:size=15}${color2}MEMORY${font} ${color6}${membar 3,60}${color} ${memperc} %
${color3}${goto 10}Name${goto 85}CPU${goto 135}MEM${color}
${voffset 5}${goto 10}${top_mem name 1}${goto 70}${top_mem cpu 1}${goto 120}${top_mem mem 1}
${goto 10}${top_mem name 2}${goto 70}${top_mem cpu 2}${goto 120}${top_mem mem 2}
${goto 10}${top_mem name 3}${goto 70}${top_mem cpu 3}${goto 120}${top_mem mem 3}
${goto 10}${top_mem name 4}${goto 70}${top_mem cpu 4}${goto 120}${top_mem mem 4}
${goto 10}${top_mem name 5}${goto 70}${top_mem cpu 5}${goto 120}${top_mem mem 5}
${goto 10}${top_mem name 6}${goto 70}${top_mem cpu 6}${goto 120}${top_mem mem 6}
${goto 10}${top_mem name 7}${goto 70}${top_mem cpu 7}${goto 120}${top_mem mem 7}
${goto 10}${top_mem name 8}${goto 70}${top_mem cpu 8}${goto 120}${top_mem mem 8}
${goto 10}${top_mem name 9}${goto 70}${top_mem cpu 9}${goto 120}${top_mem mem 9}${font}${color}
Have a nice day.
Bruce
Bookmarks