This is my current setup
1920x1080
- Conky on the right uses mrpeachy's 'mounted.lua' to monitor external mounted devices only, of which there are 4 in the image.
- "mounted.lua" does monitor ALL devices if you want it to.
- Add your own images or delete the calls.
Code:
### Begin Window Settings ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager
#own_window_hints undecorated,sticky,below,skip_taskbar,skip_pager
#own_window_colour gray
own_window_class Conky
own_window_title Top Left
# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes
### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### own_window_type normal
# own_window_argb_visual yes # Options: yes or no
### When ARGB visuals are enabled, this use this to modify the alpha value
### Use: own_window_type normal
### Use: own_window_transparent no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
# own_window_argb_value 255
minimum_size 230 0 ## width, height
maximum_width 230 ## width
gap_x 10 ### left &right
gap_y 10 ### up & down
alignment tr
#################################################### End Window Settings ###
### Font Settings ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont Monofur:bold:size=12 ##14
#xftfont White Rabbit:size=9
# X font when Xft is disabled, you can pick one with program xfontsel
#font 5x7
#font 6x10conky -c /media/5/Conky/S11-Top_Left.conky &
#font 7x13
#font 8x13
#font 9x15
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*
# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1
# Force UTF8? requires XFT ###
override_utf8_locale yes
uppercase no
###################################################### End Font Settings ###
### Color Settings #########################################################
draw_shades yes # amplifies text if yes
default_shade_color 000000
draw_outline no # amplifies text if yes
default_outline_color 000000
default_color DCDCDC #220 220 220 Gainsboro
color0 8FBC8F #143 188 143 DarkSeaGreen
color1 778899 #119 136 153 LightSlateGray
color2 FF8C00 #255 140 0 DarkOrange
color3 7FFF00 #127 255 0 Chartreuse
color4 FFA07A #255 160 122 LightSalmon
color5 FFDEAD #255 222 173 NavajoWhite
color6 00BFFF # 0 191 255 DeepSkyBlue
color7 00FFFF # 0 255 255 Cyan
color8 FFFF00 #255 255 0 Yellow
color9 B22222 #178 34 34 FireBrick ##FF0000 #255 0 0 Red
##################################################### End Color Settings ###
### Borders Section ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders yes #no
#default_graph_size 15 40
##################################################### End Borders Secton ###
### Miscellaneous Section ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background yes
# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none
# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 256
# Subtract (file system) buffers from used memory?
no_buffers yes
# change GiB to G and MiB to M
short_units yes
# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2
# Imlib2 image cache size, in bytes. Default 4MiB Increase this value if you use
# $image lots. Set to 0 to disable the image cache.
imlib_cache_size 0
# Maximum size of user text buffer, i.e. layout below TEXT line in config file
# (default is 16384 bytes)
# max_user_text 16384
# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
# temperature_unit Fahrenheit
############################################## End Miscellaneous Section ###
### LUA Settings ###########################################################
## Above and After TEXT - requires a composite manager or blinks.
##
# lua_load /media/5/Conky/LUA/draw-bg.lua
#TEXT
# ${lua conky_draw_bg 125 0 0 0 0 0x000000 0.2}
#
## ${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
##
## OR Both above TEXT (No composite manager required - no blinking!)
#
#--------------------------------
lua_load /media/5/Conky/LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 20 0 0 0 0 0x000000 0.2
#lua_draw_hook_post draw_bg 20 0 0 0 0 0x000000 0.2
#
# TEXT
# ${lua conky_draw_bg 20 0 0 0 0 0x000000 0.2}
##
#
### mount.lua ##################################################################
#
##instructions
##load script
##lua_load ~/path_to/mounted.lua
lua_load /media/5/Conky/LUA/mounted.lua
## first lua command below text:
## ${lua get_mounted_data interval}, where interval is a number. This starts data gathering
## to get output:
## ${lua mount partition_number data_type}, where partition number is a number
## data_type can be
## total - shows total number of partitions mounted, requires a partition_number also, use 1, could be used in an if_match
## fsys - shows filesystem
## size - shows space used in appropriate units
## free - shows free space in appropriate units
## use% - shows % used
## mount - shows mountpoint
####################################################### End LUA Settings ###
update_interval 1
TEXT
${lua get_mounted_data 3}${lua conky_draw_bg 20 0 0 0 0 0x000000 0.4}\
${image /media/5/Conky/images/EVE.png -p 15,0 -s 60x60}\
${image /media/5/Conky/images/Wall.E.png -p 55,0 -s 60x60}\
${image /media/5/Conky/images/S11_128.png -p 0,100 -s 60x60}\
${color5}${alignr 5}${time %x}
${alignr 5}${time %T}
${alignr 5}${uptime_short}${color}
${alignc}${kernel}
${color7}${hr}${color}
${alignc}${font Dock 51:size=18}${color1}${nodename}${color}${font}
${goto 65}% Used${goto 170}${color} Total
Root ${color5}${fs_used_perc /}${goto 100}${fs_used /}${goto 170}${color7} ${alignr 5}${color5} ${fs_size /}${color}
Home ${color5}${fs_used_perc /home}${goto 100}${fs_used /home}${goto 170}${color7} ${alignr 5}${color5} ${fs_size /home}${color}
M|5 ${color5}${fs_used_perc /media/5}${goto 100}${fs_used /media/5}${goto 170}${color7} ${alignr 5}${color5} ${fs_size /media/5}${color}${font Monofur:size=6}
${font} RAM ${color5}${memperc}${goto 100}${mem}${goto 170}${color7} ${alignr 5}${color5} ${memmax}${color}${font Monofur:size=6}
${font}${alignc}Avg CPU % in use ${if_match ${cpu cpu0}<10}${color1}00${color5}${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100}${color1}0${color7}${cpu cpu0}\
${else}${color9}${cpu cpu0}${endif}${endif}${color}${font Monofur:size=6}
${font}${alignc}1 ${if_match ${cpu cpu1}<10}${color1}00${color5}${cpu cpu1}\
${else}${if_match ${cpu cpu1}<100}${color1}0${color7}${cpu cpu1}\
${else}${color9}${cpu cpu1}${endif}${endif}${color}\
2 ${if_match ${cpu cpu2}<10}${color1}00${color5}${cpu cpu2}\
${else}${if_match ${cpu cpu2}<100}${color1}0${color7}${cpu cpu2}\
${else}${color9}${cpu cpu2}${endif}${endif}${color}\
3 ${if_match ${cpu cpu3}<10}${color1}00${color5}${cpu cpu3}\
${else}${if_match ${cpu cpu3}<100}${color1}0${color7}${cpu cpu3}\
${else}${color9}${cpu cpu3}${endif}${endif}${color}${font Monofur:size=6}
${font}CPU Fan${alignr 5}${color5}${platform f71882fg.2560 fan 1} ${color}rpm${font Monofur:size=6}
${font}Temperatures ${color7}${hr}${color}
${alignc}CPU ${color5}${platform f71882fg.2560 temp 1}${color}°\
MB ${color5}${platform f71882fg.2560 temp 2}${color}°
${alignc}GPU ${color5}${nvidia temp}${color}°\
HD ${color5}${execi 5 hddtemp -n /dev/sda}${color}°${font Monofur:size=6}
${font}Graphics GPU ${color5}${nvidia temp}${color}° ${color7}${hr}${color}
GPU ${color5}${nvidia gpufreq} ${color}MHz${alignr 5}MEM ${color5}${nvidia memfreq} ${color}MHz${font Monofur:size=6}
${font}Disk Activity ${color7}${hr}${color}
R${goto 40}${diskiograph_read /dev/sda 14,130 00ffff ff0000 5 -lt}${alignr 5}${color5}${diskio_read /dev/sda}${color}
W${goto 40}${diskiograph_write /dev/sda 14,130 ff0000 00ffff 5 -lt}${alignr 5}${color5}${diskio_write /dev/sda}${color}${font Monofur:size=6}
${font}Network ${color7}${hr}${color}
Dn${goto 40}${downspeedgraph eth0 14,130 00ffff ff0000 5 -lt}${alignr 5}${color5}${downspeedf eth0}${color}
Up${goto 40}${upspeedgraph eth0 14,130 ff0000 00ffff 5 -lt}${alignr 5}${color5}${upspeedf eth0}${color}${font Monofur:size=6}
${font}Transfer Totals ${color7}${hr}${color}
${color5}rx ↓${goto 85}${color0}tx ↑${goto 170}${color5}Total
${goto 5}${color}${execpi 3600 date --date="-1 day" | awk '{print $3" "$2" "$6}'}
${color5}${execpi 300 vnstat | grep "yesterday" | awk '{print $2" "$3"\
${color0}${goto 85}"$5" "$6 "\
${color5}${goto 170}" $8" "$9}'}
${goto 5}${color}${exec date --date="0 day" | awk '{print $3" "$2" "$6}'}
${color5}${execpi 300 vnstat | grep "today" | awk '{print $2" "$3"\
${color0}${goto 85}"$5" "$6"\
${color5}${goto 170}"$8" "$9}'}
${goto 5}${color}Current Week
${color5}${execpi 300 vnstat -w | grep "current week" | awk '{print $3" "$4 "\
${color0}${goto 85}" $6" "$7 "\
${color5}${goto 170}" $9" "$10}'}
${goto 5}${color}Last Week
${color5}${execpi 300 vnstat -w | grep "last week" | awk '{print $3" "$4"\
${color0}${goto 85}" $6" "$7 "\
${color5}${goto 170}" $9" "$10}'}
${goto 5}${color}Last 7 Days
${color5}${execpi 300 vnstat -w | grep "last 7 days" | awk '{print $4" "$5 "\
${color0}${goto 85}" $7" "$8 "\
${color5}${goto 170}" $10" "$11}'}
${goto 5}${color}${time %b %Y}
${color5}${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $3" "$4}'}\
${color0}${goto 85}${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $6" "$7}'}\
${color5}${goto 170}${execi 300 vnstat -m | grep "`date +"%b %y"`" | awk '{print $9" "$10}'}${font Monofur:size=6}
${font}${color}External Mounted fsys ${color7}${hr}${color}
${goto 5}${color}Size${goto 60}${color0}Free${goto 110}${color4}Used${goto 160}
${color5}${lua mount 6 mount}
${goto 5}${color}${lua mount 6 size}${goto 60}${color0}${lua mount 6 free}${goto 110}${color4}${lua mount 6 use%}${goto 160}${color5}${lua mount 6 fsys 9}
${color5}${lua mount 7 mount}
${goto 5}${color}${lua mount 7 size}${goto 60}${color0}${lua mount 7 free}${goto 110}${color4}${lua mount 7 use%}${goto 160}${color5}${lua mount 7 fsys 9}
${color5}${lua mount 8 mount}
${goto 5}${color}${lua mount 8 size}${goto 60}${color0}${lua mount 8 free}${goto 110}${color4}${lua mount 8 use%}${goto 160}${color5}${lua mount 8 fsys 9}
${color5}${lua mount 9 mount}
${goto 5}${color}${lua mount 9 size}${goto 60}${color0}${lua mount 9 free}${goto 110}${color4}${lua mount 9 use%}${goto 160}${color5}${lua mount 9 fsys 9}${font}
${color7}${hr 1}${color}
${color}Trash ${color9}${execi 15 du -sh ~/.local/share/Trash/files/ | awk '{print $1}' | sed '/^4.0K/ d' | sed 's/$/ of trash!/'}
mounted.lua
Code:
--[[partitions for conky by mrpeachy
##instructions
##load script
lua_load ~/lua/mounted.lua
## first lua command below text:
## ${lua get_mounted_data interval}, where interval is a number. This starts data gathering
## to get output:
## ${lua mount partition_number data_type text_length}, where partition number is a number
## text_length is optional, lets you specify the max number of characters the function returns. only affects fsys and mount data options
## data_type can be
## total - shows total number of partitions mounted, requires a partition_number also, use 1, could be used in an if_match
## fsys - shows filesystem
## size - shows space used in appropriate units
## free - shows free space in appropriate units
## use% - shows % used
## mount - shows mountpoint
TEXT
CPU %: ${cpu cpu0} ${lua get_mounted_data 10}
TOTAL PARTITIONS MOUNTED: ${lua mount 1 total}
FSYS${goto 100}SIZE${goto 200}USED%${goto 300}MOUNT
${lua mount 1 fsys}${goto 100}${lua mount 1 size}${goto 200}${lua mount 1 use%}${goto 300}${lua mount 1 mount 10}
${lua mount 2 fsys}${goto 100}${lua mount 2 size}${goto 200}${lua mount 2 use%}${goto 300}${lua mount 2 mount 10}
${lua mount 3 fsys}${goto 100}${lua mount 3 size}${goto 200}${lua mount 3 use%}${goto 300}${lua mount 3 mount 10}
${lua mount 4 fsys}${goto 100}${lua mount 4 size}${goto 200}${lua mount 4 use%}${goto 300}${lua mount 4 mount 10}
]]
conky_start=1
function conky_get_mounted_data(interval)
local updates=tonumber(conky_parse("${updates}"))
timer=(updates % interval)
if timer==0 or conky_start==1 then
fsys={}
size={}
used={}
avail={}
uperc={}
mount={}
local file = io.popen("df -h")
for line in file:lines() do
if string.find(line,"/dev/")~=nil then
local s,f,fs=string.find(line,"^([%d%a%p]*)%s")
table.insert(fsys,fs)
local s,f,sz=string.find(line,"%s*([%d%a%p]*)%s",f)
table.insert(size,sz)
local s,f,us=string.find(line,"%s*([%d%a%p]*)%s",f)
table.insert(used,us)
local s,f,av=string.find(line,"%s*([%d%a%p]*)%s",f)
table.insert(avail,av)
local s,f,up=string.find(line,"%s*([%d%a%p]*)%s",f)
table.insert(uperc,up)
local s,f,mn=string.find(line,"%s*([%d%a%p]*)%s*$",f)
table.insert(mount,mn)
end
end
file:close()
conky_start=nil
end--timed section
return ""
end
function conky_mount(n,d,c)--n=partition_number,d=data_type,c=number of characters to return
d=tostring(d)
n=tonumber(n)
c=tonumber(c) or 0
if d=="total" then
data=#fsys or 1
elseif d=="fsys" then
data=fsys[n] or ""
if c~=0 then
data=string.sub(data,1,c) or ""
end
elseif d=="size" then
data=size[n] or ""
elseif d=="used" then
data=used[n] or ""
elseif d=="free" then
data=avail[n] or ""
elseif d=="use%" then
data=uperc[n] or ""
elseif d=="mount" then
data=mount[n] or ""
if c~=0 then
data=string.sub(data,1,c) or ""
end
else
data="check data type"
end
return data
end--end main function
Conky on the left uses mrpeachy's v9000 LUA weather script, you will need to get that if you do not have it.
Code:
### Begin Window Settings ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal #override
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager
#own_window_hints undecorated,sticky,below,skip_taskbar,skip_pager
own_window_colour gray
own_window_class Conky
own_window_title Vert_Right
# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes
### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### own_window_type normal
# own_window_argb_visual yes
### When ARGB visuals are enabled, this use this to modify the alpha value
### Use: own_window_type normal
### Use: own_window_transparent no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
# own_window_argb_value 0
minimum_size 50 760 ## width, height
maximum_width 50 ## width, usually a good idea to equal minimum width
gap_x 10 # left-right
gap_y 10 # up-down
alignment tl #top_right
################################################### End Window Settings ###
### Font Settings #########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
#xftfont Anonymous Pro:bold:size=8
xftfont Monofur:bold:size=10
# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1
# Force UTF8? requires XFT ###
override_utf8_locale yes
uppercase no
###################################################### End Font Settings ###
### Color Settings #########################################################
draw_shades yes
default_shade_color black
draw_outline no # amplifies text if yes
default_outline_color black
default_color DCDCDC #220 220 220 Gainsboro
color0 8FBC8F #143 188 143 DarkSeaGreen
color1 F0FFFF #240 255 255 Azure
color2 FF8C00 #255 140 0 DarkOrange
color3 7FFF00 #127 255 0 Chartreuse
color4 FFA07A #255 160 122 LightSalmon
color5 FFDEAD #255 222 173 NavajoWhite
color6 00BFFF # 0 191 255 DeepSkyBlue
color7 00FFFF # 0 255 255 Cyan
color8 FFFF00 #255 255 0 Yellow
color9 FF0000 #255 0 0 Red
##################################################### End Color Settings ###
### Borders Section ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders no #yes
#default_graph_size 15 40
##################################################### End Borders Secton ###
### Miscellaneous Section ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background no
# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none
# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 1028
# Subtract (file system) buffers from used memory?
no_buffers yes
# change GiB to G and MiB to M
short_units yes
# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2
# Maximum size of user text buffer, i.e. layout below TEXT line in config file
# (default is 16384 bytes)
# max_user_text 16384
# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
# temperature_unit Fahrenheit
############################################## End Miscellaneous Section ###
### LUA Settings ###########################################################
## Above and After TEXT - requires a composite manager or blinks.
##
# lua_load /media/5/Conky/LUA/draw-bg.lua
#TEXT
#${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}
#
## ${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
##
## OR Both above TEXT (No composite manager required - no blinking!)
#
lua_load /media/5/Conky/LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.2
# lua_draw_hook_post draw-bg 125 0 0 0 0 0x000000 0.01
#
# TEXT
#
############### V9000 ########################################################
#starts the lua weather data gathering function, call once at top of conkyrc
lua_load ~/v9000/v9000.lua
lua_draw_hook_post weather
lua_load /media/5/Conky/templates/S11_V9_R-template.lua
####################################################### End LUA Settings ###
# The all important - How often conky refreshes.
# If you have a "Crey" try: 0.2 - smokin' - but watch the CPU useage go UP!
update_interval 1
TEXT
${lua conky_draw_bg 10 0 0 0 0 0x000000 0.3}
S11_V9_R-template.lua
Code:
--[[
The latest script is a lua only weather script. aka: v9000
http://crunchbanglinux.org/forums/topic/16100/weather-in-conky/
the file:
http://dl.dropbox.com/u/19008369/current%20v9000/v9000.tar.gz
mrppeachys LUA Tutorial
http://crunchbanglinux.org/forums/topic/17246/how-to-using-lua-scripts-in-conky/
]]
_G.weather_script = function()--#### DO NOT EDIT THIS LINE ##############
--these tables hold the coordinates for each repeat do not edit #########
top_left_x_coordinate={}--###############################################
top_left_y_coordinate={}--###############################################
--#######################################################################
--SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
-- default_font="CorporateMonoExtraBold"--font must be in quotes
-- default_font_size=10
default_font="monofur" --font must be in quotes
default_font_size=13
default_color=0xffffff --white
default_alpha=1 --fully opaque
default_image_width=20
default_image_height=20
-- ## New Options ###
-- ##################
default_face="bold"
-- "normal" for normal/normal
-- "bold" for normal/bold
-- "italic" for italic/normal
-- "bolditalic" for italic/bold
--END OF DEFAULTS #######################################################
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE
datay=15 -- ↑↓
datayh=55
datayf=75
datayy=13 --datay+(datayy*1)
imgyh=165
imgyf=190
imgyy=39 -- imgy+(imgyy*1)
out({c=0x00FFFF,a=1,x=12,y=15,txt="BsAs"})
-- today is
out({c=0x00FFFF,a=1,x=5,y=28,txt=forecast_day_short[1]})
out({c=0x00FFFF,a=1,x=35,y=datay+datayy,txt=forecast_date[1]})
-- out({c=0x00FFFF,,a=1,x=6,y=50,txt="cpu:"..conky_parse("${cpu}")})
out({c=0xF0FFFF,a=1,x=5,y=datay+(datayy*2),txt=low_temp[1]})
out({c=0xFF8C00,a=1,x=30,y=datay+(datayy*2),txt=high_temp[1]})
image({x=5,y=45,h=45,w=45,file=weather_icon[1]})
--image({x=5,y=45,h=45,w=45,file="/media/5/Conky/images/red+x.png"})
out({c=0xFFDEAD,a=1,x=15,y=datay+(datayy*7),txt="NOW"})
out({c=0xF0FFFF,a=1,x=7,y=datay+(datayy*8),txt=now["temp"]})
out({c=0xFFDEAD,a=1,x=30,y=datay+(datayy*8),txt=now["feels_like"]})
image({x=5,y=120,h=45,w=45,file=now["weather_icon"]})
--image({x=5,y=120,h=45,w=45,file="/media/5/Conky/images/red+x.png"})
out({c=0x00FFFF,a=1,x=5,y=datay+(datayy*12.5),txt="B.P."})
out({c=0xF0FFFF,a=1,x=5,y=datay+(datayy*13.4),txt=now["pressure_mb"]})
out({c=0x00FFFF,a=1,x=5,y=datay+(datayy*14.5),txt="Hum"})
out({c=0xF0FFFF,a=1,x=30,y=datay+(datayy*14.5),txt=now["humidity"].."%"})
out({c=0x00FFFF,a=1,x=5,y=datay+(datayy*15.5),txt="DP"})
out({c=0xF0FFFF,a=1,x=30,y=datay+(datayy*15.5),txt=now["dew_point"].."°"})
out({c=0x00FFFF,a=1,x=5,y=datay+(datayy*16.5),txt="UV"})
out({c=0xF0FFFF,a=1,x=30,y=datay+(datayy*16.5),txt=uv_index_num[1]})
out({c=0xF0FFFF,a=1,x=5,y=datay+(datayy*17.5),txt=uv_index_txt[1]})
-- yellow line
image({w=45,h=1,x=5,y=datayh+(datayy*15),file="/media/5/Conky/images/yellow_1.png"})
out({c=0xFFDEAD,a=1,x=10,y=datayh+(datayy*16),txt="3 HRS"})
-- 3 hour output
-- 1st hour
out({c=0x00FFFF,a=1,x=11,y=datayh+(datayy*17),txt=now["fc_hour1_time_24"]..":00"})
image({x=25,y=imgyh+(imgyy*3),file=now["fc_hour1_wicon"]})
--image({x=25,y=imgyh+(imgyy*3),file="/media/5/Conky/images/red+x.png"})
out({c=0xF0FFFF,a=1,x=5,y=datayh+(datayy*18.5),txt=now["fc_hour1_temp"]})
-- 2nd hour
out({c=0x00FFFF,a=1,x=11,y=datayh+(datayy*20),txt=now["fc_hour2_time_24"]..":00"})
image({x=25,y=imgyh+(imgyy*4),file=now["fc_hour2_wicon"]})
--image({x=25,y=imgyh+(imgyy*4),file="/media/5/Conky/images/red+x.png"})
out({c=0xF0FFFF,a=1,x=5,y=datayh+(datayy*21.5),txt=now["fc_hour2_temp"]})
-- 3rd hour
out({c=0x00FFFF,a=1,x=11,y=datayh+(datayy*23),txt=now["fc_hour3_time_24"]..":00"})
image({x=25,y=imgyh+(imgyy*5),file=now["fc_hour3_wicon"]})
--image({x=25,y=imgyh+(imgyy*5),file="/media/5/Conky/images/red+x.png"})
out({c=0xF0FFFF,a=1,x=5,y=datayh+(datayy*24.5),txt=now["fc_hour3_temp"]})
-- start of forcast days
-- yellow line
image({w=45,h=1,x=5,y=datayf+(datayy*24.5),file="/media/5/Conky/images/yellow_1.png"})
out({c=0xFFDEAD,a=1,x=10,y=datayf+(datayy*25.5),txt="9 DAY"})
out({c=0x00FFFF,a=1,x=5,y=datayf+(datayy*26.5),txt=forecast_day_short[2]})
out({c=0x00FFFF,a=1,x=35,y=datayf+(datayy*26.5),txt=forecast_date[2]})
image({x=25,y=imgyf+(imgyy*6),file=weather_icon[2]})
--image({x=25,y=imgyf+(imgyy*6),file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=5,y=datayf+(datayy*27.5),txt=high_temp[2]})
out({c=0xF0FFFF,a=1,x=5,y=datayf+(datayy*28.5),txt=low_temp[2]})
out({c=0x00FFFF,a=1,x=5,y=datayf+(datayy*29.5),txt=forecast_day_short[3]})
out({c=0x00FFFF,a=1,x=35,y=datayf+(datayy*29.5),txt=forecast_date[3]})
image({x=25,y=imgyf+(imgyy*7),file=weather_icon[3]})
--image({x=25,y=imgyf+(imgyy*7),file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=5,y=datayf+(datayy*30.5),txt=high_temp[3]})
out({c=0xF0FFFF,a=1,x=5,y=datayf+(datayy*31.5),txt=low_temp[3]})
out({c=0x00FFFF,a=1,x=5,y=datayf+(datayy*32.5),txt=forecast_day_short[4]})
out({c=0x00FFFF,a=1,x=35,y=datayf+(datayy*32.5),txt=forecast_date[4]})
image({x=25,y=imgyf+(imgyy*8),file=weather_icon[4]})
--image({x=25,y=imgyf+(imgyy*8),file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=5,y=datayf+(datayy*33.5),txt=high_temp[4]})
out({c=0xF0FFFF,a=1,x=5,y=datayf+(datayy*34.5),txt=low_temp[4]})
out({c=0x00FFFF,a=1,x=5,y=datayf+(datayy*35.5),txt=forecast_day_short[5]})
out({c=0x00FFFF,a=1,x=35,y=datayf+(datayy*35.5),txt=forecast_date[5]})
image({x=25,y=imgyf+(imgyy*9),file=weather_icon[5]})
--image({x=25,y=imgyf+(imgyy*9),file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=5,y=datayf+(datayy*36.5),txt=high_temp[5]})
out({c=0xF0FFFF,a=1,x=5,y=datayf+(datayy*37.5),txt=low_temp[5]})
out({c=0x00FFFF,a=1,x=5,y=datayf+(datayy*38.5),txt=forecast_day_short[6]})
out({c=0x00FFFF,a=1,x=35,y=datayf+(datayy*38.5),txt=forecast_date[6]})
image({x=25,y=imgyf+(imgyy*10),file=weather_icon[6]})
--image({x=25,y=imgyf+(imgyy*10),file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=5,y=datayf+(datayy*39.5),txt=high_temp[6]})
out({c=0xF0FFFF,a=1,x=5,y=datayf+(datayy*40.5),txt=low_temp[6]})
out({c=0x00FFFF,a=1,x=5,y=datayf+(datayy*41.5),txt=forecast_day_short[7]})
out({c=0x00FFFF,a=1,x=35,y=datayf+(datayy*41.5),txt=forecast_date[7]})
image({x=25,y=imgyf+(imgyy*11),file=weather_icon[7]})
--image({x=25,y=imgyf+(imgyy*11),file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=5,y=datayf+(datayy*42.5),txt=high_temp[7]})
out({c=0xF0FFFF,a=1,x=5,y=datayf+(datayy*43.5),txt=low_temp[7]})
out({c=0x00FFFF,a=1,x=5,y=datayf+(datayy*44.5),txt=forecast_day_short[8]})
out({c=0x00FFFF,a=1,x=35,y=datayf+(datayy*44.5),txt=forecast_date[8]})
image({x=25,y=imgyf+(imgyy*12),file=weather_icon[8]})
--image({x=25,y=imgyf+(imgyy*12),file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=5,y=datayf+(datayy*45.5),txt=high_temp[8]})
out({c=0xF0FFFF,a=1,x=5,y=datayf+(datayy*46.5),txt=low_temp[8]})
out({c=0x00FFFF,a=1,x=5,y=datayf+(datayy*47.5),txt=forecast_day_short[9]})
out({c=0x00FFFF,a=1,x=35,y=datayf+(datayy*47.5),txt=forecast_date[9]})
image({x=25,y=imgyf+(imgyy*13),file=weather_icon[9]})
--image({x=25,y=imgyf+(imgyy*13),file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=5,y=datayf+(datayy*48.5),txt=high_temp[9]})
out({c=0xF0FFFF,a=1,x=5,y=datayf+(datayy*49.5),txt=low_temp[9]})
out({c=0x00FFFF,a=1,x=5,y=datayf+(datayy*50.5),txt=forecast_day_short[10]})
out({c=0x00FFFF,a=1,x=35,y=datayf+(datayy*50.5),txt=forecast_date[10]})
image({x=25,y=imgyf+(imgyy*14),file=weather_icon[10]})
--image({x=25,y=imgyf+(imgyy*14),file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=5,y=datayf+(datayy*51.5),txt=high_temp[10]})
out({c=0xF0FFFF,a=1,x=5,y=datayf+(datayy*52.5),txt=low_temp[10]})
-- yellow line
--image({w=45,h=1,x=5,y=550,file="/media/5/Conky/images/yellow_1.png"})
--#######################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################
The bottom conky
- Uses conkyEmail and is designed for 4 email accounts with a max of 99 new unread emails for each account, I'll never reach that - the Desktop I'm on at the time and the currency exchange rate.
Code:
# To use #! in a conky use: ${exec echo '#!'}
# killall conky && conky -c /media/5/Conky/S11_Email_1.conky &
# WARNING: Change name and passwords on e-mail code if posting!!
### Begin Window Settings ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
#own_window_hints undecorated,below,skip_taskbar,skip_pager
own_window_hints undecorated,sticky,below,skip_taskbar,skip_pager
#own_window_colour gray
own_window_class Conky
own_window_title Email 1 Line
# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes
### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### own_window_type normal
# own_window_argb_visual yes # Options: yes or no
### When ARGB visuals are enabled, this use this to modify the alpha value
### Use: own_window_type normal
### Use: own_window_transparent no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
# own_window_argb_value 255
minimum_size 730 0 ##420 420 ## width, height
maximum_width 730 ##420 ## width
gap_x 0 ### left &right
gap_y 35 ### up & down
alignment bm
#################################################### End Window Settings ###
### Font Settings ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont Monofur:bold:size=16
#xftfont White Rabbit:size=9
# X font when Xft is disabled, you can pick one with program xfontsel
#font 5x7
#font 6x10
#font 7x13
#font 8x13
#font 9x15
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*
# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1
# Force UTF8? requires XFT ###
override_utf8_locale yes
uppercase no
###################################################### End Font Settings ###
### Color Settings #########################################################
draw_shades yes # amplifies text if yes
default_shade_color 000000
draw_outline no # amplifies text if yes
default_outline_color 000000
default_color DCDCDC #220 220 220 Gainsboro
color0 8FBC8F #143 188 143 DarkSeaGreen
color1 778899 #119 136 153 LightSlateGray
color2 FF8C00 #255 140 0 DarkOrange
color3 7FFF00 #127 255 0 Chartreuse
color4 FFA07A #255 160 122 LightSalmon
color5 FFDEAD #255 222 173 NavajoWhite
color6 00BFFF # 0 191 255 DeepSkyBlue
color7 00FFFF # 0 255 255 Cyan
color8 FFFF00 #255 255 0 Yellow
color9 B22222 #178 34 34 FireBrick ##FF0000 #255 0 0 Red
##################################################### End Color Settings ###
### Borders Section ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders yes #no
#default_graph_size 15 40
##################################################### End Borders Secton ###
### Miscellaneous Section ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background yes
# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none
# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 256
# Subtract (file system) buffers from used memory?
no_buffers yes
# change GiB to G and MiB to M
short_units yes
# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2
# Imlib2 image cache size, in bytes. Default 4MiB Increase this value if you use
# $image lots. Set to 0 to disable the image cache.
imlib_cache_size 0
# Maximum size of user text buffer, i.e. layout below TEXT line in config file
# (default is 16384 bytes)
# max_user_text 16384
# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
# temperature_unit Fahrenheit
############################################## End Miscellaneous Section ###
### LUA Settings ###########################################################
## Above and After TEXT - requires a composite manager or blinks.
##
# lua_load /media/5/Conky/LUA/draw-bg.lua
#TEXT
# ${lua conky_draw_bg 125 0 0 0 0 0x000000 0.2}
#
## ${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
##
## OR Both above TEXT (No composite manager required - no blinking!)
#
#--------------------------------
lua_load /media/5/Conky/LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 20 0 0 0 0 0x000000 0.2
#lua_draw_hook_post draw_bg 20 0 0 0 0 0x000000 0.2
#
# TEXT
# ${lua conky_draw_bg 20 0 0 0 0 0x000000 0.2}
##
#
####################################################### End LUA Settings ###
update_interval 1
TEXT
${lua conky_draw_bg 10 0 0 0 0 0x000000 0.4}\
Email ${color5}C ${color7}${if_match ${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --port=NUMBER --username=USER-NAME --password=PASSWORD} == 0}\
00${else}\
${if_match ${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --port=NUMBER --username=USER-NAME --password=PASSWORD} < 9}0\
${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --port=NUMBER --username=USER-NAME --password=PASSWORD}${else}\
${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --port=NUMBER --username=USER-NAME --password=PASSWORD}\
${endif}${endif}\
:\
${if_match ${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --ssl --port=NUMBER --username=USER-NAME --password=PASSWORD} == 0}\
00${else}\
${if_match ${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --ssl --port=NUMBER --username=USER-NAME --password=PASSWORD} < 10}0\
${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --ssl --port=NUMBER --username=USER-NAME --password=PASSWORD}${else}\
${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --ssl --port=NUMBER --username=USER-NAME --password=PASSWORD}\
${endif}${endif}\
${color5}S ${color7}${if_match ${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --port=NUMBER --username=USER-NAME --password=PASSWORD} == 0}\
00${else}\
${if_match ${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --port=NUMBER --username=USER-NAME --password=PASSWORD} < 9}0\
${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --port=NUMBER --username=USER-NAME --password=PASSWORD}${else}\
${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --port=NUMBER --username=USER-NAME --password=PASSWORD}\
${endif}${endif}\
:\
${if_match ${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --ssl --port=NUMBER --username=USER-NAME --password=PASSWORD} == 0}\
00${else}\
${if_match ${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --ssl --port=NUMBER --username=USER-NAME --password=PASSWORD} < 10}0\
${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --ssl --port=NUMBER --username=USER-NAME --password=PASSWORD}${else}\
${execi 90 conkyEmail --servername=MAIL-SERVER --servertype=POP --ssl --port=NUMBER --username=USER-NAME --password=PASSWORD}\
${endif}${endif}\
${color5}D ${color6}${desktop_name}\
${color5}1 CAD ${color}=${color7} ${execi 1800 wget --timeout=1.0 --tries=1 -O - http://themoneyconverter.com/rss-feed/CAD/rss.xml | grep "Argentine Peso" | cut -c 40-47}\
${color5}1 ARS ${color}=${color7} ${execi 1800 wget --timeout=1.0 --tries=1 -O - http://themoneyconverter.com/rss-feed/ARS/rss.xml | grep "Canadian Dollar" | cut -c 39-45}
draw-bg.lua - used by all conkys.
Code:
--[[Background originally by londonali1010 (2009)
ability to set any size for background mrpeachy 2011
ability to set variables for bg in conkyrc dk75
the change is that if you set width and/or height to 0
then it assumes the width and/or height of the conky window
so:
Above and After TEXT (requires a composite manager or it blinks!)
lua_load ~/wea_conky/draw_bg.lua
TEXT
${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}
OR Both above TEXT (no composite manager required - no blinking!)
lua_load ~/wea_conky/draw_bg.lua
lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.2
TEXT
Note
${lua conky_draw_bg 20 0 0 0 0 0x000000 0.2}
See below: 1 2 3 4 5 6 7
${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
covers the whole window and will change if you change the minimum_size setting
1 = 20 corner_radius
2 = 0 x_position
3 = 0 y_position
3 = 0 width
5 = 0 height
6 = 0x000000 color
7 = 0.4 alpha
######### calendar function ##################################################
then to use it, you activate the calendar function BELOW TEXT like this
${lua luacal {settings}}
#${lua luacal {x=,y=,tf="",tfs=,tc=,ta=,bf="",bfs=,bc=,ba=,hf="",hfs=,hc=,ha=,sp="",gh=,gt=,gv=,sd=}}
# x=x position top left
# y=y position top left
# tf=title font, eg "mono" must be in quotes
# tfs=title font size
# tc=title color
# ta=title alpha
# bf=body font, eg "mono" must be in quotes
# bfs=body font size
# bc=body color
# ba=body alpha
# hf=highlight font, eg "mono" must be in quotes
# hfs=highlight font size
# hc=highlight color
# ha=highlight alpha
# sp=spacer, eg " " or sp="0"... 0,1 or 2 spaces can help with positioning of non-monospaced fonts
# gt=gap from title to body
# gh=gap horizontal between columns
# gv=gap vertical between rows
# sd=start day, 0=Sun, 1=Mon
# hstyle = heading style, 0=just days, 1=date insert
# tdf=title date font, eg "mono" must be in quotes
# tdfs=title date font size
# tdc=title date color
# tda=title date alpha
# test line
-- ${lua luacal {x=10,y=100,tf="Purisa",tfs=24,tc=0xf67e16,ta=1,bf="First Order",bfs=26,bc=0xecd32a,ba=1,hf="Purisa",hfs=18,hc=0xf67e16,ha=1,sp=" ",gh=40,gt=25,gv=20,sd=0,hstyle=1,tdf="First Order",tdfs=28,tdc=0xff0000,tda=1}}
]]
require 'cairo'
local cs, cr = nil
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(r,x,y,w,h,color,alpha)
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 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)
w=w
h=h
if w=="0" then w=tonumber(conky_window.width) end
if h=="0" then h=tonumber(conky_window.height) end
cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
--top left mid circle
local xtl=x+r
local ytl=y+r
--top right mid circle
local xtr=(x+r)+((w)-(2*r))
local ytr=y+r
--bottom right mid circle
local xbr=(x+r)+((w)-(2*r))
local ybr=(y+r)+((h)-(2*r))
--bottom right mid circle
local xbl=(x+r)
local ybl=(y+r)+((h)-(2*r))
-----------------------------
cairo_move_to (cr,xtl,ytl-r)
cairo_line_to (cr,xtr,ytr-r)
cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
cairo_line_to (cr,xbr+r,ybr)
cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
cairo_line_to (cr,xbl,ybl+r)
cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
cairo_line_to (cr,xtl-r,ytl)
cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
cairo_close_path(cr)
cairo_fill (cr)
------------------------------------------------------------
cairo_surface_destroy(cs)
cairo_destroy(cr)
return ""
end
-- ###### calendar function ##################################################
function conky_luacal(caltab) -- {x=,y=,tf="",tfs=,tc=,ta=,bf="",bfs=,bc=,ba=,hf="",hfs=,hc=,ha=,sp="",gt=,gh=,gv=,sd=,hstyle=,tdf=,tdfs=,tdc=,tda=}
if conky_window == nil then return end
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)
--############################################################################
if caltab.x==nil then
caltab=loadstring("return" .. caltab)()
end
local cal_x=caltab.x
local cal_y=caltab.y
local tfont=caltab.tf or "mono"
local tfontsize=caltab.tfs or 12
local tc=caltab.tc or 0xffffff
local ta=caltab.ta or 1
local bfont=caltab.bf or "mono"
local bfontsize=caltab.bfs or 12
local bc=caltab.bc or 0xffffff
local ba=caltab.ba or 1
local hfont=caltab.hf or "mono"
local hfontsize=caltab.hfs or 12
local hc=caltab.hc or 0xff0000
local ha=caltab.ha or 1
local spacer=caltab.sp or " "
local gaph=caltab.gh or 20
local gapt=caltab.gt or 15
local gapl=caltab.gv or 15
local sday=caltab.sd or 0
local hstyle=caltab.hstyle or 0
--convert colors
--local font=string.gsub(font,"_"," ")
local tred,tgreen,tblue,talpha=rgb_to_r_g_b(tc,ta)
--main body text color
local bred,bgreen,bblue,balpha=rgb_to_r_g_b(bc,ba)
--highlight text color
local hred,hgreen,hblue,halpha=rgb_to_r_g_b(hc,ha)
--############################################################################
--calendar calcs
local year=os.date("%G")
local today=tonumber(os.date("%d"))
local t1 = os.time( { year=year,month=03,day=01,hour=00,min=0,sec=0} );
local t2 = os.time( { year=year,month=02,day=01,hour=00,min=0,sec=0} );
local feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={ 31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
local day=tonumber(os.date("%w"))+1-sday
local day_num = today
local remainder=day_num % 7
local start_day=day-(day_num % 7)
if start_day<0 then start_day=7+start_day end
local month=os.date("%m")
local mdays=monthdays[tonumber(month)]
local x=mdays+start_day
local dnum={}
local dnumh={}
if mdays+start_day<36 then
dlen=35
plen=29
else
dlen=42
plen=36
end
for i=1,dlen do
if i<=start_day then
dnum[i]=" "
else
dn=i-start_day
if dn=="nil" then dn=0 end
if dn<=9 then dn=(spacer .. dn) end
if i>x then dn="" end
dnum[i]=dn
dnumh[i]=dn
if dn==(spacer .. today) or dn==today then
dnum[i]=""
end
if dn==(spacer .. today) or dn==today then
dnumh[i]=dn
place=i
else dnumh[i]=" "
end
end
end--for
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
if hstyle==0 then
if tonumber(sday)==0 then
dys={"SU","MO","TU","WE","TH","FR","SA"}
else
dys={"MO","TU","WE","TH","FR","SA","SU"}
end
--draw calendar titles
elseif hstyle==1 then
if tonumber(sday)==0 then
dys={"SU","MO"," "," "," ","FR","SA"}
cairo_text_extents(cr,"MO",extents)
local s=extents.x_advance+gaph
local f=gaph*5
local tdfont=caltab.tdf or "mono"
local tdfontsize=caltab.tdfs or 12
local tdc=caltab.tdc or 0xffffff
local tda=caltab.tda or 1
cairo_select_font_face (cr, tdfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tdfontsize);
local tdred,tdgreen,tdblue,tdalpha=rgb_to_r_g_b(tdc,tda)
cairo_set_source_rgba (cr,tdred,tdgreen,tdblue,tdalpha)
local insert=os.date("%b %y")
cairo_text_extents(cr,insert,extents)
local w=extents.x_advance
cairo_move_to (cr, cal_x+((s+f)/2)-(w/2), cal_y)
cairo_show_text (cr,insert)
cairo_stroke (cr)
else
dys={"MO","TU"," "," "," ","SA","SU"}
cairo_text_extents(cr,"TU",extents)
local s=extents.x_advance+gaph
local f=gaph*5
local tdfont=caltab.tdf or "mono"
local tdfontsize=caltab.tdfs or 12
local tdc=caltab.tdc or 0xffffff
local tda=caltab.tda or 1
cairo_select_font_face (cr, tdfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tdfontsize);
local tdred,tdgreen,tdblue,tdalpha=rgb_to_r_g_b(tdc,tda)
cairo_set_source_rgba (cr,tdred,tdgreen,tdblue,tdalpha)
local insert=os.date("%b %y")
cairo_text_extents(cr,insert,extents)
local w=extents.x_advance
cairo_move_to (cr, cal_x+((s+f)/2)-(w/2), cal_y)
cairo_show_text (cr,insert)
cairo_stroke (cr)
end
end
--draw calendar titles
for i=1,7 do
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
cairo_move_to (cr, cal_x+(gaph*(i-1)), cal_y)
cairo_show_text (cr, dys[i])
cairo_stroke (cr)
end
--draw calendar body
cairo_select_font_face (cr, bfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, bfontsize);
cairo_set_source_rgba (cr,bred,bgreen,bblue,balpha)
for i=1,plen,7 do
local fn=i
for i=fn,fn+6 do
cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
cairo_show_text (cr, dnum[i])
cairo_stroke (cr)
end
end
--highlight
cairo_select_font_face (cr, hfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, hfontsize);
cairo_set_source_rgba (cr,hred,hgreen,hblue,halpha)
for i=1,plen,7 do
local fn=i
for i=fn,fn+6 do
cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
cairo_show_text (cr, dnumh[i])
cairo_stroke (cr)
end
end
--############################################################################
caltab=nil
dlen=nil
plen=nil
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end
-- end main function #########################################################
Bookmarks