Author Topic: Conky Support, Codes and Screenshots  (Read 103918 times)

Sector11

  • Posts: 870
    • View Profile
Conky Support, Codes and Screenshots
« on: January 14, 2013, 05:56:31 PM »
I do this in the form of a "screenshot thread" as well.
... 
Three new VSIDO installs:
  • /dev/sda1 = M-1 - will remain "stock"
  • /dev/sda8 = M-8 - my play land
  • /dev/sda10 = M-10 - will be my working system when M-8 is right

The conky on the left comes to you because of mrpeachy's hard work with LUA.
Code: [Select]
# To use #! in a conky use: ${exec echo '#!'}
# ${font DS\-Digital:bold:size=24}
# OS: ${pre_exec lsb_release -d | cut -c14-50}
# killall conky && conky -c /media/5/Conky/Chronograph_mrpeachy.conky &
# Thank you - mrpeachy

###  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_colour gray
own_window_class Conky
own_window_title Chronograph mrpeachy

# 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 no # 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 0

minimum_size 340 700  ##420 420   ## width, height
maximum_width 340     ##420       ## width

gap_x 10 ### left &right
gap_y 10 ### up & down

alignment tl #ml
####################################################  End Window Settings  ###
###  Font Settings  ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont Monofur:bold:size=9
#xftfont CorporateMonoExtraBold:size=9
#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 no
default_shade_color black

draw_outline no # amplifies text if yes
default_outline_color black

default_color DCDCDC #220 220 220 Gainsboro ## CCAA7A # chronograph-mrpeachy
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
#####################################################  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

#   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.3}
#
## ${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.5
#lua_draw_hook_post draw_bg 20 0 0 0 0 0x000000 0.5
#
# TEXT
# ${lua conky_draw_bg 20 0 0 0 0 0x000000 0.3}
##
#
################### chronograph-mrpeachy #######################################
#lua_load /media/5/Conky/LUA/chronograph-mrpeachy.lua
lua_load /media/5/Conky/LUA/chronograph-mrpeachy_24.lua
lua_draw_hook_post main
#lua_draw_hook_pre main

### v9000 Weather ############################################################
lua_load ~/v9000/v9000.lua
lua_draw_hook_pre weather
#lua_draw_hook_post weather
lua_load /media/5/Conky/LUA/crono_mrp.template.lua
############################################################ v9000 Weather ###
### mount.lua ################################################################
lua_load /media/5/Conky/LUA/mounted.lua
### mount.lua ### INSTRUCTIONS ##############################################
#load script
#lua_load ~/path_to/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


# ${color6}${lua mount 7 fsys 9}${goto 100}${color8}${lua mount 7 size}${goto 150}${color7}${lua mount 7 free}${goto 200}${color1}${lua mount 7 use%}${goto 260}${color}${lua mount 7 mount}
# ${color6}${lua mount 8 fsys 9}${goto 100}${color8}${lua mount 8 size}${goto 150}${color7}${lua mount 8 free}${goto 200}${color1}${lua mount 8 use%}${goto 260}${color}${lua mount 8 mount}

################################################################ mount.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
# ${lua conky_draw_bg 20 0 0 0 0 0x000000 0.5}
TEXT
${lua get_mounted_data 3}${lua conky_draw_bg 20 0 0 0 0 0x000000 0.5}












































${color1}${cpubar cpu4 1,340}${color}
${color3}Hosted by: ${color}${nodename}${goto 160}${color3}for the past: ${color}${uptime_short}
${alignc}${color3}Kernel: ${color}${kernel}
${alignc}${color3}CPU Usage ${color7}1: ${color}${if_match ${cpu cpu1} < 10}  ${cpu cpu1}\
${else}${if_match ${cpu cpu1} < 100} ${cpu cpu1}\
${else}${cpu cpu1}\
${endif}${endif} %\
 ${color7}2: ${color}${if_match ${cpu cpu2} < 10}  ${cpu cpu2}\
${else}${if_match ${cpu cpu2} < 100} ${cpu cpu2}\
${else}${cpu cpu2}\
${endif}${endif} %\
 ${color7}3: ${color}${if_match ${cpu cpu3} < 10}  ${cpu cpu3}\
${else}${if_match ${cpu cpu3} < 100} ${cpu cpu3}\
${else}${cpu cpu3}\
${endif}${endif} %\
 ${color7}Avg: ${color}${if_match ${cpu cpu0} < 10}  ${cpu cpu0}\
${else}${if_match ${cpu cpu0} < 100} ${cpu cpu0}\
${else}${cpu cpu0}\
${endif}${
Stay Home

Sector11

  • Posts: 870
    • View Profile
Multiple Conkys on Multiple Desktops
« Reply #1 on: January 14, 2013, 06:02:53 PM »
By design, in a terminal conky will start the default conky at: etc/conky/conky.conf.

Now if a user, or the creator of a distro, installs/includes conky they use the "user" default location:
Code: [Select]
~/.conkyrc and that will be the conky that
Code: [Select]
conky runs. This is the case with VSIDO, the default conky is ~/.conkyrc

But what if you want to run 2, 3, 4,  5 - 10 conkys.

Use a bash script: ssc.sh
Code: [Select]
#!/bin/sh
# click to start, click to stop
if pidof conky | grep [0-9] > /dev/null
  then
    exec killall conky
  else
    sleep 30  # sleep not required for xfce on startup - 30 or more for others
    conky -c ~/Conky/conky1 &
    conky -c ~/Conky/conky2 &
    conky -c ~/Conky/conky3 &
    conky -c ~/Conky/conky4 &
  exit
fi

The sleep command can be used like this:
Code: [Select]
(sleep 30s && conky -c /Conky/conky1) &
(sleep 30s && conky -c /Conky/conky2) &
(sleep 30s && conky -c /Conky/conky3) &
(sleep 30s && conky -c /Conky/conky4) &
but then you need it for every command - which will come in handy in a second.

With ssc.sh you can put it in your OpenBox autostart as well IF you make it the LAST command, it will NOT return to autostart.sh:
Code: [Select]
## Start conkys
(sleep 2s && /media/5/Conky/OBMenuS/ssc.sh) &
exit

You can assign it to a tint2 clock click function:
Code: [Select]
clock_rclick_command = /media/5/Conky/OBMenuS/ssc.sh  ## start/stop all my conkys
you can put an entry in OpenBox:
Code: [Select]
Label: ssc - SSC - Srart|Stop Conky or Bob's your Uncle (anything you want)
Execute: /media/5/Conky/OBMenuS/ssc.sh
    Create an icon on your desktop or Xfce4 Menu and use it.  Run it as a start-up in Xfce4

    Since it boots your conkys at start up:
[list=*]
  • activating it once while all conkys are running - - - will "killall conky",[/*]
  • activating it again - - - will restart ALL conkys.[/*]
Now the multiple desktop trick.

This came to me by way of an old friend "mobilediesel" gotta find him and invite him here.

EDIT: I forgot another VERY important part of this.
There is a line in conky above TEXT, similar to if not that same as:

Code: [Select]
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pagerA lot of people use it because it's what they found in the internet  or in the default conky.

sticky - means the conky is on every desktop.  So for the conkys that you do NOT want on all desktops, drop the sticky.
Code: [Select]
own_window_hints undecorated,below,skip_taskbar,skip_pager
Next ... Install wmctrl
Code: [Select]
sudo apt-get install wmctrl
Quote
Wmctrl is a command line tool to interact with an
EWMH/NetWM compatible X Window Manager (examples include
Enlightenment, icewm, kwin, metacity, and sawfish).

Wmctrl provides command line access to almost all the features
defined in the EWMH specification. For example it can maximize
windows, make them sticky, set them to be always on top. It can
switch and resize desktops and perform many other useful
operations.

Take a look, 13 conkys running on 4 desktops and only one file to edit to change what's running: ssc.sh



By trial and error I discovered that 'wmctrl' does not like going from desktop 0 to desktop 1, etc, and then back to desktop 0.  Conky counts desktops: 1, 2, 3, 4, etc but wmctrl counts 0, 1, 2, 3, etc.  And here is where sleep comes in for every command,  Linux reads the bash script lines one at a time and actions them in order, so if there are two lines say lines 7 and 8:

Code: [Select]
sleep 10 ....
sleep 2 ...
... the sleep 2 line is activates 2 seconds after the scripts starts, not 12 seconds as I once thought.

If your conkys on any particular desktop start slow because they need to gather information, ie weather, the "next" desktop change needs a sleep time to make sure the information is displayed "before" changing the desktop to the next section.  You'll need to test and tweak things to get it right.

So here it is, my "SSC.sh" script, as you see I have commented out conkys but left them there for a bit because I change things occasionally.
Code: [Select]
#!/bin/bash
 # click to start, click to stop

if pidof conky | grep [0-9] > /dev/null
  then
exec killall conky
  else
     #conky -c /media/5/conky/test274.johnraff.conky &
     #conky -c /media/5/conky/test275.johnraff.conky &
#conky -c /media/5/Conky/S11_v9_R.conky &
#conky -c /media/5/conky/test287.memory.conky &

# on desktop 4 only
(sleep 1s && wmctrl -s 3 && conky -c /media/5/conky/Didier-T/conkyrc_meteo_graph_baro) &
(sleep 1s && wmctrl -s 3 && conky -c /media/5/conky/Didier-T/conkyrc_meteo_lua) &

# on desktop 3 only
(sleep 10s && wmctrl -s 2 && conky -c /media/5/Conky/TeoWeatherClock/Teo_Clock_2.conky) &
(sleep 10s && wmctrl -s 2 && conky -c /media/5/Conky/jed_greyclock_conkyrc) &
#(sleep 10s && wmctrl -s 2 && conky -c /media/5/Conky/Chronograph_mrpeachy.conky) &
#(sleep 10s && wmctrl -s 2 && conky -c /media/5/conky/Didier-T/conkyrc_meteo_graph_baro) &
#(sleep 10s && wmctrl -s 2 && conky -c /media/5/conky/Didier-T/conkyrc_meteo_lua) &

# on desktop 2 only (change to 5s if using desktop 3)
(sleep 18s && wmctrl -s 1 && conky -c /media/5/Conky/S11_Dates.conky) &
(sleep 18s && wmctrl -s 1 && conky -c /media/5/Conky/S11_VNS.conky) &
(sleep 18s && wmctrl -s 1 && conky -c /media/5/Conky/S11_Rem_Cal.conky) &
(sleep 18s && wmctrl -s 1 && conky -c /media/5/Conky/S11_Disk_Activity.conky) &
#(sleep 18s && wmctrl -s 1 && conky -c /media/5/Conky/S11_v9_SM.conky) &
#(sleep 18s && wmctrl -s 1 && conky -c /media/5/Conky/S11_mrp_FSYS.conky) &
(sleep 18s && wmctrl -s 1 && conky -c /media/5/Conky/S11_v9_H.conky) &
(sleep 18s && wmctrl -s 1 && conky -c /media/5/Conky/S11_v9_R.conky) &

# on desktop 1 only (change to 10s if using desktop 3)
(sleep 25s && wmctrl -s 0 && conky -c /media/5/Conky/VO_Radiotray.conky) &
(sleep 25s && wmctrl -s 0 && conky -c /media/5/Conky/Chronograph_mrpeachy.conky) &
#(sleep 25s && wmctrl -s 0 && conky -c /media/5/Conky/TeoWeatherClock/Teo_Clock_2.conky) &
#(sleep 25s && wmctrl -s 0 && conky -c /media/5/Conky/S11_Chronograph.conky) &
#(sleep 25s && wmctrl -s 0 && conky -c /media/5/Conky/S11_coin.conky) &

# on all desktops
(sleep 15s && wmctrl -s 0 && conky -c /media/5/Conky/S11_email.conky) &
  exit
fi

If you have questions, just ask.
Stay Home

Sector11

  • Posts: 870
    • View Profile
Dark or Light wallpapers with different tint2 configs
« Reply #2 on: January 14, 2013, 06:05:36 PM »
Create two bash files "light" and "dark" put them in your path (~/bin) and make them executable.

These are just some setups I have (one is default stuff) so you'll have to change things to match your setup.  These batch files also assume you have conky and tint2 running in one form or another

Light background (my bash file names are different I have light/dark bash scripts for another purpose)



~/bin/light
Code: [Select]
#!/bin/bash
# ----------
# Light backgrounds

 (sleep 1s && killall tint2 && tint2) &
 (sleep 1s && killall conky && conky) &
exit 0



~/bin/dark
Code: [Select]
#!/bin/bash
# ----------
# dark backgrounds

  (sleep 1s && killall tint2 && tint2 -c  ~/.config/tint2/t2launchrc) &
  (sleep 1s && killall tint2 && tint2 -c  ~/.config/tint2/tint2rc_bot) &
    (sleep 1s && killall conky && conky -c ~/.conkyrc.vsido) &
exit 0

Now just open a terminal and type "light" or "dark"

Or in OpenBox two menu items:
Code: [Select]
label: Dark
Execute ~/bin/dark

Code: [Select]
label: Light
Execute ~/bin/light

Of course I get around light/dark walls by using a shadow background, but it's not necessary.  See the light wallpaper above - on a dark background the shadow cannot be seen.

OH OH!!!  I need to use The ORB now...  new changes coming.
Stay Home

Sector11

  • Posts: 870
    • View Profile
Conky Links
« Reply #3 on: January 14, 2013, 06:06:27 PM »
    If you find interesting links please lets me know I'll add it/them.

Official Conky Sources
Conky Home
Conky Documentation
Conky Manual
Config Settings (above TEXT)
Conky Variables (below TEXT)
Conky Wiki!

Interesting Links
ConkyGUI - its aim is to speed the editing of the conky config files.
blendmaster.name - Conky and Compiz

Conky Threads on various forums (lots of samples)

#! Crunchbang - they can't have just one. Noooooo - conky isn't interesting enough.
The New Monster Conky Thread
My Conky Config - Archive
Conky Help - Archive
August 2011 Conky Thread - Archive
September 2011 Conky Thread - Archive
October 2011 Conky Thread - Archive
November 2011 Conky Thread - Archive
December 2011 Conky Thread - Archive
Conky weather scripts using Accuweather/WUnderground/NWS/Weather.com - TeoBigusGeekus
interactive conky - mrpeachy
weather in conky (v9000 LUA script) - mrpeachy

ARCH Linux
conky configs and screenshots!
Debian Post your conkyrc + screenshot
Fedora Conky & .conkyrc - Examples & Screenshots

Ubuntu
Post your .conkyrc files w/ screenshots
Conky Lua & Cairo Troubleshooting
LinuxMint Conky Showoff thread

openSUSE
How to install conky with both cairo and imlib2 in lua bingdings -- Thread
 malcolmlewis: Python/openSUSE_Factory:
conkyForecast
conkygooglecalendar
conkykeyring

Conky-Artists-Group - at deviantart.com
deviantart·com - Founder: Londonali1010

arpinux, BigRZA, Blitz-Bomb, Chicoray, Elchacmool, ElderVLaCoste, Freeazy, giancarlo64, Helmuthdu, Iacoporosso, LaGaDesk, minteastwood, Mloodszy, mmesantos1, Psyjunta, Pukinpr, Shamen456, Votritis, vrkalak, wlourf

Other links (blogs, wikis, websites, etc.)

! CrunchBang Conky Wiki – An excellent reference.
ARCHWiki: Conky - Also and excellent source.
todo.txt-cli
Gentoo Linux Conky Howto

Blogs:
Lusule Online:
[list=*]
Lua Links
Blogs:
The Peachy Blog
Blog about conky & Lua -- by Wlourf

Links
lua API -- sourceforge
The Programing Language Lua
About Lua
Lua (programming language) -- wikipedia
Lua-users wiki - Tutorial
Lua: for the beginner, italia, français, español, Deutsche -- a German site, very nice
Lua-Cairo Binding

Cairo links
Official page of the Cairo 2D library
Some samples
A tutorial for beginners
The library manual
Available functions in the Lua binding of Cairo

Français
Vos Conkyrc (forum #! Crunchbang (Fr))
(1) Conky : Postez vos conkyrc ou certaines parties intéressantes (forum Ubuntu - closed)
(2) Conky : Postez vos conkyrc ou certaines parties intéressantes (forum Ubuntu  - closed)
(3) Conky : Postez vos conkyrc ou certaines parties intéressantes (forum Ubuntu  - closed)
(4) Conky : Postez vos conkyrc ou certaines parties intéressantes (forum Ubuntu)
Postez vos scripts Lua pour Conky ! (forum Ubuntu)
Conky - Partage de scripts (forum Fedora)

Español
Posteen sus Conky's

Deutsch
Mandriva User.de - Conky Inhalt

Russian
Тема: Постим свой .conkyrc со скриншотом

Italian
Posta il tuo .conkyrc & png
Stay Home

Sector11

  • Posts: 870
    • View Profile
Re: Conky Codes and Images
« Reply #4 on: January 14, 2013, 06:16:38 PM »
ragamatrix posted a nice horizontal conky using mrpeachy's v9000 script for a widescreen monitor. Imagine my surprise when I found it was based on one of my templates.

His screenshot

I don't have a screen so I had a shot at redoing it to fit my 1280 screen.  I added a white circle where the moon is since it was a new moon the day I made it and that space was empty, it is exactly the same size as the moon image being called so you'll be able to see the unseen part of the moon.

Under construction: · · · · · · · And the finished work:


I also put all the controls back in place so changing one number changes a whole "group" ----

The conkys above use:
Code: [Select]
-- horizontal calc added to each days "X" values
dataxp=85 -- ???+(dataxp*1)

change that one number:
Code: [Select]
-- horizontal calc added to each days "X" values
dataxp=75 -- ???+(dataxp*1)
and things move closer:


Unfortunately it's not as easy with the draw-bg.lua script.  I also dropped the ${voffset -500} line from the conky by putting all the lua calls on one line. The ending \ is what does that.

The conky:
Code: [Select]
# killall conky && conky -c /media/5/conky/conkybarre_v9000 &
# by ragamatrix - Jan 2013
# -- Paramètres Conky Météo -- #
# Text alignment, other possible values are commented
alignment tl
#alignment top_right
#alignment bottom_left
#alignment bottom_right
# -- Conky settings -- #
background yes
update_interval 1
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
double_buffer yes
no_buffers yes
text_buffer_size 265 #2048
imlib_cache_size 0
# -- Window specifications -- #
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,sticky,skip_taskbar,skip_pager,below
show_graph_range no
show_graph_scale no
short_units yes
own_window_class Conky
border_inner_margin 0
border_outer_margin 0
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
# -- Colours -- #
default_color 00BFFF #  0 191 255 DeepSkyBlue
color0 FFDEAD #255 222 173 NavajoWhite
color1 7FFF00 #127 255   0 Chartreuse
color2 778899 #119 136 153 LightSlateGray
color3 FF8C00 #255 140   0 DarkOrange
color4 B0E0E6 #Powder Blue #F0FFFF #240 255 255 Azure
color5 FFDEAD #255 222 173 NavajoWhite
color6 7B68EE #123 104 238 MediumSlateBlue
color7 00FFFF #  0 255 255 Cyan
color8 FFFF00 #255 255   0 Yellow
color9 FF0000 #255   0   0 Red
# Gap between borders of screen and text
# same thing as passing -x at command line

gap_x 5 # left-right
gap_y 5 # up-down
# Minimum size of text area

minimum_size 1900 86  #Taille minimum (px) ; largeur / hauteur
maximum_width 1900  #Largeur maximum (px)
#out_to_console no
# Force UTF8? note that UTF8 support required XFT
#override_utf8_locale yes
# Stippled borders?
#stippled_borders 0
# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
#total_run_times 0
# set to yes if you want all text to be in uppercase
uppercase no

# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer right #left right none

# -- Text settings -- #
# Use Xft?
use_xft yes
xftalpha 1.0
#xftfont DejaVu:style=Bold:size=6
xftfont Monofur:bold:size=12

# -- Lua load -- #
lua_load ~/v9000/v9000.lua
lua_draw_hook_pre weather
lua_load /media/5/conky/LUA/template_meteo_barre.lua
lua_load /media/5/Conky/LUA/draw-bg.lua
##############################################

TEXT
${lua conky_draw_bg 15 0 0 480 87 0x000000 0.5}\
${lua conky_draw_bg 15 482 0 75 87 0x000000 0.5}\
${lua conky_draw_bg 15 567 0 75 87 0x000000 0.5}\
${lua conky_draw_bg 15 652 0 75 87 0x000000 0.5}\
${lua conky_draw_bg 15 737 0 75 87 0x000000 0.5}\
${lua conky_draw_bg 15 822 0 75 87 0x000000 0.5}\
${lua conky_draw_bg 15 907 0 75 87 0x000000 0.5}\
${lua conky_draw_bg 15 992 0 75 87 0x000000 0.5}\
${lua conky_draw_bg 15 1076 0 75 87 0x000000 0.5}\
${lua conky_draw_bg 15 1160 0 75 87 0x000000 0.5}\
${lua conky_draw_bg 30 105 5 60 60 0xffffff 0.2}

and the LUA script (with the 85 back in place), imagine my surprise when I saw it - one of mine modified.  :D
Code: [Select]
--[[
 The latest script is a lua only weather script. aka: v9000
 http://crunchbang.org/forums/viewtopic.php?id=16100

 the file:
 http://dl.dropbox.com/u/19008369/weatheragain9000.lua.tar.gz

 mrppeachys LUA Tutorial
 http://crunchbang.org/forums/viewtopic.php?id=17246
]]
_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="Monofur"--font must be in quotes
default_font_size=12
default_color=0xB0E0E6 --Powder Blue
default_alpha=1 --fully opaque
default_image_width=40
default_image_height=40
-- ## 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

-- ======================================================================
-- SUN & MOON RISE ------------------------------------------------------
   out({fs=15,x=10,y=14,txt="Sun"})
     out({fs=15,x=50,y=14,txt="|"})
     out({fs=15,x=60,y=14,txt="Moon"})
   out({c=0xF0FFFF,x=10,y=30,txt="Rise "})
     out({c=0xF0FFFF,fs=15,x=50,y=30,txt="|"})
      out({c=0xFFFF00,x=10,y=45,txt=sun_rise_24[1]})
   out({c=0xF0FFFF,x=60,y=30,txt="Rise"})
     out({c=0xFFFF00,fs=15,x=50,y=45,txt="|"})
      out({c=0xFFFF00,x=60,y=45,txt=moon_rise_24[1]})
-- SUN & MOON SET -------------------------------------------------------
   out({c=0xF0FFFF,x=10,y=65,txt="Set"})
     out({c=0xF0FFFF,fs=15,x=50,y=65,txt="|"})
      out({x=10,y=80,txt=sun_set_24[1]})
   out({c=0xF0FFFF,x=60,y=65,txt="Set"})
     out({fs=15,x=50,y=80,txt="|"})
      out({x=60,y=80,txt=moon_set_24[1]})
-- ======================================================================
-- MOON PHASE - CENTRE --------------------------------------------------
   image({x=105,y=05,w=60,h=60,file=moon_icon[1]})
--   image({x=105,y=05,w=60,h=60,file="/media/5/Conky/images/red+x.png"})
   --out({c=0xF0FFFF.0,x=190,y=235,txt=moon_phase[1]})
-- ======================================================================
-- CURRENT FOR TODAY - SEE TOP LEFT -------------------------------------
   image({x=170,y=05,w=60,h=60,file=now["weather_icon"]})
--   image({x=170,y=05,w=60,h=60,file="/media/5/Conky/images/red+x.png"})
   out({x=170,y=70,txt="T"})
      out({c=0xFF8C00,x=180,y=70,txt=now["temp"]})
   out({x=205,y=70,txt="±"})
      out({c=0xF0FFFF,x=215,y=70,txt=now["feels_like"]})
-- ======================================================================
-- FORECAST FOR TODAY ---------------------------------------------------
out({fs=15,x=240,y=14,txt="Forecast"})
   image({x=300,y=20,w=50,h=50,file=weather_icon[1]})
--   image({x=300,y=20,w=50,h=50,file="/media/5/Conky/images/red+x.png"})
-- out({c=0xF0FFFF,x=300,y=23,txt="↑ "})
     out({c=0xFF8C00,fs=14,x=300,y=23,txt=high_temp[1]})
-- out({c=0xF0FFFF,x=330,y=23,txt="↓ "})
     out({c=0x00BFFF,fs=14,x=330,y=23,txt=low_temp[1]})
-- Humidity -------------------------------------------------------------
   out({c=0xF0FFFF,x=240,y=30,txt="Hum"})
      out({x=270,y=30,txt=now["humidity"].."%"})
-- Dew Point ------------------------------------------------------------
   out({c=0xF0FFFF,x=240,y=42,txt="DP"})
      out({x=270,y=42,txt=now["dew_point"].."°"})
-- Chance of Rain -------------------------------------------------------
   out({c=0xF0FFFF,x=240,y=54,txt="CR?"})
      out({x=270,y=54,txt=precipitation[1].."%"})
-- Cloud Cover
   out({c=0xF0FFFF,x=240,y=66,txt="CC"})
      out({x=270,y=66,txt=cloud_cover[1].."%"})
-- Ceiling
--   out({c=0xF0FFFF,x=240,y=65,txt="Ceil"})
--     out({x=270,y=65,txt=now["ceiling"]})
-- BOTTOM
-- UV -------------------------------------------------------------------
   out({c=0xF0FFFF,x=100,y=82,txt="UVI"})
     out({x=130,y=82,txt=uv_index_num[1]})
       out({x=155,y=82,txt=uv_index_txt[1]})
-- Barometric Pressure --------------------------------------------------
   out({c=0xF0FFFF,x=220,y=82,txt="BarP"})
out({x=260,y=82,txt=now["pressure_mb"].." mb"})
-- ======================================================================
-- FORECAST FOR NEXT 3 HOURS --------------------------------------------
-- 1st hour
  image({w=30,h=30,x=360,y=10,file=now["fc_hour1_wicon"]})
--  image({w=30,h=30,x=360,y=10,file="/media/5/Conky/images/red+x.png"})
  out({x=360,y=12,txt=now["fc_hour1_time_24"]..":00"})
  out({c=0xF0FFFF,x=365,y=45,txt=now["fc_hour1_temp"]})
-- 2nd hour
  image({w=30,h=30,x=400,y=10,file=now["fc_hour2_wicon"]})
--  image({w=30,h=30,x=400,y=10,file="/media/5/Conky/images/red+x.png"})
  out({x=400,y=12,txt=now["fc_hour2_time_24"]..":00"})
  out({c=0xF0FFFF,x=405,y=45,txt=now["fc_hour3_temp"]})
-- 3rd hour
  image({w=30,h=30,x=440,y=10,file=now["fc_hour3_wicon"]})
--  image({w=30,h=30,x=440,y=10,file="/media/5/Conky/images/red+x.png"})
out({x=440,y=12,txt=now["fc_hour3_time_24"]..":00"})
out({c=0xF0FFFF,x=445,y=45,txt=now["fc_hour3_temp"]})
-- ======================================================================
-- WIND INFORMATION for today--------------------------------------------
   image({w=30,h=30,x=360,y=50,file=now["wind_icon"]})
-- image({w=30,h=30,x=360,y=50,file="/media/5/Conky/images/red+x.png"})
   out({fs=14,x=400,y=61,txt=now["wind_deg"]})
   out({fs=14,x=442,y=62,txt=now["wind_nesw"]})
--   out({x=333,y=265,txt="@"})
      out({fs=14,x=400,y=76,txt=now["wind_km"]})

---------------------------------------------- END FORECAST FOR TODAY ---
-- ======================================================================

-- forecast calculations
-- horizontal text calcs
dataxm=497
dataxn=527
dataxd=510
dataxt=535
dataxrs=503
-- vertical text calcs
dataymd=13
datayn=25
datayh=35
datayl=60
datayr=73
datays=83
-- image calcs
imx=490
imy=25
-- horizontal calc added to each days "X" values
dataxp=85 -- ???+(dataxp*1)

-- FORECAST for the next 9 days

-- Forecast day 2 -- x = l|r  y = u|d
out({x=dataxm,y=dataymd,txt=forecast_month_short[2]})
 out({x=dataxn,y=dataymd,txt=forecast_date[2]})
  out({x=dataxd,y=datayn,txt=forecast_day_short[2]})
 image({x=imx,y=imy,file=weather_icon[2]})
-- image({x=imx,y=imy,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,x=dataxt,y=datayh,txt=high_temp[2]})
out({c=0x00BFFF,x=dataxt,y=datayl,txt=low_temp[2]})
 out({c=0xFFFF00,x=dataxrs,y=datayr,txt=sun_rise_24[2]})
 out({x=dataxrs,y=datays,txt=sun_set_24[2]})

-- Forecast day 3 -- x = l|r  y = u|d
out({x=dataxm+(dataxp*1),y=dataymd,txt=forecast_month_short[3]})
 out({x=dataxn+(dataxp*1),y=dataymd,txt=forecast_date[3]})
  out({x=dataxd+(dataxp+1),y=datayn,txt=forecast_day_short[3]})
 image({x=imx+(dataxp*1),y=imy,file=weather_icon[3]})
-- image({x=imx+(dataxp*1),y=imy,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,x=dataxt+(dataxp*1),y=datayh,txt=high_temp[3]})
out({c=0x00BFFF,x=dataxt+(dataxp*1),y=datayl,txt=low_temp[3]})
 out({c=0xFFFF00,x=dataxrs+(dataxp*1),y=datayr,txt=sun_rise_24[3]})
 out({x=dataxrs+(dataxp*1),y=datays,txt=sun_set_24[3]})

-- Forecast day 4 -- x = l|r  y = u|d
out({x=dataxm+(dataxp*2),y=dataymd,txt=forecast_month_short[4]})
 out({x=dataxn+(dataxp*2),y=dataymd,txt=forecast_date[4]})
  out({x=dataxd+(dataxp*2),y=datayn,txt=forecast_day_short[4]})
 image({x=imx+(dataxp*2),y=imy,file=weather_icon[4]})
-- image({x=imx+(dataxp*2),y=imy,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,x=dataxt+(dataxp*2),y=datayh,txt=high_temp[4]})
out({c=0x00BFFF,x=dataxt+(dataxp*2),y=datayl,txt=low_temp[4]})
 out({c=0xFFFF00,x=dataxrs+(dataxp*2),y=datayr,txt=sun_rise_24[4]})
 out({x=dataxrs+(dataxp*2),y=datays,txt=sun_set_24[4]})

-- Forecast day 5 -- x = l|r  y = u|d
out({x=dataxm+(dataxp*3),y=dataymd,txt=forecast_month_short[5]})
 out({x=dataxn+(dataxp*3),y=dataymd,txt=forecast_date[5]})
  out({x=dataxd+(dataxp*3),y=datayn,txt=forecast_day_short[5]})
 image({x=imx+(dataxp*3),y=imy,file=weather_icon[5]})
-- image({x=imx+(dataxp*3),y=imy,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,x=dataxt+(dataxp*3),y=datayh,txt=high_temp[5]})
out({c=0x00BFFF,x=dataxt+(dataxp*3),y=datayl,txt=low_temp[5]})
 out({c=0xFFFF00,x=dataxrs+(dataxp*3),y=datayr,txt=sun_rise_24[5]})
 out({x=dataxrs+(dataxp*3),y=datays,txt=sun_set_24[5]})

-- Forecast day 6 -- x = l|r  y = u|d
out({x=dataxm+(dataxp*4),y=dataymd,txt=forecast_month_short[6]})
 out({x=dataxn+(dataxp*4),y=dataymd,txt=forecast_date[6]})
  out({x=dataxd+(dataxp*4),y=datayn,txt=forecast_day_short[6]})
 image({x=imx+(dataxp*4),y=imy,file=weather_icon[6]})
-- image({x=imx+(dataxp*4),y=imy,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,x=dataxt+(dataxp*4),y=datayh,txt=high_temp[6]})
out({c=0x00BFFF,x=dataxt+(dataxp*4),y=datayl,txt=low_temp[6]})
 out({c=0xFFFF00,x=dataxrs+(dataxp*4),y=datayr,txt=sun_rise_24[6]})
 out({x=dataxrs+(dataxp*4),y=datays,txt=sun_set_24[6]})

-- Forecast day 7 -- x = l|r  y = u|d
out({x=dataxm+(dataxp*5),y=dataymd,txt=forecast_month_short[7]})
 out({x=dataxn+(dataxp*5),y=dataymd,txt=forecast_date[7]})
  out({x=dataxd+(dataxp*5),y=datayn,txt=forecast_day_short[7]})
 image({x=imx+(dataxp*5),y=imy,file=weather_icon[7]})
-- image({x=imx+(dataxp*5),y=imy,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,x=dataxt+(dataxp*5),y=datayh,txt=high_temp[7]})
out({c=0x00BFFF,x=dataxt+(dataxp*5),y=datayl,txt=low_temp[7]})
 out({c=0xFFFF00,x=dataxrs+(dataxp*5),y=datayr,txt=sun_rise_24[7]})
 out({x=dataxrs+(dataxp*5),y=datays,txt=sun_set_24[7]})

-- Forecast day 8 -- x = l|r  y = u|d
out({x=dataxm+(dataxp*6),y=dataymd,txt=forecast_month_short[8]})
 out({x=dataxn+(dataxp*6),y=dataymd,txt=forecast_date[8]})
  out({x=dataxd+(dataxp*6),y=datayn,txt=forecast_day_short[8]})
 image({x=imx+(dataxp*6),y=imy,file=weather_icon[8]})
-- image({x=imx+(dataxp*6),y=imy,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,x=dataxt+(dataxp*6),y=datayh,txt=high_temp[8]})
out({c=0x00BFFF,x=dataxt+(dataxp*6),y=datayl,txt=low_temp[8]})
 out({c=0xFFFF00,x=dataxrs+(dataxp*6),y=datayr,txt=sun_rise_24[8]})
 out({x=dataxrs+(dataxp*6),y=datays,txt=sun_set_24[8]})

-- Forecast day 9 -- x = l|r  y = u|d
out({x=dataxm+(dataxp*7),y=dataymd,txt=forecast_month_short[9]})
 out({x=dataxn+(dataxp*7),y=dataymd,txt=forecast_date[9]})
  out({x=dataxd+(dataxp*7),y=datayn,txt=forecast_day_short[9]})
 image({x=imx+(dataxp*7),y=imy,file=weather_icon[9]})
-- image({x=imx+(dataxp*7),y=imy,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,x=dataxt+(dataxp*7),y=datayh,txt=high_temp[9]})
out({c=0x00BFFF,x=dataxt+(dataxp*7),y=datayl,txt=low_temp[9]})
 out({c=0xFFFF00,x=dataxrs+(dataxp*7),y=datayr,txt=sun_rise_24[9]})
 out({x=dataxrs+(dataxp*7),y=datays,txt=sun_set_24[9]})

-- Forecast day 10 -- x = l|r  y = u|d
out({x=dataxm+(dataxp*8),y=dataymd,txt=forecast_month_short[10]})
 out({x=dataxn+(dataxp*8),y=dataymd,txt=forecast_date[10]})
  out({x=dataxd+(dataxp*8),y=datayn,txt=forecast_day_short[10]})
 image({x=imx+(dataxp*8),y=imy,file=weather_icon[10]})
-- image({x=imx+(dataxp*8),y=imy,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,x=dataxt+(dataxp*8),y=datayh,txt=high_temp[10]})
out({c=0x00BFFF,x=dataxt+(dataxp*8),y=datayl,txt=low_temp[10]})
 out({c=0xFFFF00,x=dataxrs+(dataxp*8),y=datayr,txt=sun_rise_24[10]})
 out({x=dataxrs+(dataxp*8),y=datays,txt=sun_set_24[10]})

--]]
--#######################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################

Today we have a moon phase so here it is again complete with an old wallpaper with an added twist:

VSIDO is popping out of a Stargate!

For anyone interested here is the 10x10 pixel red+x.png I use to place images that have transparent edges in conky.
Stay Home

Sector11

  • Posts: 870
    • View Profile
Re: Conky Codes and Images
« Reply #5 on: January 14, 2013, 06:52:36 PM »
Part III of III

VSIDO defauly conky is a nice conky, works well on a large screen.  I modified it just a touch here, and tad there and got:

S11_VSIDO.conkyrc with a touch of Teo! - 1a_accuweather_conky_INT/accuweather_conky


The conky
Code: [Select]
# killall conky && conky -c /media/5/Conky/S11_VSIDO.conkyrc &
# Original by: VastOne on VSIDO

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# fiddle with window
use_spacer right

# Use Xft?
use_xft yes
xftfont Monofur:bold:size=12
xftalpha 1.0
# text_buffer_size 256

# Update interval in seconds
update_interval 1

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

own_window yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
own_window_transparent yes
# own_window_argb_visual yes
own_window_class Conky

# Stippled borders?
stippled_borders 0

# border margins
border_inner_margin 5

# border width
border_width 0

# Default colors and also border colors
default_color 00BFFF #  0 191 255 DeepSkyBlue
color0 FFDEAD #255 222 173 NavajoWhite
color1 7FFF00 #127 255   0 Chartreuse
color2 778899 #119 136 153 LightSlateGray
color3 FF8C00 #255 140   0 DarkOrange
color4 F0FFFF #240 255 255 Azure
color5 FFDEAD #255 222 173 NavajoWhite
color6 7B68EE #123 104 238 MediumSlateBlue
color7 00FFFF #  0 255 255 Cyan
color8 FFFF00 #255 255   0 Yellow
color9 FF0000 #255   0   0 Red

#default_shade_color black
#default_outline_color grey
own_window_colour 000000

# Text alignment, other possible values are commented
#alignment top_middle
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 10
gap_y 10

minimum_size 1150 0  ## width, height
#maximum_width 1000     ## width


# 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 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Shortens units to a single character (kiB->k, GiB->G, etc.). Default is off (no).
short_units yes

 lua_load /media/5/Conky/LUA/draw-bg.lua
# lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.2
#
TEXT
${lua conky_draw_bg 10 0 0 0 0 0x000000 0.3}\
${image /media/5/Conky/images/debian4.png -p 0,0 -s 50x50}\
${execi 600 bash /media/5/Conky/accuweather_conky/accuw_script}\
        ${color}Kernel ${color4}${kernel}\
 ${color}MEM${color4}${if_match ${memperc}<10}  ${memperc}\
${else}${if_match ${memperc}<100} ${memperc}\
${else}${memperc}${endif}${endif}%\
 ${color}(${mem})\
 ${color}CPU${color4}${if_match ${platform f71882fg.2560 temp 1}<100} ${platform f71882fg.2560 temp 1}\
${else}${platform f71882fg.2560 temp 1}${endif}°\
 ${color}MB${color4}${if_match ${platform f71882fg.2560 temp 2}<100} ${platform f71882fg.2560 temp 2}\
${else}${platform f71882fg.2560 temp 2}${endif}°\
 ${color}HD${color4}${if_match ${execi 5 hddtemp -n /dev/sda}<100} ${execi 5 hddtemp -n /dev/sda}\
${else}${execi 5 hddtemp -n /dev/sda}${endif}${color1}°\
${color}${goto 680}Now\
${goto 760}${execi 600 sed -n '1p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 840}${execi 600 sed -n '6p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 920}${execi 600 sed -n '11p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 1000}${execi 600 sed -n '16p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 1080}${execi 600 sed -n '1p' /media/5/Conky/accuweather_conky/last_days}
        ${color}NET${color4} Dn: ${color2}${downspeedgraph eth0 12,150 00ff00 ff0000 -t -l}     ${color}Up: ${color2}${upspeedgraph eth0 12,150 ff0000 00ff00 -t -l}  ${color}Uptime ${color1}${uptime_short}\
${color3}${goto 680}↑ ${execi 600 sed -n '4p' /media/5/Conky/accuweather_conky/tod_ton}°\
${goto 760}↑ ${execi 600 sed -n '9p' /media/5/Conky/accuweather_conky/tod_ton}°\
${goto 840}↑ ${execi 600 sed -n '14p' /media/5/Conky/accuweather_conky/tod_ton}°\
${goto 920}↑ ${execi 600 sed -n '19p' /media/5/Conky/accuweather_conky/tod_ton}°\
${goto 1000}↑ ${execi 600 sed -n '24p' /media/5/Conky/accuweather_conky/tod_ton}°\
${goto 1080}↑ ${execi 600 sed -n '4p' /media/5/Conky/accuweather_conky/last_days}°
        ${color}CPU: 1${color4}${if_match ${cpu cpu1}<10}  ${cpu cpu1}\
${else}${if_match ${cpu cpu1}<100} ${cpu cpu1}\
${else}${cpu cpu0}${endif}${endif}%\
  ${color}2${color4}${if_match ${cpu cpu0}<10}  ${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100} ${cpu cpu0}\
${else}${cpu cpu0}${endif}${endif}%\
  ${color}3${color4}${if_match ${cpu cpu0}<10}  ${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100} ${cpu cpu0}\
${else}${cpu cpu0}${endif}${endif}%\
  ${color}4${color4}${if_match ${cpu cpu0}<10}  ${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100} ${cpu cpu0}\
${else}${cpu cpu0}${endif}${endif}%\
  ${color}Fan ${color4}${platform f71882fg.2560 fan 1} rpm\
${goto 680}↓ ${execi 600 sed -n '5p' /media/5/Conky/accuweather_conky/tod_ton}°\
${goto 760}↓ ${execi 600 sed -n '10p' /media/5/Conky/accuweather_conky/tod_ton}°\
${goto 840}↓ ${execi 600 sed -n '15p' /media/5/Conky/accuweather_conky/tod_ton}°\
${goto 920}↓ ${execi 600 sed -n '20p' /media/5/Conky/accuweather_conky/tod_ton}°\
${goto 1000}↓ ${execi 600 sed -n '25p' /media/5/Conky/accuweather_conky/tod_ton}°\
${goto 1080}↓ ${execi 600 sed -n '5p' /media/5/Conky/accuweather_conky/last_days}°\
${voffset -20}${goto 725}${font conkyweather:size=20}${color4}${execi 600  sed -n '2p' /media/5/Conky/accuweather_conky/curr_cond}\
${goto 805}${execi 600  sed -n '2p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 885}${execi 600  sed -n '12p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 965}${execi 600  sed -n '17p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 1045}${execi 600  sed -n '22p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 1125}${execi 600  sed -n '2p' /media/5/Conky/accuweather_conky/last_days}${font}
Stay Home

Sector11

  • Posts: 870
    • View Profile
Re: Conky Codes and Images
« Reply #6 on: January 14, 2013, 06:56:47 PM »
Part II of III

A few tweaks to the conky and the accuw_script and it's a little narrower:

1a_accuweather_conky_INT/accuweather_conky Version 2


The edited conky:
Code: [Select]
# killall conky && conky -c /media/5/Conky/accuweather_conky/conkyrc_acc_int &
###  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_colour gray
own_window_class Conky
own_window_title Chronograph Full 2

# 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 100 735  ## width, height
maximum_width 100   ## width

gap_x 10  ### left &right
gap_y 10  ### up & down

alignment tl #ml
####################################################  End Window Settings  ###
###  Font Settings  ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
#xftfont CorporateMonoExtraBold:size=9
xftfont monofur:bold:size=12
# 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 no
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 C2CCFF #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
#####################################################  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

# If enabled, values which are in bytes will be printed in human readable
# format (i.e., KiB, MiB, etc). If disabled, bytes is printed instead
format_human_readable yes

# Shortens units to a single character (kiB->k, GiB->G, etc.). Default is off.
short_units yes

#   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  ###########################################################
### draw-bg.lua - Above and After TEXT - requires a composite manager ########
# ----------------------------------------------------------------------------
lua_load /media/5/Conky/LUA/draw-bg.lua
#TEXT
# ${lua conky_draw_bg 125 0 0 0 0 0x000000 0.3}
# ============================================================================
## OR Both above TEXT - No composite manager required.
# ----------------------------------------------------------------------------
#lua_load /media/5/Conky/LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 12 0 0 0 0 0x000000 0.5
# TEXT
#######################################################  End LUA Settings  ###

update_interval 1

TEXT
${lua conky_draw_bg 12 0 0 0 0 0x000000 0.3}\
Looking Out${execi 600 bash /media/5/Conky/accuweather_conky/accuw_script}
Now\
${goto 50}${font conkyweather:size=40}${execi 600  sed -n '2p' /media/5/Conky/accuweather_conky/curr_cond}${font}
${voffset -40} ${execi 600 sed -n '4p' /media/5/Conky/accuweather_conky/curr_cond}°


${execi 600 sed -n '1p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 50}${font conkyweather:size=40}${execi 600  sed -n '2p' /media/5/Conky/accuweather_conky/tod_ton}${font}
${voffset -40}↑ ${execi 600 sed -n '4p' /media/5/Conky/accuweather_conky/tod_ton}°
↓ ${execi 600 sed -n '5p' /media/5/Conky/accuweather_conky/tod_ton}°
${stippled_hr 5 1}
${execi 600 sed -n '6p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 50}${font conkyweather:size=40}${execi 600  sed -n '7p' /media/5/Conky/accuweather_conky/tod_ton}${font}
${voffset -40}↑ ${execi 600 sed -n '9p' /media/5/Conky/accuweather_conky/tod_ton}°
↓ ${execi 600 sed -n '10p' /media/5/Conky/accuweather_conky/tod_ton}°
      ${stippled_hr 5 1}
${execi 600 sed -n '11p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 50}${font conkyweather:size=40}${execi 600  sed -n '12p' /media/5/Conky/accuweather_conky/tod_ton}${font}
${voffset -40}↑ ${execi 600 sed -n '14p' /media/5/Conky/accuweather_conky/tod_ton}°
↓ ${execi 600 sed -n '15p' /media/5/Conky/accuweather_conky/tod_ton}°
      ${stippled_hr 5 1}
${execi 600 sed -n '16p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 50}${font conkyweather:size=40}${execi 600  sed -n '17p' /media/5/Conky/accuweather_conky/tod_ton}${font}
${voffset -40}↑ ${execi 600 sed -n '19p' /media/5/Conky/accuweather_conky/tod_ton}°
↓ ${execi 600 sed -n '20p' /media/5/Conky/accuweather_conky/tod_ton}°
      ${stippled_hr 5 1}
${execi 600 sed -n '21p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 50}${font conkyweather:size=40}${execi 600  sed -n '22p' /media/5/Conky/accuweather_conky/tod_ton}${font}
${voffset -40}↑ ${execi 600 sed -n '24p' /media/5/Conky/accuweather_conky/tod_ton}°
↓ ${execi 600 sed -n '25p' /media/5/Conky/accuweather_conky/tod_ton}°
      ${stippled_hr 5 1}
${execi 600 sed -n '1p' /media/5/Conky/accuweather_conky/last_days}\
${goto 50}${font conkyweather:size=40}${execi 600  sed -n '2p' /media/5/Conky/accuweather_conky/last_days}${font}
${voffset -40}↑ ${execi 600 sed -n '4p' /media/5/Conky/accuweather_conky/last_days}°
↓ ${execi 600 sed -n '5p' /media/5/Conky/accuweather_conky/last_days}°
      ${stippled_hr 5 1}
${execi 600 sed -n '6p' /media/5/Conky/accuweather_conky/last_days}\
${goto 50}${font conkyweather:size=40}${execi 600  sed -n '7p' /media/5/Conky/accuweather_conky/last_days}${font}
${voffset -40}↑ ${execi 600 sed -n '9p' /media/5/Conky/accuweather_conky/last_days}°
↓ ${execi 600 sed -n '10p' /media/5/Conky/accuweather_conky/last_days}°
      ${stippled_hr 5 1}
${execi 600 sed -n '11p' /media/5/Conky/accuweather_conky/last_days}\
${goto 50}${font conkyweather:size=40}${execi 600  sed -n '12p' /media/5/Conky/accuweather_conky/last_days}${font}
${voffset -40}↑ ${execi 600 sed -n '14p' /media/5/Conky/accuweather_conky/last_days}°
↓ ${execi 600 sed -n '15p' /media/5/Conky/accuweather_conky/last_days}°
      ${stippled_hr 5 1}
${execi 600 sed -n '16p' /media/5/Conky/accuweather_conky/last_days}\
${goto 50}${font conkyweather:size=40}${execi 600  sed -n '17p' /media/5/Conky/accuweather_conky/last_days}${font}
${voffset -40}↑ ${execi 600 sed -n '19p' /media/5/Conky/accuweather_conky/last_days}°
↓ ${execi 600 sed -n '20p' /media/5/Conky/accuweather_conky/last_days}°
      ${stippled_hr 5 1}
${execi 600 sed -n '21p' /media/5/Conky/accuweather_conky/last_days}\
${goto 50}${font conkyweather:size=40}${execi 600  sed -n '22p' /media/5/Conky/accuweather_conky/last_days}${font}
${voffset -40}↑ ${execi 600 sed -n '24p' /media/5/Conky/accuweather_conky/last_days}°
↓ ${execi 600 sed -n '25p' /media/5/Conky/accuweather_conky/last_days}°

The re-edited accuw_script
Code: [Select]
#!/bin/bash

#function: test_image_day
test_image_day () {
    case $1 in
         su)
           echo a
         ;;
         msu)
           echo b
         ;;
         psu)
           echo c
         ;;
         ic)
           echo c
         ;;
         h)
           echo c
         ;;
         mc)
           echo d
         ;;
         c)
           echo e
         ;;
         d)
           echo e
         ;;
         f)
           echo 0
         ;;
         s)
           echo h
         ;;
         mcs)
           echo g
         ;;
         psus)
           echo g
         ;;
         t)
           echo l
         ;;
         mct)
           echo k
         ;;
         psut)
           echo k
         ;;
         r)
           echo i
         ;;
         fl)
           echo p
         ;;
         mcfl)
           echo o
         ;;
         psfl)
           echo o
         ;;
         sn)
           echo r
         ;;
         mcsn)
           echo o
         ;;
         i)
           echo E
         ;;
         sl)
           echo u
         ;;
         fr)
           echo i
         ;;
         rsn)
           echo v
         ;;
         w)
           echo 6
         ;;
         ho)
           echo 5
         ;;
         co)
           echo E
         ;;
         cl)
           echo A
         ;;
         mcl)
           echo B
         ;;
         pc)
           echo C
         ;;
         pcs)
           echo G
         ;;
         pct)
           echo K
         ;;
        esac
}

#function: test_image_night
test_image_night () {
    case $1 in
su)
           echo a
         ;;
         msu)
           echo b
         ;;
         psu)
           echo c
         ;;
         c)
           echo f
         ;;
         d)
           echo f
         ;;
         f)
           echo f
         ;;
         s)
           echo h
         ;;
         psus)
           echo g
         ;;
         t)
           echo l
         ;;
         psut)
           echo k
         ;;
         r)
           echo i
         ;;
         fl)
           echo p
         ;;
         psfl)
           echo o
         ;;
         sn)
           echo r
         ;;
         i)
           echo E
         ;;
         sl)
           echo u
         ;;
         fr)
           echo i
         ;;
         rsn)
           echo v
         ;;
         ho)
           echo 5
         ;;
         co)
           echo E
         ;;
         cl)
           echo A
         ;;
         w)
           echo 6
         ;;
         mcl)
           echo B
         ;;
         pc)
           echo C
         ;;
         ic)
           echo B
         ;;
         h)
           echo B
         ;;
         mc)
           echo C
         ;;
         pcs)
           echo G
         ;;
         mcs)
           echo G
         ;;
         pct)
           echo K
         ;;
         mct)
           echo K
         ;;
         mcfl)
           echo O
         ;;
         mcsn)
           echo O
         ;;
        esac
}

kill -STOP $(pidof conky)
killall wget

#put your Accuweather address here
## address="http://www.accuweather.com/en/gr/chania/182654/weather-forecast/182654"
## address="http://www.accuweather.com/en/gr/kastoria/178682/weather-forecast/178682"
## address="http://www.accuweather.com/en/ar/buenos-aires/7894/weather-forecast/7894"
address="http://www.accuweather.com/en/ar/general-urquiza/1228994/weather-forecast/1228994"

loc_id=$(echo $address|sed 's/\/weather-forecast.*$//'|sed 's/^.*\///')
last_number=$(echo $address|sed 's/^.*\///')

curr_addr="$(echo $address|sed 's/weather-forecast.*$//')"current-weather/"$last_number"
wget -O /media/5/Conky/accuweather_conky/curr_cond_raw "$curr_addr"

addr1="$(echo $address|sed 's/weather-forecast.*$//')"daily-weather-forecast/"$last_number"
wget -O /media/5/Conky/accuweather_conky/tod_ton_raw "$addr1"

addr2="$addr1"?day=6
wget -O /media/5/Conky/accuweather_conky/last_days_raw "$addr2"

#current conditions
if [[ -s /media/5/Conky/accuweather_conky/curr_cond_raw ]]; then

    sed -i '/detail-now/,/#details/!d' /media/5/Conky/accuweather_conky/curr_cond_raw
    egrep -i '"cond"|icon i-|detail-tab-panel' /media/5/Conky/accuweather_conky/curr_cond_raw > /media/5/Conky/accuweather_conky/curr_cond
    sed -i -e 's/^.*detail-tab-panel //g' -e 's/^.*icon i-//g' -e 's/"><\/div>.*$//g' /media/5/Conky/accuweather_conky/curr_cond
    sed -i -e 's/^.*"cond">//g' -e 's/&deg/\n/g' -e 's/<\/span>.*"temp">/\n/g' -e 's/<.*>//g' /media/5/Conky/accuweather_conky/curr_cond
    sed -i -e 's/">//g' -e 's/-->//g' -e 's/\r$//g' -e 's/ i-alarm.*$//g' /media/5/Conky/accuweather_conky/curr_cond
time=$(sed -n 1p /media/5/Conky/accuweather_conky/curr_cond)
    image=$(sed -n 2p /media/5/Conky/accuweather_conky/curr_cond)
if [[ $time == day ]]; then
    sed -i 2s/$image/$(test_image_day $image)/ /media/5/Conky/accuweather_conky/curr_cond
elif [[ $time == night ]]; then
    sed -i 2s/$image/$(test_image_night $image)/ /media/5/Conky/accuweather_conky/curr_cond
fi

fi

#First 5 days
if [[ -s /media/5/Conky/accuweather_conky/tod_ton_raw ]]; then

    sed -i '/feed-tabs/,/\.feed-tabs/!d' /media/5/Conky/accuweather_conky/tod_ton_raw
    egrep -i 'Early AM|Today|Tonight|Overnight|icon i-|cond|temp|Mon|Tue|Wed|Thu|Fri|Sat|Sun' /media/5/Conky/accuweather_conky/tod_ton_raw > /media/5/Conky/accuweather_conky/tod_ton
    sed -i -e 's/^.*#">//g' -e 's/^.*icon i-//g' -e 's/^.*cond">//g' -e 's/^.*temp">//g' /media/5/Conky/accuweather_conky/tod_ton
    sed -i -e 's/Lo<\/span> /\n/g' -e 's/<\/a>.*$//g' -e 's/ "><.*$//g' -e 's/&#.*$//g' -e 's/teo//g' /media/5/Conky/accuweather_conky/tod_ton
    sed -i -e 's/<span>.*$//g' -e 's/<\/span>//g' -e 's/\r$//g' -e 's/ i-alarm.*$//g' /media/5/Conky/accuweather_conky/tod_ton
  sed -i -e 's/Early AM/E-AM/' -e 's/Today/Day/' -e 's/Tonight/Nite/' -e 's/Overnight/O-nite/' -e 's/Mon$/Mon/' -e 's/Tue$/Tue/' -e 's/Wed$/Wed/' -e 's/Thu$/Thu/' -e 's/Fri$/Fri/' -e 's/Sat$/Sat/' -e 's/Sun$/Sun/' /media/5/Conky/accuweather_conky/tod_ton
    time=$(sed -n 1p /media/5/Conky/accuweather_conky/tod_ton)
    image=$(sed -n 2p /media/5/Conky/accuweather_conky/tod_ton)
if [[ $time == Day ]]; then
    sed -i 2s/$image/$(test_image_day $image)/ /media/5/Conky/accuweather_conky/tod_ton
elif [[ $time == Nite || $time == O-nite || $time == "E-AM" ]]; then
    sed -i 2s/$image/$(test_image_night $image)/ /media/5/Conky/accuweather_conky/tod_ton
        sed -i 3a- /media/5/Conky/accuweather_conky/tod_ton
fi
    for (( i=7; i<=22; i+=5 ))
  do
          image=$(sed -n "${i}"p /media/5/Conky/accuweather_conky/tod_ton)
      sed -i ${i}s/$image/$(test_image_day $image)/ /media/5/Conky/accuweather_conky/tod_ton
  done

fi

#Next 5 days
if [[ -s /media/5/Conky/accuweather_conky/last_days_raw ]]; then

    sed -i '/feed-tabs/,/\.feed-tabs/!d' /media/5/Conky/accuweather_conky/last_days_raw
    egrep -i 'icon i-|cond|temp|Mon|Tue|Wed|Thu|Fri|Sat|Sun' /media/5/Conky/accuweather_conky/last_days_raw > /media/5/Conky/accuweather_conky/last_days
    sed -i -e 's/^.*#">//g' -e 's/^.*icon i-//g' -e 's/^.*cond">//g' -e 's/^.*temp">//g' /media/5/Conky/accuweather_conky/last_days
    sed -i -e 's/Lo<\/span> /\n/g' -e 's/<\/a>.*$//g' -e 's/ "><.*$//g' -e 's/&#.*$//g' -e 's/teo//g' /media/5/Conky/accuweather_conky/last_days
    sed -i -e 's/<span>.*$//g' -e 's/<\/span>//g' -e 's/\r$//g' -e 's/ i-alarm.*$//g' /media/5/Conky/accuweather_conky/last_days
sed -i -e 's/Mon$/Mon/' -e 's/Tue$/Tue/' -e 's/Wed$/Wed/' -e 's/Thu$/Thu/' -e 's/Fri$/Fri/' -e 's/Sat$/Sat/' -e 's/Sun$/Sun/' /media/5/Conky/accuweather_conky/last_days
    for (( i=2; i<=22; i+=5 ))
  do
          image=$(sed -n "${i}"p /media/5/Conky/accuweather_conky/last_days)
      sed -i ${i}s/$image/$(test_image_day $image)/ /media/5/Conky/accuweather_conky/last_days
  done

fi

kill -CONT $(pidof conky)
Stay Home

Sector11

  • Posts: 870
    • View Profile
Re: Conky Codes and Images
« Reply #7 on: January 14, 2013, 06:58:08 PM »
Part I of III

Here's another one of Teo's scripts, shown with draw-bg.lua and various wallpapers.

1a_accuweather_conky_INT/accuweather_conky

Note: The change from Today to Tonight on the extreme right.  I waited for that to happen.

Using:
Code: [Select]
minimum_size 140 735  ## width, height
maximum_width 140   ## width
was important to set the size because of all the negative ${voffset} commands to being text up in line.

I have made some changes to the "accuw_script" so that it uses lowercase as well.

The Conky
Code: [Select]
# killall conky && conky -c /media/5/Conky/accuweather_conky/conkyrc_acc_int &
###  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_colour gray
own_window_class Conky
own_window_title Chronograph Full 2

# 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 140 735  ## width, height
maximum_width 140   ## width

gap_x 10  ### left &right
gap_y 10  ### up & down

alignment tl #ml
####################################################  End Window Settings  ###
###  Font Settings  ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
#xftfont CorporateMonoExtraBold:size=9
xftfont monofur:bold:size=12
# 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 no
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 C2CCFF #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
#####################################################  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

# If enabled, values which are in bytes will be printed in human readable
# format (i.e., KiB, MiB, etc). If disabled, bytes is printed instead
format_human_readable yes

# Shortens units to a single character (kiB->k, GiB->G, etc.). Default is off.
short_units yes

#   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  ###########################################################
### draw-bg.lua - Above and After TEXT - requires a composite manager ########
# ----------------------------------------------------------------------------
lua_load /media/5/Conky/LUA/draw-bg.lua
#TEXT
# ${lua conky_draw_bg 125 0 0 0 0 0x000000 0.3}
# ============================================================================
## OR Both above TEXT - No composite manager required.
# ----------------------------------------------------------------------------
#lua_load /media/5/Conky/LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 12 0 0 0 0 0x000000 0.5
# TEXT
#######################################################  End LUA Settings  ###

update_interval 1

TEXT
${lua conky_draw_bg 12 0 0 0 0 0x000000 0.3}\
Looking Out ${hr 2}$color${execi 600 bash /media/5/Conky/accuweather_conky/accuw_script}
Now\
${goto 90}${font conkyweather:size=40}${execi 600  sed -n '2p' /media/5/Conky/accuweather_conky/curr_cond}${font}
${voffset -40}   ${execpi 600 sed -n '4p' /media/5/Conky/accuweather_conky/curr_cond}°


${execpi 600 sed -n '1p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 90}${font conkyweather:size=40}${execi 600  sed -n '2p' /media/5/Conky/accuweather_conky/tod_ton}${font}
${voffset -40}    ↑ ${execpi 600 sed -n '4p' /media/5/Conky/accuweather_conky/tod_ton}°
    ↓ ${execpi 600 sed -n '5p' /media/5/Conky/accuweather_conky/tod_ton}°
${stippled_hr 5 1}
${execpi 600 sed -n '6p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 90}${font conkyweather:size=40}${execi 600  sed -n '7p' /media/5/Conky/accuweather_conky/tod_ton}${font}
${voffset -40}    ↑ ${execpi 600 sed -n '9p' /media/5/Conky/accuweather_conky/tod_ton}°
    ↓ ${execpi 600 sed -n '10p' /media/5/Conky/accuweather_conky/tod_ton}°
          ${stippled_hr 5 1}
${execpi 600 sed -n '11p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 90}${font conkyweather:size=40}${execi 600  sed -n '12p' /media/5/Conky/accuweather_conky/tod_ton}${font}
${voffset -40}    ↑ ${execpi 600 sed -n '14p' /media/5/Conky/accuweather_conky/tod_ton}°
    ↓ ${execpi 600 sed -n '15p' /media/5/Conky/accuweather_conky/tod_ton}°
          ${stippled_hr 5 1}
${execpi 600 sed -n '16p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 90}${font conkyweather:size=40}${execi 600  sed -n '17p' /media/5/Conky/accuweather_conky/tod_ton}${font}
${voffset -40}    ↑ ${execpi 600 sed -n '19p' /media/5/Conky/accuweather_conky/tod_ton}°
    ↓ ${execpi 600 sed -n '20p' /media/5/Conky/accuweather_conky/tod_ton}°
          ${stippled_hr 5 1}
${execpi 600 sed -n '21p' /media/5/Conky/accuweather_conky/tod_ton}\
${goto 90}${font conkyweather:size=40}${execi 600  sed -n '22p' /media/5/Conky/accuweather_conky/tod_ton}${font}
${voffset -40}    ↑ ${execpi 600 sed -n '24p' /media/5/Conky/accuweather_conky/tod_ton}°
    ↓ ${execpi 600 sed -n '25p' /media/5/Conky/accuweather_conky/tod_ton}°
          ${stippled_hr 5 1}
${execpi 600 sed -n '1p' /media/5/Conky/accuweather_conky/last_days}\
${goto 90}${font conkyweather:size=40}${execi 600  sed -n '2p' /media/5/Conky/accuweather_conky/last_days}${font}
${voffset -40}    ↑ ${execpi 600 sed -n '4p' /media/5/Conky/accuweather_conky/last_days}°
    ↓ ${execpi 600 sed -n '5p' /media/5/Conky/accuweather_conky/last_days}°
          ${stippled_hr 5 1}
${execpi 600 sed -n '6p' /media/5/Conky/accuweather_conky/last_days}\
${goto 90}${font conkyweather:size=40}${execi 600  sed -n '7p' /media/5/Conky/accuweather_conky/last_days}${font}
${voffset -40}    ↑ ${execpi 600 sed -n '9p' /media/5/Conky/accuweather_conky/last_days}°
    ↓ ${execpi 600 sed -n '10p' /media/5/Conky/accuweather_conky/last_days}°
          ${stippled_hr 5 1}
${execpi 600 sed -n '11p' /media/5/Conky/accuweather_conky/last_days}\
${goto 90}${font conkyweather:size=40}${execi 600  sed -n '12p' /media/5/Conky/accuweather_conky/last_days}${font}
${voffset -40}    ↑ ${execpi 600 sed -n '14p' /media/5/Conky/accuweather_conky/last_days}°
    ↓ ${execpi 600 sed -n '15p' /media/5/Conky/accuweather_conky/last_days}°
          ${stippled_hr 5 1}
${execpi 600 sed -n '16p' /media/5/Conky/accuweather_conky/last_days}\
${goto 90}${font conkyweather:size=40}${execi 600  sed -n '17p' /media/5/Conky/accuweather_conky/last_days}${font}
${voffset -40}    ↑ ${execpi 600 sed -n '19p' /media/5/Conky/accuweather_conky/last_days}°
    ↓ ${execpi 600 sed -n '20p' /media/5/Conky/accuweather_conky/last_days}°
          ${stippled_hr 5 1}
${execpi 600 sed -n '21p' /media/5/Conky/accuweather_conky/last_days}\
${goto 90}${font conkyweather:size=40}${execi 600  sed -n '22p' /media/5/Conky/accuweather_conky/last_days}${font}
${voffset -40}    ↑ ${execpi 600 sed -n '24p' /media/5/Conky/accuweather_conky/last_days}°
    ↓ ${execpi 600 sed -n '25p' /media/5/Conky/accuweather_conky/last_days}°

and the accuw_script
Code: [Select]
#!/bin/bash

#function: test_image_day
test_image_day () {
    case $1 in
         su)
           echo a
         ;;
         msu)
           echo b
         ;;
         psu)
           echo c
         ;;
         ic)
           echo c
         ;;
         h)
           echo c
         ;;
         mc)
           echo d
         ;;
         c)
           echo e
         ;;
         d)
           echo e
         ;;
         f)
           echo 0
         ;;
         s)
           echo h
         ;;
         mcs)
           echo g
         ;;
         psus)
           echo g
         ;;
         t)
           echo l
         ;;
         mct)
           echo k
         ;;
         psut)
           echo k
         ;;
         r)
           echo i
         ;;
         fl)
           echo p
         ;;
         mcfl)
           echo o
         ;;
         psfl)
           echo o
         ;;
         sn)
           echo r
         ;;
         mcsn)
           echo o
         ;;
         i)
           echo E
         ;;
         sl)
           echo u
         ;;
         fr)
           echo i
         ;;
         rsn)
           echo v
         ;;
         w)
           echo 6
         ;;
         ho)
           echo 5
         ;;
         co)
           echo E
         ;;
         cl)
           echo A
         ;;
         mcl)
           echo B
         ;;
         pc)
           echo C
         ;;
         pcs)
           echo G
         ;;
         pct)
           echo K
         ;;
        esac
}

#function: test_image_night
test_image_night () {
    case $1 in
su)
           echo a
         ;;
         msu)
           echo b
         ;;
         psu)
           echo c
         ;;
         c)
           echo f
         ;;
         d)
           echo f
         ;;
         f)
           echo f
         ;;
         s)
           echo h
         ;;
         psus)
           echo g
         ;;
         t)
           echo l
         ;;
         psut)
           echo k
         ;;
         r)
           echo i
         ;;
         fl)
           echo p
         ;;
         psfl)
           echo o
         ;;
         sn)
           echo r
         ;;
         i)
           echo E
         ;;
         sl)
           echo u
         ;;
         fr)
           echo i
         ;;
         rsn)
           echo v
         ;;
         ho)
           echo 5
         ;;
         co)
           echo E
         ;;
         cl)
           echo A
         ;;
         w)
           echo 6
         ;;
         mcl)
           echo B
         ;;
         pc)
           echo C
         ;;
         ic)
           echo B
         ;;
         h)
           echo B
         ;;
         mc)
           echo C
         ;;
         pcs)
           echo G
         ;;
         mcs)
           echo G
         ;;
         pct)
           echo K
         ;;
         mct)
           echo K
         ;;
         mcfl)
           echo O
         ;;
         mcsn)
           echo O
         ;;
        esac
}

kill -STOP $(pidof conky)
killall wget

#put your Accuweather address here
address="http://www.accuweather.com/en/ar/general-urquiza/1228994/weather-forecast/1228994"

loc_id=$(echo $address|sed 's/\/weather-forecast.*$//'|sed 's/^.*\///')
last_number=$(echo $address|sed 's/^.*\///')

curr_addr="$(echo $address|sed 's/weather-forecast.*$//')"current-weather/"$last_number"
wget -O /media/5/Conky/accuweather_conky/curr_cond_raw "$curr_addr"

addr1="$(echo $address|sed 's/weather-forecast.*$//')"daily-weather-forecast/"$last_number"
wget -O /media/5/Conky/accuweather_conky/tod_ton_raw "$addr1"

addr2="$addr1"?day=6
wget -O /media/5/Conky/accuweather_conky/last_days_raw "$addr2"

#current conditions
if [[ -s /media/5/Conky/accuweather_conky/curr_cond_raw ]]; then

    sed -i '/detail-now/,/#details/!d' /media/5/Conky/accuweather_conky/curr_cond_raw
    egrep -i '"cond"|icon i-|detail-tab-panel' /media/5/Conky/accuweather_conky/curr_cond_raw > /media/5/Conky/accuweather_conky/curr_cond
    sed -i -e 's/^.*detail-tab-panel //g' -e 's/^.*icon i-//g' -e 's/"><\/div>.*$//g' /media/5/Conky/accuweather_conky/curr_cond
    sed -i -e 's/^.*"cond">//g' -e 's/&deg/\n/g' -e 's/<\/span>.*"temp">/\n/g' -e 's/<.*>//g' /media/5/Conky/accuweather_conky/curr_cond
    sed -i -e 's/">//g' -e 's/-->//g' -e 's/\r$//g' -e 's/ i-alarm.*$//g' /media/5/Conky/accuweather_conky/curr_cond
time=$(sed -n 1p /media/5/Conky/accuweather_conky/curr_cond)
    image=$(sed -n 2p /media/5/Conky/accuweather_conky/curr_cond)
if [[ $time == day ]]; then
    sed -i 2s/$image/$(test_image_day $image)/ /media/5/Conky/accuweather_conky/curr_cond
elif [[ $time == night ]]; then
    sed -i 2s/$image/$(test_image_night $image)/ /media/5/Conky/accuweather_conky/curr_cond
fi

fi

#First 5 days
if [[ -s /media/5/Conky/accuweather_conky/tod_ton_raw ]]; then

    sed -i '/feed-tabs/,/\.feed-tabs/!d' /media/5/Conky/accuweather_conky/tod_ton_raw
    egrep -i 'Early AM|Today|Tonight|Overnight|icon i-|cond|temp|Mon|Tue|Wed|Thu|Fri|Sat|Sun' /media/5/Conky/accuweather_conky/tod_ton_raw > /media/5/Conky/accuweather_conky/tod_ton
    sed -i -e 's/^.*#">//g' -e 's/^.*icon i-//g' -e 's/^.*cond">//g' -e 's/^.*temp">//g' /media/5/Conky/accuweather_conky/tod_ton
    sed -i -e 's/Lo<\/span> /\n/g' -e 's/<\/a>.*$//g' -e 's/ "><.*$//g' -e 's/&#.*$//g' -e 's/teo//g' /media/5/Conky/accuweather_conky/tod_ton
    sed -i -e 's/<span>.*$//g' -e 's/<\/span>//g' -e 's/\r$//g' -e 's/ i-alarm.*$//g' /media/5/Conky/accuweather_conky/tod_ton
  sed -i -e 's/Early AM/Early AM/' -e 's/Today/Today/' -e 's/Tonight/Tonight/' -e 's/Overnight/Overnight/' -e 's/Mon$/Monday/' -e 's/Tue$/Tuesday/' -e 's/Wed$/Wednesday/' -e 's/Thu$/Thursday/' -e 's/Fri$/Friday/' -e 's/Sat$/Saturday/' -e 's/Sun$/Sunday/' /media/5/Conky/accuweather_conky/tod_ton
    time=$(sed -n 1p /media/5/Conky/accuweather_conky/tod_ton)
    image=$(sed -n 2p /media/5/Conky/accuweather_conky/tod_ton)
if [[ $time == Today ]]; then
    sed -i 2s/$image/$(test_image_day $image)/ /media/5/Conky/accuweather_conky/tod_ton
elif [[ $time == Tonight || $time == Overnight || $time == "Early AM" ]]; then
    sed -i 2s/$image/$(test_image_night $image)/ /media/5/Conky/accuweather_conky/tod_ton
        sed -i 3a- /media/5/Conky/accuweather_conky/tod_ton
fi
    for (( i=7; i<=22; i+=5 ))
  do
          image=$(sed -n "${i}"p /media/5/Conky/accuweather_conky/tod_ton)
      sed -i ${i}s/$image/$(test_image_day $image)/ /media/5/Conky/accuweather_conky/tod_ton
  done

fi

#Next 5 days
if [[ -s /media/5/Conky/accuweather_conky/last_days_raw ]]; then

    sed -i '/feed-tabs/,/\.feed-tabs/!d' /media/5/Conky/accuweather_conky/last_days_raw
    egrep -i 'icon i-|cond|temp|Mon|Tue|Wed|Thu|Fri|Sat|Sun' /media/5/Conky/accuweather_conky/last_days_raw > /media/5/Conky/accuweather_conky/last_days
    sed -i -e 's/^.*#">//g' -e 's/^.*icon i-//g' -e 's/^.*cond">//g' -e 's/^.*temp">//g' /media/5/Conky/accuweather_conky/last_days
    sed -i -e 's/Lo<\/span> /\n/g' -e 's/<\/a>.*$//g' -e 's/ "><.*$//g' -e 's/&#.*$//g' -e 's/teo//g' /media/5/Conky/accuweather_conky/last_days
    sed -i -e 's/<span>.*$//g' -e 's/<\/span>//g' -e 's/\r$//g' -e 's/ i-alarm.*$//g' /media/5/Conky/accuweather_conky/last_days
sed -i -e 's/Mon$/Monday/' -e 's/Tue$/Tuesday/' -e 's/Wed$/Wednesday/' -e 's/Thu$/Thursday/' -e 's/Fri$/Friday/' -e 's/Sat$/Saturday/' -e 's/Sun$/Sunday/' /media/5/Conky/accuweather_conky/last_days
    for (( i=2; i<=22; i+=5 ))
  do
          image=$(sed -n "${i}"p /media/5/Conky/accuweather_conky/last_days)
      sed -i ${i}s/$image/$(test_image_day $image)/ /media/5/Conky/accuweather_conky/last_days
  done

fi

kill -CONT $(pidof conky)
Stay Home

Sector11

  • Posts: 870
    • View Profile
Re: Conky Codes and Images
« Reply #8 on: January 14, 2013, 07:00:32 PM »
Quote from: jedi
@Sector11 an lwfitz, amazing stuff.  I'm really hooked on the horizontal Conky's.  Nice weather scheme in that one on Post # 5 Sector11!!!  :D

You want horizontal here's my latest . yesterday, it is now my main conky!



The conky: S11_VSIDO_v9.conkyrc
Code: [Select]
# killall conky && conky -c /media/5/Conky/S11_VSIDO_v9.conkyrc &
# Original by: VastOne on VSIDO

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# fiddle with window
use_spacer none #right

# Use Xft?
use_xft yes
xftfont Monofur:bold:size=12
xftalpha 1.0
# text_buffer_size 256

# Update interval in seconds
update_interval 1

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

own_window yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
own_window_transparent yes
# own_window_argb_visual yes
own_window_class Conky

# Stippled borders?
stippled_borders 0

# border margins
border_inner_margin 3

# border width
border_width 0

# Default colors and also border colors
default_color 00BFFF #  0 191 255 DeepSkyBlue
color0 FFDEAD #255 222 173 NavajoWhite
color1 7FFF00 #127 255   0 Chartreuse
color2 778899 #119 136 153 LightSlateGray
color3 FF8C00 #255 140   0 DarkOrange
color4 F0FFFF #240 255 255 Azure
color5 FFDEAD #255 222 173 NavajoWhite
color6 7B68EE #123 104 238 MediumSlateBlue
color7 00FFFF #  0 255 255 Cyan
color8 FFFF00 #255 255   0 Yellow
color9 FF0000 #255   0   0 Red

#default_shade_color black
#default_outline_color grey
own_window_colour 000000

# Text alignment, other possible values are commented
#alignment top_middle
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 5 # left-right
gap_y 5 # up-down

minimum_size 1265 0  ## width, height
#maximum_width 1250     ## width


# 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 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Shortens units to a single character (kiB->k, GiB->G, etc.). Default is off (no).
short_units yes

###  LUA Settings  ###########################################################
## Above and After TEXT - requires a composite manager or blinks.
##
# lua_load ~/Conky/LUA/draw-bg.lua
#TEXT
#${lua conky_draw_bg 10 0 0 0 0 0x000000 0.6}
#
## ${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.4
# 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/VSIDO-v9-template.lua
#######################################################  End LUA Settings  ###
#
TEXT
${execi 600 bash /media/5/Conky/accuweather_conky/accuw_script}\
        ${color}Kernel ${color4}${kernel}\
 ${color}MEM${color4}${if_match ${memperc}<10}  ${memperc}\
${else}${if_match ${memperc}<100} ${memperc}\
${else}${memperc}${endif}${endif}%\
 ${color}(${mem})\
 ${color}CPU${color4}${if_match ${platform f71882fg.2560 temp 1}<100} ${platform f71882fg.2560 temp 1}\
${else}${platform f71882fg.2560 temp 1}${endif}°\
 ${color}MB${color4}${if_match ${platform f71882fg.2560 temp 2}<100} ${platform f71882fg.2560 temp 2}\
${else}${platform f71882fg.2560 temp 2}${endif}°\
 ${color}HD${color4}${if_match ${execi 5 hddtemp -n /dev/sda}<100} ${execi 5 hddtemp -n /dev/sda}\
${else}${execi 5 hddtemp -n /dev/sda}${endif}°
        ${color}NET${color4} Dn: ${color2}${downspeedgraph eth0 12,150 00ff00 ff0000 -t -l}     ${color}Up: ${color2}${upspeedgraph eth0 12,150 ff0000 00ff00 -t -l}  ${color}Uptime ${color1}${uptime_short}
        ${color}CPU: 1${color4}${if_match ${cpu cpu1}<10}  ${cpu cpu1}\
${else}${if_match ${cpu cpu1}<100} ${cpu cpu1}\
${else}${cpu cpu0}${endif}${endif}%\
  ${color}2${color4}${if_match ${cpu cpu0}<10}  ${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100} ${cpu cpu0}\
${else}${cpu cpu0}${endif}${endif}%\
  ${color}3${color4}${if_match ${cpu cpu0}<10}  ${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100} ${cpu cpu0}\
${else}${cpu cpu0}${endif}${endif}%\
  ${color}4${color4}${if_match ${cpu cpu0}<10}  ${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100} ${cpu cpu0}\
${else}${cpu cpu0}${endif}${endif}%\
  ${color}Fan ${color4}${platform f71882fg.2560 fan 1} rpm\
  ${color}VRX·${color7}03  ${color4}04·${color1}${exec conkyDaysDiff 20130304}  ${color4}11·${color7}${exec conkyDaysDiff 20130311}  ${color4}16·${color3}${exec conkyDaysDiff 20130316}${color4}

VSIDO-v9-template.lua mrpeachy's v9000 is required.
Code: [Select]
--[[
 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=12
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

datax=670
dataxx=55
dataxx1=dataxx+30

datay1=13
datay2=25
datay3=40
datay4=55

datayy=13 --datay+(datayy*1)

imgx=687
imgx1=55 -- (imgx1*1)

imgyh=165
imgyf=190
imgyy=39 -- imgy+(imgyy*1)

-- out({c=0x00FFFF,,a=1,x=6,y=50,txt="cpu:"..conky_parse("${cpu}")})
-- VSIDO ICON ORB
image({w=55,h=55,x=5,y=5,file="/home/sector11/images/vsido/orbwallpaper3.png"})
-- today
out({c=0x00FFFF,a=1,x=datax,y=datay1,txt=forecast_day_short[1]})
out({c=0x00FFFF,a=1,x=datax+30,y=datay1,txt=forecast_date[1]})
  image({x=imgx,y=17,h=25,w=25,file=weather_icon[1]})
--image({x=imgx,y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax,y=datay2,txt=high_temp[1]})
out({c=0xF0FFFF,a=1,x=datax,y=datay3,txt=low_temp[1]})

out({c=0x00FFFF,a=1,x=datax+dataxx,y=datay1,txt="Current"})
out({c=0xF0FFFF,a=1,x=datax+dataxx,y=datay2,txt=now["temp"]})
out({c=0xFFDEAD,a=1,x=datax+dataxx,y=datay3,txt=now["feels_like"]})
  image({x=imgx+(imgx1*1),y=17,h=25,w=25,file=now["weather_icon"]})
--image({x=imgx+(imgx1*1),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})

out({c=0x00FFFF,a=1,x=datax+(dataxx*2),y=datay1,txt=forecast_day_short[2]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*2+30),y=datay1,txt=forecast_date[2]})
  image({x=imgx+(imgx1*2),y=17,h=25,w=25,file=weather_icon[2]})
--image({x=imgx+(imgx1*2),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*2),y=datay2,txt=high_temp[2]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*2),y=datay3,txt=low_temp[2]})

out({c=0x00FFFF,a=1,x=datax+(dataxx*3),y=datay1,txt=forecast_day_short[3]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*3+30),y=datay1,txt=forecast_date[3]})
  image({x=imgx+(imgx1*3),y=17,h=25,w=25,file=weather_icon[3]})
--image({x=imgx+(imgx1*3),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*3),y=datay2,txt=high_temp[3]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*3),y=datay3,txt=low_temp[3]})

out({c=0x00FFFF,a=1,x=datax+(dataxx*4),y=datay1,txt=forecast_day_short[4]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*4+30),y=datay1,txt=forecast_date[4]})
  image({x=imgx+(imgx1*4),y=17,h=25,w=25,file=weather_icon[4]})
--image({x=imgx+(imgx1*4),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*4),y=datay2,txt=high_temp[4]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*4),y=datay3,txt=low_temp[4]})

out({c=0x00FFFF,a=1,x=datax+(dataxx*5),y=datay1,txt=forecast_day_short[5]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*5+30),y=datay1,txt=forecast_date[5]})
  image({x=imgx+(imgx1*5),y=17,h=25,w=25,file=weather_icon[5]})
--image({x=imgx+(imgx1*5),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*5),y=datay2,txt=high_temp[5]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*5),y=datay3,txt=low_temp[5]})

out({c=0x00FFFF,a=1,x=datax+(dataxx*6),y=datay1,txt=forecast_day_short[6]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*6+30),y=datay1,txt=forecast_date[6]})
  image({x=imgx+(imgx1*6),y=17,h=25,w=25,file=weather_icon[6]})
--image({x=imgx+(imgx1*6),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*6),y=datay2,txt=high_temp[6]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*6),y=datay3,txt=low_temp[6]})

out({c=0x00FFFF,a=1,x=datax+(dataxx*7),y=datay1,txt=forecast_day_short[7]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*7+30),y=datay1,txt=forecast_date[7]})
  image({x=imgx+(imgx1*7),y=17,h=25,w=25,file=weather_icon[7]})
--image({x=imgx+(imgx1*7),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*7),y=datay2,txt=high_temp[7]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*7),y=datay3,txt=low_temp[7]})

out({c=0x00FFFF,a=1,x=datax+(dataxx*8),y=datay1,txt=forecast_day_short[8]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*8+30),y=datay1,txt=forecast_date[8]})
  image({x=imgx+(imgx1*8),y=17,h=25,w=25,file=weather_icon[8]})
--image({x=imgx+(imgx1*8),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*8),y=datay2,txt=high_temp[8]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*8),y=datay3,txt=low_temp[8]})

out({c=0x00FFFF,a=1,x=datax+(dataxx*9),y=datay1,txt=forecast_day_short[9]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*9+30),y=datay1,txt=forecast_date[9]})
  image({x=imgx+(imgx1*9),y=17,h=25,w=25,file=weather_icon[9]})
--image({x=imgx+(imgx1*9),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*9),y=datay2,txt=high_temp[9]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*9),y=datay3,txt=low_temp[9]})

out({c=0x00FFFF,a=10,x=datax+(dataxx*10),y=datay1,txt=forecast_day_short[10]})
out({c=0x00FFFF,a=10,x=datax+(dataxx*10+30),y=datay1,txt=forecast_date[10]})
  image({x=imgx+(imgx1*10),y=17,h=25,w=25,file=weather_icon[10]})
--image({x=imgx+(imgx1*10),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*10),y=datay2,txt=high_temp[10]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*10),y=datay3,txt=low_temp[10]})

-- BOTTOM LINE
out({c=0xF0FFFF,a=1,x=datax,y=datay4,txt="Today's Weather:"})
out({c=0x00FFFF,a=1,x=datax+115,y=datay4,txt="Pressure"})
out({c=0xF0FFFF,a=1,x=datax+175,y=datay4,txt=now["pressure_mb"].." mb"})
out({c=0x00FFFF,a=1,x=datax+245,y=datay4,txt="Humidity"})
out({c=0xF0FFFF,a=1,x=datax+305,y=datay4,txt=now["humidity"].."%"})

out({c=0x00FFFF,a=1,x=datax+338,y=datay4,txt="Dew Point"})
out({c=0xF0FFFF,a=1,x=datax+405,y=datay4,txt=now["dew_point"].."°"})
out({c=0x00FFFF,a=1,x=datax+435,y=datay4,txt="UV Index"})
out({c=0xF0FFFF,a=1,x=datax+495,y=datay4,txt=uv_index_num[1]})
out({c=0xF0FFFF,a=1,x=datax+515,y=datay4,txt=uv_index_txt[1]})

-- 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 ##################
--#######################################################################
Stay Home

Sector11

  • Posts: 870
    • View Profile
Re: Conky Codes and Images
« Reply #9 on: January 14, 2013, 07:01:46 PM »
This actually took a few days to do, life kept getting in the way.  So to relax, I worked on a conky.

On the left is the default conky that comes with 1d1_Accuweather_INT_Images, by TeoBigusGeekus, you'll need the script, on the right a new layout.

Both are set to use General Urquiza, CABA, Argentina.


The conky:
Code: [Select]
# killall conky && conky -c /media/5/Conky/Accuweather/Teo_Clock_Gen_Urquiza_AccuW.conky &
#
# Thank you:
# Chronograph LUA - mrpeachy (originally 4 clocks - tweaked by Sector11)
# v9000 LUA weather - mrpeachy
# background - londonali1010, mrpeachy, dk75
# TeoBigusGeekus - for the weather scripts

###  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_class Conky
own_window_title Teo Weather Clock General Urquiza

# 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 420 420  ## width, height
#maximum_width 420     ## width

### For use with The-Clock.lua
minimum_size 300 0  ## width, height
maximum_width 300     ## width

gap_x 10 #15        ### left &right
gap_y 10        ### up & down

### alignment values or top_left, bottom_right, etc
# tl, tm, tr
# ml, mm, mr
# bl, bm, br
alignment top_right

####################################################  End Window Settings  ###
###  Font Settings  ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
#xftfont CorporateMonoExtraBold:size=9
xftfont monofur:bold:size=11
# 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 no
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 C2CCFF # Not a clue - a blue #778899 #119 136 153 LightSlateGray
color1 AFEEEE #175 238 238 PaleTurquoise
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
#####################################################  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

# If enabled, values which are in bytes will be printed in human readable
# format (i.e., KiB, MiB, etc). If disabled, bytes is printed instead
format_human_readable yes

# Shortens units to a single character (kiB->k, GiB->G, etc.). Default is off.
short_units yes


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

## default bar size
default_bar_size 200 20

##############################################  End Miscellaneous Section  ###
###  LUA Settings  ###########################################################
## draw-bg.lua - Above and After TEXT - requires a composite manager.
##
lua_load /media/5/Conky/LUA/draw-bg.lua
#TEXT
# ${lua conky_draw_bg 125 0 0 0 0 0x000000 0.3}
#
# ----------------------------------------------------------------------------
## OR Both above TEXT - No composite manager required.
#
#lua_load ~/Conky_WeatherCom_metric/LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 20 0 0 0 0 0x000000 0.3
#
# TEXT
### Teo Weather Clock ########################################################
lua_load /media/5/Conky/LUA/Teo_Weather_Clock.lua
lua_draw_hook_post main
##############################  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.4}\
${lua conky_draw_bg 123 30 30 246 246 0xffffff 0.2}\
${texeci 500 bash /media/5/Conky/Accuweather/acc_int_images}\
${font monofur:size=24}${color7}${execi 600 sed -n '29p' /media/5/Conky/Accuweather/curr_cond}°${alignr}${color5}${execi 600 sed -n '30p' /media/5/Conky/Accuweather/curr_cond}°${font}
${color7}Temp${alignr 15}${color5}±${font}





${image /media/5/Conky/Accuweather/cc.png -p 102,120 -s 90x54}








${color}Today${alignr}${color1}Tonight${color}
${color5}↑ ${color2}${execi 600 sed -n '26p' /media/5/Conky/Accuweather/first_days}°${alignr}${color5}↓ ${color7}${execi 600 sed -n '31p' /media/5/Conky/Accuweather/first_days}°
${image /media/5/Conky/Accuweather/tod.png -p 0,280 -s 120x72}${image /media/5/Conky/Accuweather/ton.png -p 180,280 -s 120x72}



${color5}± ${execi 600 sed -n '27p' /media/5/Conky/Accuweather/first_days}°${alignr}± ${execi 600 sed -n '32p' /media/5/Conky/Accuweather/first_days}°
${goto 60} ${color5}SUN${goto 100}${color}↑ ${execi 600 sed -n '39p' /media/5/Conky/Accuweather/curr_cond}${goto 180}${color1}↓ ${execi 600 sed -n '40p' /media/5/Conky/Accuweather/curr_cond}
${goto 60}${color5}MOON ${goto 100}${color}↑ ${execi 600 sed -n '41p' /media/5/Conky/Accuweather/curr_cond}${goto 180}${color1}↓ ${color1}${execi 600 sed -n '42p' /media/5/Conky/Accuweather/curr_cond}
${color5}Humidity ${color7}${execi 600 sed -n '33p' /media/5/Conky/Accuweather/curr_cond}${alignr 5}${color5}Dew Point ${color7}${execi 600 sed -n '37p' /media/5/Conky/Accuweather/curr_cond}°${color}
${color5}Pressure ${color7}${execi 600 sed -n '34p' /media/5/Conky/Accuweather/curr_cond}${alignr 5}${color5}UV Index ${color7}${execi 600 sed -n '36p' /media/5/Conky/Accuweather/curr_cond}
${color5}Wind ${color7}${execi 600 sed -n '31p' /media/5/Conky/Accuweather/curr_cond} ${execi 600 sed -n '32p' /media/5/Conky/Accuweather/curr_cond}\
${alignr 5}${color5}Cloud Cover ${color7}${execi 600 sed -n '35p' /media/5/Conky/Accuweather/curr_cond}
${alignc}${color5}Visibility ${color7}${execi 600 sed -n '38p' /media/5/Conky/Accuweather/curr_cond}
 ${color1}${stippled_hr 5 1}
${color5}${execi 600 sed -n '5p' /media/5/Conky/Accuweather/first_days}${goto 113}${execi 600 sed -n '10p' /media/5/Conky/Accuweather/first_days}${goto 217}${execi 600 sed -n '15p' /media/5/Conky/Accuweather/first_days}
${image /media/5/Conky/Accuweather/6.png -p 0,475 -s 90x54}${image /media/5/Conky/Accuweather/11.png -p 110,475 -s 90x54}${image /media/5/Conky/Accuweather/16.png -p 210,475 -s 90x54}


↑ ${color2}${execi 600 sed -n '8p' /media/5/Conky/Accuweather/first_days}${goto 55}${color5}↓ ${color1}${execi 600 sed -n '9p' /media/5/Conky/Accuweather/first_days}\
${goto 111}↑ ${color2}${execi 600 sed -n '13p' /media/5/Conky/Accuweather/first_days}${goto 160}${color5}↓ ${color1}${execi 600 sed -n '14p' /media/5/Conky/Accuweather/first_days}\
${goto 215}↑ ${color2}${execi 600 sed -n '18p' /media/5/Conky/Accuweather/first_days}${goto 264}${color5}↓ ${color1}${execi 600 sed -n '19p' /media/5/Conky/Accuweather/first_days}

${color5}${execi 600 sed -n '20p' /media/5/Conky/Accuweather/first_days}${goto 113}${execi 600 sed -n '1p' /media/5/Conky/Accuweather/last_days}${goto 217}${execi 600 sed -n '6p' /media/5/Conky/Accuweather/last_days}
${image /media/5/Conky/Accuweather/21.png -p 0,565 -s 90x54}${image /media/5/Conky/Accuweather/last_2.png -p 106,565 -s 90x54}${image /media/5/Conky/Accuweather/last_7.png -p 210,565 -s 90x54}


↑ ${color2}${execi 600 sed -n '23p' /media/5/Conky/Accuweather/first_days}${goto 55}${color5}↓ ${color1}${execi 600 sed -n '24p' /media/5/Conky/Accuweather/first_days}\
${goto 111}↑ ${color2}${execi 600 sed -n '4p' /media/5/Conky/Accuweather/last_days}${goto 160}${color5}↓ ${color1}${execi 600 sed -n '5p' /media/5/Conky/Accuweather/last_days}\
${goto 215}↑ ${color2}${execi 600 sed -n '9p' /media/5/Conky/Accuweather/last_days}${goto 264}${color5}↓ ${color1}${execi 600 sed -n '10p' /media/5/Conky/Accuweather/last_days}

${color5}${execi 600 sed -n '11p' /media/5/Conky/Accuweather/last_days}${goto 113}${execi 600 sed -n '16p' /media/5/Conky/Accuweather/last_days}${goto 217}${execi 600 sed -n '21p' /media/5/Conky/Accuweather/last_days}
${image /media/5/Conky/Accuweather/last_12.png -p 0,655 -s 90x54}${image /media/5/Conky/Accuweather/last_17.png -p 106,655 -s 90x54}${image /media/5/Conky/Accuweather/last_22.png -p 210,655 -s 90x54}


↑ ${color2}${execi 600 sed -n '14p' /media/5/Conky/Accuweather/last_days}${goto 55}${color5}↓ ${color1}${execi 600 sed -n '15p' /media/5/Conky/Accuweather/last_days}\
${goto 111}↑ ${color2}${execi 600 sed -n '19p' /media/5/Conky/Accuweather/last_days}${goto 160}${color5}↓ ${color1}${execi 600 sed -n '20p' /media/5/Conky/Accuweather/last_days}\
${goto 215}↑ ${color2}${execi 600 sed -n '24p' /media/5/Conky/Accuweather/last_days}${goto 264}${color5}↓ ${color1}${execi 600 sed -n '25p' /media/5/Conky/Accuweather/last_days}
 ${color1}${stippled_hr 5 1}
 ${color3}With ${color}${nodename} ${color3}for the past: ${color}${uptime_short}
 ${color3}Kernel: ${color}${kernel}
 ${color3}CPU ${color7}1: ${color}${if_match ${cpu cpu1}<10}  ${cpu cpu1}\
${else}${if_match ${cpu cpu1}<100} ${cpu cpu1}\
${else}${cpu cpu1}\
${endif}${endif} %\
 ${color7}2: ${color}${if_match ${cpu cpu2}<10}  ${cpu cpu2}\
${else}${if_match ${cpu cpu2}<100} ${cpu cpu2}\
${else}${cpu cpu2}\
${endif}${endif} %\
 ${color7}3: ${color}${if_match ${cpu cpu3}<10}  ${cpu cpu3}\
${else}${if_match ${cpu cpu3}<100} ${cpu cpu3}\
${else}${cpu cpu3}\
${endif}${endif} %\
 ${color7}Avg: ${color}${if_match ${cpu cpu0}<10}  ${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100} ${cpu cpu0}\
${else}${cpu cpu0}\
${endif}${endif} %
 ${color3}CPU: ${color}${platform f71882fg.2560 temp 1}°${goto 90}${color3}SDA: ${color}${execi 15 hddtemp -n /dev/sda}°${goto 167}${color3}GPU: ${color}${nvidia temp}°${goto 245}${color3}MB: ${color}${platform f71882fg.2560 temp 2}°
 ${color3}RAM: ${color}${mem} / ${memmax} / ${memperc}% ${alignr 5}${color3}Swap: ${color}${swap} ${color}/ ${color}${swapmax}
 ${color3}eth-0 ${color7}Down: ${color}${downspeedf eth0}${goto 200}${color7}Up:  ${color}${upspeedf eth0}
 ${color1}${stippled_hr 5 1}

Teo_Weather_Clock.lua - the 24 hour clock adapted for Teo's scripts.
Code: [Select]
--[[ multiple analogue clocks by mrpeachy - 18 Jun 2012
 21 Jun 2012 - Chronograph modifications by Sector11
 22 Jun 2012 - again with mrpeachy's help day names, numbers and month names
 12 Nov 2012 - memory leak plugged - mrpeachy
 14 Nov 2012 - Personnalisation - Didier-T (forum Ubuntu.fr)
 26 Nov 2012 - The Clock - Sector11 (small version)

use in conkyrc

lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT

 -- INDEX use search|find with: -- ### sonething ###

 -- ### CLOCK POSITION - AND DEFAULTS ###
 -- ### SET BORDER OPTIONS FOR "CLOCKS" ### -- I don't know how to remove this - NOT NEEDED
 --     See lines 39 to 41 for overall size changes
 -- ### START DIAL B ### Day Names Dial ###
 --     See Lines 77 - 79 and 145 for changes
 -- ### START DIAL C ### Month Names Dial ###
 --     See Lines 143 -145 and 192 for changes
 -- ### START DIAL D ### Day Numbers Dial ###
 --     See Lines 226 & 257 for  changes
 -- ### START CLOCK A ###
 --     See Lines  &  and 456 & 483 changes
 -- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
 -- CLOCK A HOUR HAND
 -- CLOCK A MINUTE HAND SETUP
 -- CLOCK A SECOND HAND SETUP
 -- PART SECOND HAND Lines: 503 519, 531

NOTE:  Putting ### CLOCK A ### last insures that it's functions are written
       over the other dials.
]]

require 'cairo'
 -- ### CLOCK POSITION - AND DEFAULTS ##########################################
local init={
center_x=153, --from 135 = +40
center_y=153, --from 135
radius=140,
lang="English", -- English French Greek Spanish
hour=24, -- 12 | 24
second=true, --true | false - Seconds: dots and numbers IF 12HR
line=true, -- true | false - Part Second Hand
handday=false, -- DAY NAME hand - true or false
--handdaynum=false, -- DAY NUMBER hand - true or false
handmonth=false, -- MONTH NAME hand - true or false
color=0xFF0000, --color for day, day number and month IF NO SECOND HAND
alpha=1 --alpha for day, day number and month IF NO SECOND HAND
}

 -- ONLY NEED ONE COPY OF THIS FUNCTION
function rgb_to_r_g_b(col,alp)
  return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end
local colr, colg, colb, cola=rgb_to_r_g_b(init.color,init.alpha)

function conky_main()
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)
cr = cairo_create(cs)
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)

 -- ### CLOCK 12|24 HR SELECTOR ############################
local clock_type_A=init.hour
 -- ############################ CLOCK 12|24 HR SELECTOR ###

 -- ### SET BORDER OPTIONS FOR "CLOCKS" ####################
--local clock_border_width=0
 -- set color and alpha for clock border
--local cbr,cbg,cbb,cba=1,1,1,1 -- full opaque white
 -- gap from clock border to minute marks
local b_to_m=0
 -- #################### SET BORDER OPTIONS FOR "CLOCKS" ###

 -- ### START DIAL B ### Day Names Dial ####################
 -- DIAL POSITION
local center_x=init.center_x
local center_y=init.center_y
local radius=42
 -- FONT
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 14)
 -- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Sun","Mon","Tue","Wed","Thr","Fri","Sat",} end
if init.lang == "French" then text_days={"dim","lun","mar","mer","jeu","ven","sam",} end
if init.lang == "Greek" then text_days={"ΔΕΥ","ΤΡΙ","ΤΕΤ","ΠΕΜ","ΠΑΡ","ΣΑΒ","ΚΥΡ",} end
if init.lang == "Spanish" then text_days={"dom","lun","mar","mie","jue","vie","sab",} end

local day_number=tonumber(os.date("%w"))
if init.handday == true then
  for i=1,7 do
 -- work out points
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
else
  for i=1,7 do -- working out points
    if day_number == i-1 then
      cairo_set_source_rgba (cr,0,1,1,1) -- active colour
    else
      cairo_set_source_rgba (cr,1,1,1,0.07) -- non-active day names
    end
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
 -- INNER POINTS POSITION, radius smaller than text circle
  local radius=27
  for i=1,7 do
    if day_number == i-1 then
      cairo_set_source_rgba (cr,0,1,1,1) -- active colour
    else
      cairo_set_source_rgba (cr,1,1,1,0.07) -- non-active
    end
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
end
 -- ######################################### END DIAL B ###

 -- ### START DIAL C ### Month Names Dial ##################
 -- DIAL POSITION
local center_x=init.center_x --(+85)
local center_y=init.center_y
local radius=73
 -- FONT
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 14)
 -- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",} end
if init.lang == "French" then text_days={"jan","fév","mar","avr","mai","jui","jul","aôu","sep","oct","nov","déc",} end
if init.lang == "Greek" then text_days={"ΙΑΝ","ΦΕΒ","ΜΑΡ","ΑΠΡ","ΜΑΙ","ΙΟΥ","ΙΟΥ","ΑΥΓ","ΣΕΠ","ΟΚΤ","ΝΟΕ","ΔΕΚ",} end
if init.lang == "Spanish" then text_days={"ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic",} end

local this_month=tonumber(os.date("%m"))
if init.handmonth == true then
  for i=1,12 do
 -- OUTER POINTS POSTION FOR -- ### START DIAL C ## TEXT
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
else
  for i=1,12 do
    if this_month == i then
      cairo_set_source_rgba (cr,0,1,1,1) -- active month colour
    else
      cairo_set_source_rgba (cr,1,1,1,0.07) -- non-active month names
    end
 -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
 -- INNER POINTS POSITION, radius smaller than text circle
  local radius=58
  for i=1,12 do
    if this_month == i then
      cairo_set_source_rgba (cr,0,1,1,1) -- active colour
else
      cairo_set_source_rgba (cr,1,1,1,0.07) -- non-active month names
    end
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
end
 -- ######################################### END DIAL C ###

 -- ### START DIAL D ### Day Numbers Dial ##################
 -- GET NUMBER OF DAYS IN CURRENT MONTH
 -- calculate Feb, then set up table
year4num=os.date("%Y")
t1=os.time({year=year4num,month=03,day=01,hour=00,min=0,sec=0});
t2=os.time({year=year4num,month=02,day=01,hour=00,min=0,sec=0});
if init.hour == 12 then
  febdaynum=tonumber((os.difftime(t1,t2))/(12*60*60))
else
  febdaynum=tonumber((os.difftime(t1,t2))/(24*60*60))
end
 -- MONTH TABLE to get number of days
monthdays={31,febdaynum,31,30,31,30,31,31,30,31,30,31}
this_month=tonumber(os.date("%m"))
number_days=monthdays[this_month]
 -- TEXT positioning DAY #'s
local center_x=init.center_x
local center_y=init.center_y
local radius=105
cairo_select_font_face (cr, "Liquid Crystal", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 20)
local this_day=tonumber(os.date("%d"))
  for i=1,number_days do
 -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/number_days)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
    --only print even numbers
    if math.mod(i, 2) == 0 and math.mod(this_day, 2)==0 then
    text=string.format("%02d",i) --formats numbers to double digits
    elseif math.mod(i, 2) ~= 0 and math.mod(this_day, 2)~=0 then
    text=string.format("%02d",i) --formats numbers to double digits
    else
    text=""
    end --odd even matching
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
if i==this_day then
     cairo_set_source_rgba (cr,0,1,1,1) -- active colour
else
cairo_set_source_rgba (cr,1,1,1,0.35) -- dim inactive numbers
end
     cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
     cairo_show_text (cr, text)
     cairo_stroke (cr)
  end
 -- INNER POINTS POSITION, radius smaller than text circle
  local radius=90
  for i=1,number_days do
    local point=(math.pi/180)*((360/number_days)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
if i==this_day then
     cairo_set_source_rgba (cr,0,1,1,1) -- active colour
else
cairo_set_source_rgba (cr,1,1,1,0.35) -- dim the points
end
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
 -- ######################################### END DIAL D ###

 -- ### START CLOCK A ######################################
 -- SET MARKS ###
 -- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
local number_marks_A=init.hour
 -- set mark length
local m_length_A=0 -- doesn't work but can't delete
 -- set mark width
local m_width_A=0 -- doesn't work but can't delete
 -- set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
 -- set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,1,0 -- opaque white -- doesn't work but can't delete
 -- SETUP HOUR HANDS ###
 -- CLOCK A HOUR HAND
hh_length_A=90
 -- set hour hand width
hh_width_A=4
 -- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
 -- set hour hand color
 -- hhr,hhg,hhb,hha=1,0,1,0 -- fully opaque white --doesn't work
 -- SETUP MINUTE HANDS ###
 -- CLOCK A MINUTE HAND SETUP
 -- set length of minute hand
mh_length_A=123
 -- set minute hand width
mh_width_A=2
 -- set minute hand line cap
mh_cap=CAIRO_LINE_CAP_ROUND
 -- set minute hand color
--mhr,mhg,mhb,mha=1,1,1,0.5 -- fully opaque white --doesn't work

 -- SETUP SECOND HAND ###
 -- CLOCK A SECOND HAND SETUP -- DOESN'T WORK - Why ???????????????????????????
 -- set length of seconds hand -- yes I know it is commented out!
--sh_length_A=150
 -- set hour hand width
--sh_width_A=2
 -- set hour hand line cap
--sh_cap=CAIRO_LINE_CAP_ROUND
 -- set seconds hand color
--shr,shg,shb,sha=1,0,0,1 -- fully opaque red

 -- PART SECOND HAND
--position
--get seconds value
local seconds=tonumber(os.date("%S"))
--calculate rotation of second hand in degrees
if init.line == true then
  local arc=(math.pi/180)*((360/60)*seconds)
  --calculate point 1
  local radius1=120
  local x1=0+radius1*math.sin(arc)
  local y1=0-radius1*math.cos(arc)
  --calculate point 2
  local radius2=130
  local x2=0+radius2*math.sin(arc)
  local y2=0-radius2*math.cos(arc)
  --draw line connecting points
  cairo_move_to (cr, center_x+x1,center_y+y1)
  cairo_line_to (cr, center_x+x2, center_y+y2)
  cairo_set_source_rgba (cr,255/255,0/255,0/255,1) -- PART SECOND HAND
  cairo_stroke (cr)
end

 -- CLOCK A ### 12 HR TIME ###
 -- CLOCK SETTINGS
clock_radius=0 --does not work
clock_centerx=init.center_x -- centre of Clock hands
clock_centery=init.center_y -- centre of Clock hands
 -- DRAWING CODE
 -- DRAW MARKS
 -- stuff that can be moved outside of the loop, needs only be set once
 -- calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length_A -- WHAT IS THIS??
 -- set line cap type
cairo_set_line_cap  (cr, m_cap)
 -- set line width
cairo_set_line_width (cr,m_width_A)
 -- set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
 -- START LOOP FOR HOUR MARKS
for i=1,number_marks_A do
 -- drawing code using the value of i to calculate degrees
 -- calculate start point for 12/24 hour mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
 -- set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
 -- calculate end point for 12/24 hour mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
 -- set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
 -- draw the line
cairo_stroke (cr)
end -- of for loop
 -- HOUR MARKS -- ???????????????????????????????????????????????????????????????
 -- TIME CALCULATIONS CLOCK A
if clock_type_A==12 then
hours=tonumber(os.date("%I"))
 -- convert hours to seconds
h_to_s=hours*60*60
elseif clock_type_A==24 then
hours=tonumber(os.date("%H"))
 -- convert hours to seconds
h_to_s=hours*60*60
end
minutes=tonumber(os.date("%M"))
 -- convert minutes to seconds
m_to_s=minutes*60
 -- get current seconds
seconds=tonumber(os.date("%S"))
 -- DRAW HOUR HAND ###
 -- get hours minutes seconds as just seconds
hsecs=h_to_s+m_to_s+seconds
 -- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*clock_type_A)) -- use equation ~ eliminate decimals
 -- set radius to calculate hand points
radius=hh_length_A
 -- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
 -- calculate coordinates for end of hour hand
point=(math.pi/180)*hsec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
 -- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
 -- set up line attributes and draw line
cairo_set_line_width (cr,hh_width_A)
cairo_set_source_rgba (cr,0,1,1,0.7) -- active colour Hour Hand ================
cairo_set_line_cap  (cr, hh_cap)
cairo_stroke (cr)
 -- DRAW MINUTE HAND
 -- get minutes and seconds just as seconds
msecs=m_to_s+seconds
 -- calculate degrees for each second
msec_degs=msecs*0.1
 -- set radius to calculate hand points
radius=mh_length_A
 -- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
 -- calculate coordinates for end of minute hand
point=(math.pi/180)*msec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
 -- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
 -- set up line attributes and draw line
cairo_set_line_width (cr,mh_width_A)
cairo_set_source_rgba (cr,0,1,1,0.7) -- active colour Minute Hand ==============
cairo_set_line_cap  (cr, mh_cap)
cairo_stroke (cr)
 -- ### CLOCK A ###
local center_x=init.center_x -- Centre of the HR / Min Numbers
local center_y=init.center_y -- Centre of the HR / Min Numbers
local radius=init.radius -- 12/24 HR CLOCK Hours/Minutes radius -- seeline 42
cairo_select_font_face (cr, "DS-Digital", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 22)
cairo_set_source_rgba (cr,1,1,1,1.0) -- HR Clock numbers
 -- TABLE OF TEXT -- in order
if init.hour == 12 then
  text_days={"12","01","02","03","04","05","06","07","08","09","10","11",}
  for i=1,12 do
 -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_set_source_rgba (cr,1,1,1,1.0) -- colour of HR Numbers
    cairo_stroke (cr)
  end
 -- INNER POINTS POSITION, radius smaller than text circle
  local radius=124 -- 12 HR Clock
  for i=1,12 do
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_set_source_rgba (cr,1,1,1,0.50)
    cairo_stroke (cr)
  end
end
if init.hour == 24 then
  text_days={"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23",}
  for i=1,24 do
 -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/24)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
 -- INNER POINTS POSITION, radius smaller than text circle
  local radius=124 -- 24 HR Clock
  for i=1,24 do
    local point=(math.pi/180)*((360/24)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_set_source_rgba (cr,1,1,1,0.4)
    cairo_stroke (cr)
  end
end

 -- ############################################################################
 -- POSITION FOR TEXT HOUR NUMBERS
  if init.hour == 12 and init.second == true then
    text_days={"","01","02","03","04","","06","07","08","09","","11","12","13","14","","16","17","18","19","","21","22","23","24","","26","27","28","29","","31","32","33","34","","36","37","38","39","","41","42","43","44","","46","47","48","49","","51","52","53","54","","56","57","58","59","",}
 -- INNER POINTS POSITION, radius smaller than text circle
    cairo_set_source_rgba (cr,1,1,1,0.07) -- does not work -- settings moved
    cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    for i=1,60 do
      local radius=124 -- dots for seconds Clock A (12 dial)
      local point=(math.pi/180)*((360/60)*(i-1))
      local x=0+radius*(math.sin(point))
      local y=0-radius*(math.cos(point))
      if seconds == i-1 then
        cairo_set_source_rgba (cr,255/255,0/255,0/255,0.07) -- does not work - settings moved
      else
        if i-1 == 0 or i-1 == 5 or i-1 == 10 or i-1 == 15 or i-1 == 25 or i-1 == 30 or i-1 == 35 or i-1 == 40 or i-1 == 45 or i-1 == 50 or i-1 == 55 then
          cairo_set_source_rgba (cr,0,1,1,1) -- active colour
        else
          cairo_set_source_rgba (cr,0,1,1,0.0) -- dots for seconds A Clock
        end
      end
      cairo_arc (cr,center_x+x,center_y+y,1/2,0,2*math.pi)
      cairo_stroke (cr)
    end
    radius=radius-3
    cairo_set_font_size (cr, 10)
    for i=1,60 do
 -- OUTTER POINTS POSTION FOR TEXT
      local point=(math.pi/180)*((360/60)*(i-1))
      local x=0+radius*(math.sin(point))
      local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
      local text=text_days[i]--gets text from table
      if seconds == tonumber(text) then
      cairo_set_source_rgba (cr,0,1,1,1.0) -- active colour
      else
        cairo_set_source_rgba (cr,1,1,1,0.15) -- seconds numbers
      end
      cairo_text_extents(cr,text,extents)
      local width=extents.width
      local height=extents.height
      cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
      cairo_show_text (cr, text)
      cairo_stroke (cr)
    end
  end
 -- ############################################################################
cairo_stroke (cr)
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end -- end main function
--[[ mrpeachy wrote:

    the numbers are drawn using a for loop somewhere, like this

    for i=1,12 do
    calculate position of number
    move_to(x,y)
    show_text(i)
    end

    change it to something like this

    for i=1,12 do
    calculate position of number
      if i==month_number then
      move_to(x,y)
      show_text(month_number)
      else
      move_to(x,y)
      show_text(i)
      end
    end ]]

draw-bg.lua
Code: [Select]
--[[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.4}

OR Both above TEXT (no composite manager required - no blinking!)
@Mr Peachy
 lua_load ~/wea_conky/draw_bg.lua
 lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.5
 TEXT

Note
${lua conky_draw_bg 20 0 0 0 0 0x000000 0.4}
  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#######################################################
Stay Home

lwfitz

  • DEFCON 1
  • Posts: 1734
  • sudo rm -rf /
    • View Profile
Re: Conky Codes and Images
« Reply #10 on: January 14, 2013, 07:03:36 PM »

Sector11

  • Posts: 870
    • View Profile
Re: Conky Codes and Images
« Reply #11 on: January 14, 2013, 07:04:08 PM »
Works well on white too!  OK So I'm conky crazy!!!!!



Code: [Select]
##### TEST #####
# killall conky && conky -c ~/.conkyrc.vsido &
# .conkyrc - Edited from various examples across the 'net
# Used by VastOne on #!

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Use Xft?
use_xft yes
xftfont Liberation Mono:bold:size=13.5
xftalpha 0.9

# Update interval in seconds
update_interval 1

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area  - not required unless you need to FORCE things
#minimum_size 1024 0
#maximum_width 1024

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window yes
own_window_transparent yes
own_window_class conky-semi
#own_window_argb_visual yes

# Stippled borders?
stippled_borders 0

# border margins
# border_inner_margin 0
# border_outer_margin 0
# border_width 1

# Default and border colors
default_color 73AEB4 ## VSIDO Light Blue
color0 7D8C93 ## VSIDO Light Grey
color1 32CD32 ## VSIDO Lime Green

#default_shade_color black
#default_outline_color grey
own_window_colour 000000

# Text alignment, other possible values are commented
alignment top_left

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 0
gap_y 5

# 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 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# 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 none

### Added
# Shortens units to a single character (kiB->k, GiB->G, etc.). Default is off.
short_units yes

# lua_load ~/Conky/LUA/draw-bg.lua
# lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.3
#
TEXT
${image $HOME/images/debian2.png -s 40x40 -p 1,0}    ${color}Kernel ${color0}${kernel} ${color}Disk ${color0}${fs_used /} ${color1}/ ${color0}${fs_size /} ${color}Network ${color0}${downspeedgraph eth0 14,100 000000 ff0000} ${upspeedgraph eth0 14,100 000000 00ff00}
    ${color}CPU ${color0}${if_match ${cpu cpu0} < 10} ${cpu cpu0}${else}${cpu cpu0}${endif}${color1}%   \
${color}RAM ${color0}${if_match ${memperc} < 10} ${memperc}${else}${memperc}${endif}${color1}%   \
${color0}${mem} ${color1}/ ${color0}${memmax}   ${color}SDA ${color0}${execi 5 hddtemp -n /dev/sda}${color1}°${goto 530}${color}Uptime ${color1}${uptime_short}${color}
Stay Home

Sector11

  • Posts: 870
    • View Profile
Re: Conky Codes and Images
« Reply #12 on: January 14, 2013, 07:06:19 PM »
MINE!!! I tell you all MINE! - Contract?  What contract?  ALPHA TEAM Contract ... OH!!!   8o

Just pullin' yer leg! Sure enough ...

Now that I have liquored it up {hic} and added NVIDIA, a new screenshot to compare differences in width:

Heeeeeeeeeeeeeeeeeeeeeers Marvin!


The top piece of code is the original conky line with the hash marks removed from the colour commands like: ${color 7D8C93} - it even has the overkill of colour changes.  Like:
Code: [Select]
${color 7D8C93} ${color 7D8C93}${color 73AEB4} ${color 73AEB4}Network${color 7D8C93}
Save this as: ~/.conkyrc.vsido and use the second line to KFC and restart this conky.
Code: [Select]
##### TEST #####
# killall conky && conky -c ~/.conkyrc.vsido &
# .conkyrc - Edited from various examples across the 'net
# Used by VastOne on #!

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Use Xft?
use_xft yes
xftfont Liberation Sans:size=15
xftalpha 0.9

#text_buffer_size 2048
## text_buffer_size is not required by this conky:
## Size of the standard text buffer (default is 256 bytes). This buffer is used
## for intermediary text, such as individual lines, output from $exec vars, and
## various other variables. Increasing the size of this buffer can drastically
## reduce Conky's performance, but will allow for more text display per variable.
## The size of this buffer cannot be smaller than the default value of 256 bytes.
##
## The KEY: for more text display per variable.

# Update interval in seconds
update_interval 1

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area  - not required unless you need to FORCE things
#minimum_size 1024 0
#maximum_width 1024

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no
own_window_type normal #desktop - to allow right clicks on the conky.
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window yes
own_window_transparent yes
own_window_class conky-semi
# own_window_argb_visual yes

# Stippled borders?
stippled_borders 0

# border margins
# border_margin 0 ## <<--- defunct now use below
# border_inner_margin 0
# border_outer_margin 0

# border width
# border_width 1  # above you have draw_borders no - this not required

# Default and border colors
default_color 73AEB4 ## VSIDO Light Blue
color0 7D8C93 ## VSIDO Light Grey
color1 32CD32 ## VSIDO Lime Green

#default_shade_color black
#default_outline_color grey
own_window_colour 000000

# Text alignment, other possible values are commented
#alignment top_middle
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 0
gap_y 5

# 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 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# 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 none

### Added
# Shortens units to a single character (kiB->k, GiB->G, etc.). Default is off.
short_units yes

# lua_load ~/Conky/LUA/draw-bg.lua
# lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.3
#
TEXT
${image $HOME/images/debian2.png -s 40x40 -p 1,-1} ${color 7D8C93}      ${color 73AEB4}Kernel${color 7D8C93} $kernel ${color 73AEB4} Uptime ${color lime green}${uptime_short} ${color 7D8C93} CPU ${color 73AEB4}${cpu cpu0}% ${color 7D8C93}RAM ${color 73AEB4}${memperc}% ${mem} / ${memmax} ${color 7D8C93} ${color 7D8C93}Disk ${color 73AEB4}${fs_used /}/${fs_size /} ${color 7D8C93}HD${color 73AEB4} ${execi 5 hddtemp -n /dev/sda}° ${color 7D8C93} ${color 7D8C93}${color 73AEB4} ${color 73AEB4}Network${color 7D8C93} ${voffset 3}${downspeedgraph eth0 14,100 000000 ff0000} ${upspeedgraph eth0 14,100 000000 00ff00}

${color white}  Hardcoded kernels - original font|size:
${image $HOME/images/debian2.png -s 40x40 -p 1,78}       ${color}Kernel ${color0}3.2.0-4-amd64 ${color}Disk ${color0}${fs_used /} ${color1}/ ${color0}${fs_size /} ${color}Network${color0} ${voffset 2}${downspeedgraph eth0 14,100 000000 ff0000} ${upspeedgraph eth0 14,100 000000 00ff00}
       ${color}CPU ${color0}${if_match ${cpu cpu0} < 10}0${cpu cpu0}${else}${cpu cpu0}${endif}${color1}%   \
${color}RAM ${color0}${if_match ${memperc} < 10}0${memperc}${else}${memperc}${endif}${color1}%   \
${color0}${mem} ${color1}/ ${color0}${memmax}   ${color}SDA${color0} ${execi 5 hddtemp -n /dev/sda}${color1}°${goto 530}${color}Uptime ${color1}${uptime_short}

${image $HOME/images/debian2.png -s 40x40 -p 1,147}       ${color}Kernel ${color0}3.6.0-3.dmz.2-liquorix-amd64 ${color}Disk ${color0}${fs_used /} ${color1}/ ${color0}${fs_size /} ${color}Network${color0} ${voffset 2}${downspeedgraph eth0 14,100 000000 ff0000} ${upspeedgraph eth0 14,100 000000 00ff00}
       ${color}CPU ${color0}${if_match ${cpu cpu0} < 10}0${cpu cpu0}${else}${cpu cpu0}${endif}${color1}%   \
${color}RAM ${color0}${if_match ${memperc} < 10}0${memperc}${else}${memperc}${endif}${color1}%   \
${color0}${mem} ${color1}/ ${color0}${memmax}   ${color}SDA${color0} ${execi 5 hddtemp -n /dev/sda}${color1}°${goto 530}${color}Uptime ${color1}${uptime_short}${color}

${color white}  real working code - no "0X%" just padded spaces - still moves around - not mono font:

${image $HOME/images/debian2.png -s 40x40 -p 1,257}       ${color}Kernel ${color0}${kernel} ${color}Disk ${color0}${fs_used /} ${color1}/ ${color0}${fs_size /} ${color}Network${color0} ${voffset 2}${downspeedgraph eth0 14,100 000000 ff0000} ${upspeedgraph eth0 14,100 000000 00ff00}
       ${color}CPU ${color0}${if_match ${cpu cpu0} < 10} ${cpu cpu0}${else}${cpu cpu0}${endif}${color1}%   \
${color}RAM ${color0}${if_match ${memperc} < 10} ${memperc}${else}${memperc}${endif}${color1}%   \
${color0}${mem} ${color1}/ ${color0}${memmax}   ${color}SDA ${color0}${execi 5 hddtemp -n /dev/sda}${color1}°${goto 530}${color}Uptime ${color1}${uptime_short}${color}

${font DejaVu Sans Mono:size=13}${color white} real working code - no "0X%" just padded spaces - DejaVu Sans Mono size 13

${image $HOME/images/debian2.png -s 40x40 -p 1,367}    ${color}Kernel ${color0}${kernel} ${color}Disk ${color0}${fs_used /} ${color1}/ ${color0}${fs_size /} ${color}Network${color0} ${voffset 2}${downspeedgraph eth0 14,100 000000 ff0000} ${upspeedgraph eth0 14,100 000000 00ff00}
    ${color}CPU ${color0}${if_match ${cpu cpu0} < 10} ${cpu cpu0}${else}${cpu cpu0}${endif}${color1}%   \
${color}RAM ${color0}${if_match ${memperc} < 10} ${memperc}${else}${memperc}${endif}${color1}%   \
${color0}${mem} ${color1}/ ${color0}${memmax}   ${color}SDA ${color0}${execi 5 hddtemp -n /dev/sda}${color1}°${goto 530}${color}Uptime ${color1}${uptime_short}${color}

${font Liberation Mono:bold:size=13}${color white} real working code - no "0X%" just padded spaces - Liberation Mono size 13 bold

${image $HOME/images/debian2.png -s 40x40 -p 1,467}    ${color}Kernel ${color0}${kernel} ${color}Disk ${color0}${fs_used /} ${color1}/ ${color0}${fs_size /} ${color}Network${color0} ${voffset 2}${downspeedgraph eth0 14,100 000000 ff0000} ${upspeedgraph eth0 14,100 000000 00ff00}
    ${color}CPU ${color0}${if_match ${cpu cpu0} < 10} ${cpu cpu0}${else}${cpu cpu0}${endif}${color1}%   \
${color}RAM ${color0}${if_match ${memperc} < 10} ${memperc}${else}${memperc}${endif}${color1}%   \
${color0}${mem} ${color1}/ ${color0}${memmax}   ${color}SDA ${color0}${execi 5 hddtemp -n /dev/sda}${color1}°${goto 530}${color}Uptime ${color1}${uptime_short}${color}

${font Liberation Mono:bold:size=13.5}${color white} real working code - no "0X%" just padded spaces - Liberation Mono size 13.5 bold

${image $HOME/images/debian2.png -s 40x40 -p 1,567}    ${color}Kernel ${color0}${kernel} ${color}Disk ${color0}${fs_used /} ${color1}/ ${color0}${fs_size /} ${color}Network${color0} ${voffset 2}${downspeedgraph eth0 14,100 000000 ff0000} ${upspeedgraph eth0 14,100 000000 00ff00}
    ${color}CPU ${color0}${if_match ${cpu cpu0} < 10} ${cpu cpu0}${else}${cpu cpu0}${endif}${color1}%   \
${color}RAM ${color0}${if_match ${memperc} < 10} ${memperc}${else}${memperc}${endif}${color1}%   \
${color0}${mem} ${color1}/ ${color0}${memmax}   ${color}SDA ${color0}${execi 5 hddtemp -n /dev/sda}${color1}°${goto 530}${color}Uptime ${color1}${uptime_short}${color}

Made one addition the Liberation bold 13.5 size.
IMHO: That's the one!
Stay Home

Sector11

  • Posts: 870
    • View Profile
Re: Conky Codes and Images
« Reply #13 on: January 14, 2013, 07:06:57 PM »
OK, here's another idea for a default conky, that will fit smaller screens as well - like mine.

I like the last 2 ines - liberation mono size 13... nice clean font:


Here's the original conky on my screen


On the top the "not quite" original code.

Thoughts ... opinions ... criticisms ... just don't toss rotten veggies or eggs please.
Stay Home

Sector11

  • Posts: 870
    • View Profile
Re: Conky Codes and Images
« Reply #14 on: January 14, 2013, 07:08:02 PM »
Here's a simple little conky:


I ran it under two kernals, notice the difference in width.

I am using minimum_width only:
Code: [Select]
minimum_size 160 0     ## width, height
#maximum_width 160       ## width
That way the "3.6-trunk-amd64" kernal looks good and so does the "3.6.0-3.dmz.2-liquorix-amd64" as that sets the width for the conky

Some other things I'm using are:
${time %x}
Quote
%x     Preferred date representation based on locale, without the time     Example: 02/05/09 for February 5, 2009
as you see in the image above, mine is 26/12/12 = 26 December 2012 as set by my LOCALE settings system wide
${time %X}
Quote
%X     Preferred time representation based on locale, without the date     Example: 03:59:16 or 15:59:16
Mine shows 03:37:20 PM as Argentina doesn't use 24HR time "officially" (so my local conky uses %T =24HR)

The two time commands above makes the conky a bit mote "international" as it uses the machines "LOCALE" settings.

For CPU's I have:
Code: [Select]
# CPU 1:${alignr 5}${cpu cpu1}%
# CPU 2:${alignr 5}${cpu cpu2}%
# CPU 3:${alignr 5}${cpu cpu3}%
# CPU 4:${alignr 5}${cpu cpu4}%
# CPU Avg:${alignr 5}${cpu cpu0}%
 CPU:${alignr 5}${cpu cpu0}%
... to show people that they can use all their CPU's and the "Average"

The VSIDO Logo:

and the conky:
Code: [Select]
# killall conky && conky &
## VSIDO Default conky
###  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_colour gray
own_window_class Conky
own_window_title VSIDO Default Conky

# 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 255

minimum_size 160 0     ## width, height
#maximum_width 160       ## width

gap_x 10 # left-right
gap_y 0 # up-down

alignment middle_right
###################################################  End Window Settings  ###
###  Font Settings  #########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont Monofont:bold:size=9

# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1
# Force UTF8? requires XFT ###
override_utf8_locale yes

draw_shades no
default_shade_color black

draw_outline no # amplifies text if yes
default_outline_color black

uppercase no
######################################################  End Font Settings  ###
###  Color Settings  #########################################################
default_shade_color gray
default_outline_color black

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
#####################################################  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 1
# graph borders
draw_graph_borders yes
#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
0
# 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 ~/Conky/LUA/draw-bg.lua
#TEXT
#${lua conky_draw_bg 10 0 0 0 0 0x000000 0.6}
#
## ${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 ~/Conky/LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 15 0 0 0 0 0x000000 0.5
# lua_draw_hook_post draw-bg 125 0 0 0 0 0x000000 0.01
#
# TEXT
#
#######################################################  End LUA Settings  ###
update_interval 1

TEXT
${lua conky_draw_bg 15 0 0 0 0 0x000000 0.5}${image $HOME/Conky/images/VSIDO_Logo.png -s 60x60 -p 0,0}\
${alignr 5}${time %X}
${alignr 5}${time %x}

${alignr 5}${uptime_short}
${hr}
${alignc}${kernel}
${hr}
 Host:${alignr 5}${nodename}

 RAM:${alignr 5}${mem} / ${memmax}
 Swap:${alignr 5}${swap} / ${swapmax}
 Disk:${alignr 5}${fs_used /} / ${fs_size /}

# CPU 1:${alignr 5}${cpu cpu1}%
# CPU 2:${alignr 5}${cpu cpu2}%
# CPU 3:${alignr 5}${cpu cpu3}%
# CPU 4:${alignr 5}${cpu cpu4}%
# CPU Avg:${alignr 5}${cpu cpu0}%
 CPU:${alignr 5}${cpu cpu0}%

 /Root: ${fs_size /}${alignr 5}${fs_used_perc /}%${color}
 /Home: ${fs_size /home}${alignr 5}${fs_used_perc /home}%

 DISK ${hr}
 Read:${alignr 5}${diskio_read /dev/sda}
 Write:${alignr 5}${diskio_write /dev/sda}

 NETWORK ${hr}
${alignc}${downspeedgraph eth0 14,140 000000 ff0000}

 Down:${alignr 5}${downspeedf eth0}
${alignc}${upspeedgraph eth0 14,140 000000 00ff00}

 Up:${alignr 5}${upspeedf eth0}

Have fun!
Stay Home