7

Is there any way to change the height of a conky window?

.conkyrc

background no
update_interval 1

cpu_avg_samples 2
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048
#imlib_cache_size 0

# Window specifications #

own_window_class Conky
own_window yes
own_window_type desktop
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_argb_visual yes

border_inner_margin 0
border_outer_margin 0

minimum_size 200 200
maximum_width 200

alignment tr
gap_x 0
gap_y 25

# Graphics settings #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# Text settings #
use_xft yes
xftfont Ubuntu:size=8
xftalpha 0.5

uppercase no
temperature_unit celsius
default_color FFFFFF

# Lua Load  #
lua_load ~/.conky/draw_bg.lua
lua_draw_hook_pre draw_bg

lua_load ~/.conky/clock_rings.lua
lua_draw_hook_post clock_rings

TEXT
${voffset 8}${goto 25}${color FFFFFF}${font Ubuntu:size=16}${time %A}${font}${voffset -8}${alignr 50}${color FFFFFF}${font Ubuntu:size=38}${time %e}${font}
${color FFFFFF}${goto 25}${voffset -30}${color FFFFFF}${font Ubuntu:size=18}${time %b}${goto 75}${font Ubuntu:size=20}${time %Y}${font}${color 0B8904}
${voffset 150}${font Ubuntu:size=10}${font}
${font Ubuntu:size=12}${color FFFFFF}${alignr}${font}
${voffset -20}${alignr 50}${color FFFFFF}${font Ubuntu:size=38}${time %H}${font}
${alignr 50}${color FFFFFF}${font Ubuntu:size=38}${time %M}${font}

${voffset -95}
${color FFFFFF}${goto 23}${voffset 48}${cpu cpu0}%
${color 0B8904}${goto 23}CPU
${color FFFFFF}${goto 48}${voffset 23}${memperc}%
${color 0B8904}${goto 48}RAM
${color FFFFFF}${goto 73}${voffset 23}${swapperc}%
${color 0B8904}${goto 73}Swap
${color FFFFFF}${goto 98}${voffset 23}${fs_used_perc /}%
${color 0B8904}${goto 98}Disk
${color FFFFFF}${voffset 25}${alignr 62}${downspeed eth1}${goto 135}D
${color FFFFFF}${alignr 62}${upspeed eth1}${goto 135}U 
${color 0B8904}${goto 123}Net

${color FFFFFF}${font Ubuntu:size=8}${goto 55}Uptime: ${goto 100}${uptime_short}
${color FFFFFF}${font Ubuntu:size=8}${goto 42}Processes: ${goto 100}${processes}
${color FFFFFF}${font Ubuntu:size=8}${goto 50}Running: ${goto 100}${running_processes}}

draw_bg lua script

-- Change these settings to affect your background.
-- "corner_r" is the radius, in pixels, of the rounded corners. If you don't want rounded corners, use 0.

corner_r=0

-- Set the colour and transparency (alpha) of your background.

bg_colour=0x000000
bg_alpha=.8

require 'cairo'
function rgb_to_r_g_b(colour,alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function conky_draw_bg()
    if conky_window==nil then return end
    local w=conky_window.width
    local h=conky_window.height
    local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
    cr=cairo_create(cs)

    cairo_move_to(cr,corner_r,0)
    cairo_line_to(cr,w-corner_r,0)
    cairo_curve_to(cr,w,0,w,0,w,corner_r)
    cairo_line_to(cr,w,h-corner_r)
    cairo_curve_to(cr,w,h,w,h,w-corner_r,h)
    cairo_line_to(cr,corner_r,h)
    cairo_curve_to(cr,0,h,0,h,0,h-corner_r)
    cairo_line_to(cr,0,corner_r)
    cairo_curve_to(cr,0,0,0,0,corner_r,0)
    cairo_close_path(cr)

    cairo_set_source_rgba(cr,rgb_to_r_g_b(bg_colour,bg_alpha))
    cairo_fill(cr)
end

Screenshot of setup

                                         Screenshot

Question

I want to increase the background(drawn by the lua script using conky_window.height) to occupy the entire screen height.

Tried

Fix

Turns out that conky_window.height used by the lua script is preserved between conky restarts. Logging out and back in resolves this issue. Changing minimum_size works.

user80551
  • 1,549
  • 3
  • 15
  • 21

3 Answers3

3

Just add ${voffset 200} at the end of the .conckyrc file and play with the value.

Mikhail Morfikov
  • 10,309
  • 19
  • 69
  • 104
2

Just add some empty lines at the end of your .conkyrc.
Very nice script BTW.

  • Sorry, at the review I must have read "Just added some empty ...." and I interpreted that as you had done/suggested an edit and commented on it. – Anthon Jan 04 '14 at 20:12
  • Tried adding `${color FFFFFF}${font Ubuntu:size=20}${goto 50}Blah` a few times. The text gets cropped. http://imgur.com/KJ5uVD3 – user80551 Jan 05 '14 at 05:56
0

Like suggested by Mikhail you can also use ${voffset -xxx} with a negative value at the end of your script to reduce the size of your conky window if needed.