Code: Select all
--[[ Background by londonali1010 (2009)
VinDSL Background Hack (2010-2011)
This script draws a background to the Conky window. It covers the whole of the Conky window, but you can specify rounded corners, if you wish.
To call this script in Conky, use (assuming you have saved this script to ~/Scripts/):
lua_load ~/Scripts/draw_bg.lua
lua_draw_hook_pre draw_bg
Changelog:
+ v3.0 VinDSL Hack (01.28.2011) Killed memory leak.
+ v2.4 VinDSL Hack (01.25.2011) Declared all variables in local.
+ v2.3 VinDSL Hack (12.31.2010) Added shading example(s).
+ v2.2 VinDSL Hack (12.30.2010) Cleaned up the code a bit.
+ v2.1 VinDSL Hack (12.24.2010) Added cairo destroy function(s).
+ v2.0 VinDSL Hack (12.21.2010) Added height adjustment variable.
+ v1.0 Original release (07.10.2009)
]]
--------------START OF PARAMETERS ------------
-- 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.
local corner_r = 8
-- Set the colour and transparency (alpha) of your background (0.00 - 0.99).
-- (Light Shading Example)
-- local bg_colour = 0x4d4d4d
-- local bg_alpha = 0.50
-- (Medium Shading Example)
-- local bg_colour = 0x222222
-- local bg_alpha = 0.50
-- (Dark Shading Example)
-- local bg_colour = 0x000000
-- local bg_alpha = 0.50
local bg_colour = 0xd2d2d2
local bg_alpha = .4
-- Tweaks the height of your background, in pixels. If you don't need to adjust the height, use 0.
-- (Default Setting)
-- local vindsl_hack_height = 0
local vindsl_hack_height = -12
---------------END OF PARAMETERS -------------
require 'cairo'
local cs, cr = nil
local 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
if cs == nil then cairo_surface_destroy(cs) end
if cr == nil then cairo_destroy(cr) end
local w = conky_window.width
local h = conky_window.height
local v = vindsl_hack_height
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local 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+v-corner_r)
cairo_curve_to(cr,w,h+v,w,h+v,w-corner_r,h+v)
cairo_line_to(cr,corner_r,h+v)
cairo_curve_to(cr,0,h+v,0,h+v,0,h+v-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)
cairo_surface_destroy(cs)
cairo_destroy(cr)
end
Code: Select all
conky configuration
# set to yes if you want Conky to be forked in the background
background yes
# Use Xft?
use_xft yes
xftfont Sawasdee:bold:size=8
text_buffer_size 2048
xftalpha 1.0
# Print everything to console?
out_to_console no
# mail spool
#mail_spool $MAIL
# Update interval in seconds
update_interval 600
# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type override
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# Draw shades?
draw_shades yes
# Draw outlines?
draw_outline no
# Draw borders around text?
draw_borders no
# Stippled borders?
stippled_borders no
# border margins
border_inner_margin 1
# border width
border_width 0
# Default colors and also border colors
default_color 000000
color1 7a7a7a
color2 9a9a9a
color3 81c53c
color4 6571a8
color5 8480c2
color6 b980c2
color7 ad6a9f
color8 866aad
default_shade_color cbe5b3
default_outline_color 05110d
# Minimum size of text area
minimum_size 256
maximum_width 256
# Text alignment, other possible values are commented
alignment top_left
#alignment top_right
#alignment bottom_left
#alignment bottom_right
# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 36
gap_y 96
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 1
# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 1
# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes
# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer yes
# load .lua background script
lua_load ~/Scripts/draw_bg.lua
lua_draw_hook_pre draw_bg
# stuff after 'TEXT' will be formatted on screen
TEXT
${voffset -2}${font Sawasdee:bold:size=12}${color1}weather ${hr 2}${font}
${execpi 1800 conkyForecast --location=USIL0228 --template=~/Scripts/conkyForecast}
On a related note, how should I be dealing with updates and upgrades? I generally install all updates, (level 1-3), and for Upgrade Behavior in Synaptic, I have "always choose the highest version" selected, which was the default, and have thus far applied all upgrades, resulting in this latest breakage/regression. This is my first Debian/rolling distro experience, so I'm not sure what the best way to deal w/this is.