You are not logged in.

#1 2010-10-24 04:22:10

duke11235
Member
Registered: 2009-10-09
Posts: 221

[SOLVED]Conky Align Text Center

I am trying to align my conky so
that the middle of the text is in the middle of the top of the screen. My screen is 1200x800. Any suggestions?

use_xft yes
xftfont cure:size=8
update_interval 1
own_window_colour black
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_type desktop
own_window yes
double_buffer yes
maximum_width 1680
draw_shades no
draw_outline no
draw_borders no
stippled_borders 0
border_margin 5
border_width 1
default_color 42c4d3
alignment top_right
gap_x 430
gap_y 5
no_buffers yes
uppercase no
override_utf8_locale yes
use_spacer none

TEXT
${time %A}, ${color ffffff}${time %B}${color} ${time %d}${color ffffff}  //  ${color}CPU0:${color ffffff} ${cpu cpu0}% ${color}CPU1:${color ffffff} ${cpu cpu1}%  // ${color}RAM:${color ffffff} ${mem}  // ${color}Root: ${color ffffff}${fs_free_perc /}% // ${color}Mac: ${color ffffff}${fs_free_perc /mnt/mac}%  //  ${color}Email:${color ffffff} ${execi 300 perl ~/.scripts/imap.pl n}  // ${color}Arch:${color ffffff} ${texeci 300 perl ~/.scripts/updates2.pl}${color} 
${color}External IP: ${color ffffff}${execi 3600 wget -O - http://ip.tupeux.com | tail} // ${color}Time:${color ffffff} ${time %R} // ${color}Battery:${color ffffff} ${battery BAT0} // ${color}Network: DOWN ${color ffffff}${downspeed wlan0} // ${color}UP${color ffffff} ${upspeed wlan0} // ${color}Uptime ${color ffffff} $uptime   
 ${color}Title: ${color ffffff}$mpd_title // ${color}Artist: ${color ffffff}${mpd_artist 30} // ${color}Music Stats:${color ffffff} $mpd_elapsed/$mpd_length//$mpd_percent%

Thanks

Last edited by duke11235 (2010-10-25 00:16:54)

Offline

#2 2010-10-24 04:33:22

ozar
Member
From: USA
Registered: 2005-02-18
Posts: 1,686

Re: [SOLVED]Conky Align Text Center

Use the "alignc" option:

http://conky.sourceforge.net/variables.html

${alignc}

and "alignment top_middle"


oz

Offline

#3 2010-10-24 06:16:54

duke11235
Member
Registered: 2009-10-09
Posts: 221

Re: [SOLVED]Conky Align Text Center

Interestingly enough, instead of fixing the problem, It aligns it with the middle left corner. So half is now off the screen.

use_xft yes
xftfont cure:size=8
update_interval 1
own_window_colour black
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_type desktop
own_window yes
double_buffer yes
maximum_width 1680
draw_shades no
draw_outline no
draw_borders no
stippled_borders 0
#border_margin 5
border_width 1
default_color 42c4d3
alignment top_middle
gap_x 430
gap_y 5
no_buffers yes
uppercase no
override_utf8_locale yes
use_spacer none

TEXT
${alignc}${time %A}, ${color ffffff}${time %B}${color} ${time %d}${color ffffff}  //  ${color}CPU0:${color ffffff} ${cpu cpu0}% ${color}CPU1:${color ffffff} ${cpu cpu1}%  // ${color}RAM:${color ffffff} ${mem}  // ${color}Root: ${color ffffff}${fs_free_perc /}% // ${color}Mac: ${color ffffff}${fs_free_perc /mnt/mac}%  //  ${color}Email:${color ffffff} ${execi 300 perl ~/.scripts/imap.pl n}  // ${color}Arch:${color ffffff} ${texeci 300 perl ~/.scripts/updates2.pl}${color} 
${alignc}${color}External IP: ${color ffffff}${execi 3600 wget -O - http://ip.tupeux.com | tail} // ${color}Time:${color ffffff} ${time %R} // ${color}Battery:${color ffffff} ${battery BAT0} // ${color}Network: DOWN ${color ffffff}${downspeed wlan0} // ${color}UP${color ffffff} ${upspeed wlan0} // ${color}Uptime ${color ffffff} $uptime   
${align_c} ${color}Title: ${color ffffff}$mpd_title // ${color}Artist: ${color ffffff}${mpd_artist 30} // ${color}Music Stats:${color ffffff} $mpd_elapsed/$mpd_length//$mpd_percent%

-- mod edit: read the Forum Etiquette and only post thumbnails http://wiki.archlinux.org/index.php/For … s_and_Code --

Offline

#4 2010-10-24 06:26:00

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED]Conky Align Text Center

gap_x 430 ?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2010-10-24 18:41:33

Knute
Member
From: Minot, ND
Registered: 2009-03-17
Posts: 604

Re: [SOLVED]Conky Align Text Center

First off, if your screen is 1200, then you would want to set your maximum_width to 1200 rather than 1680.

So, if we do the math from your settings, you are instructing conky to position itself at the top middle, 5 pixels down from the very top edge of the screen (gap_y), and 430 pixels to the right of center (gap_x).

So the resulting starting position would be (1200/2 = 600 + 430 = 1030)....  1030x5.
This would be the center position that conky would be placed at.  Assuming of course that conky is using the 1200 (screen size) in it's calculations.

I also notice that you have maximum_size set at 1680.  So if conky is using that then (1680/2 = 840 +430 = 1270) the middle of conky's placement would be 1270x5.

So it would appear that you may want to change both the maximum_size and the gap_x variables.


Knute

Offline

#6 2010-10-25 00:16:35

duke11235
Member
Registered: 2009-10-09
Posts: 221

Re: [SOLVED]Conky Align Text Center

Thanks. Setting the maximum width to 1200 and commenting out the gap_x solved it. I wasn't aware of the math behind the options, as it was spliced together from the conky forum thread

Offline

Board footer

Powered by FluxBB