You are not logged in.
^ I tried that one from the tar but there are a couple of files missing...
/home/kitsune/.conky/lua/lwifitz-allcombined[dk75mod].lua
and
conky-vnstat-month.sh
Offline
@dk75
so now you can code using lua/cairo directly in the conkyrc?
i tried installing the deb but got some missing dependancy issues, will try and track them down and see if i can get it running
Last edited by mrpeachy (2012-10-31 20:01:53)
Offline
^ I tried that one from the tar but there are a couple of files missing...
/home/kitsune/.conky/lua/lwifitz-allcombined[dk75mod].lua and conky-vnstat-month.sh
Then use anything else - it was as to show how settings and "TEXT" block are in LUA conkyrc.
Settings are one table, and "TEXT" block is as string. But as inside of this string can be single or double quote chars, then it is enclosed in long brackets.
If you want to comment out some instructions without deleting it from "TEXT" block, you just close string before this instruction, add concatenation (".."), comment out what you want in LUA style, and then open up a string again, like:
conky.text = [[${alignc}This is a test]] ..
-- this line is commented out
[[This line is after "commented" one, but.. ]] .. --[[you can comment out inside]] [[there is 'comment' inside this line]]
@dk75
so now you can code using lua/cairo directly in the conkyrc?
No, you still need to use '${lua}' to use functions from script and 'lua_load' to load the script.
I've thought that at least we could use LUA variables and table directly from conkyrc without need for 'loadstring' function in LUA script - unfortunately it's not the case too.
guess i tried installing the deb but got some missing dependancy issues, will try and track them down and see if i can get it running
Next time packaging, I must add more packet as dependencies to it, at least essential one.
I've done 'dpkg-depcheck -d ./configure' as required and copied packages from it to 'debian/control' but it seems not enough.
Last edited by dk75 (2012-10-31 20:11:41)
Debian Sid (Minted) x86_64/3.12-10, Conky 2.0_pre, Xorg 7.7/1.15.0, KDE 4.11.5, Intel X3100
Lenovo T61, HITACHI HTS722010K9SA00 100GB, WDC_WD5000BEVT 500GB
Linux user No.: 483055 | Conky Pitstop
Offline
I see that you are having a good time conkying with v2.0, but here I come with a quick question (in the old one)
How can I draw a block of text in lua? Lets assume there is a text file with many lines of stuff and I want to draw it on the screen, line by line. How?
Is this the way?
local file = io.popen("cat /here/is/the/habababa.txt")
for line in file:lines() do
s,f,used=string.find(line,"%a*(.*)\n") -- this is the stuff I dont quite undestand...
end
file:close()
Or there is other way?
Thanks in advance !
"Remember, don't pay attention to the competition itself. Ignore other racers. The one you need to beat is yourself." - Bunta Fujiwara
Offline
I see that you are having a good time conkying with v2.0, but here I come with a quick question (in the old one)
How can I draw a block of text in lua? Lets assume there is a text file with many lines of stuff and I want to draw it on the screen, line by line. How?Is this the way?
local file = io.popen("cat /here/is/the/habababa.txt") for line in file:lines() do s,f,used=string.find(line,"%a*(.*)\n") -- this is the stuff I dont quite undestand... end file:close()
Or there is other way?
Thanks in advance !
thats almost it
if it is a text file then you can simply use
local file=io.open("/path/to/file.txt")
this is my first thought how to do it
linetab={}
local file=io.open("/path/to/file.txt")
for line in file:lines() do
table.insert(linetab,line)
end
file:close()
linegap=15
xposition=20
yposition=20
font="mono"
fontsize="12"
cairo_set_source_rgba(cr,1,1,1,1)
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fontsize)
for i=1,#linetab do
cairo_move_to(cr,xposition,yposition+((i-1)*linegap))
cairo_show_text(cr,linetab[i])
cairo_stroke (cr)
end
this part
s,f,used=string.find(line,"%a*(.*)\n") -- this is the stuff I dont quite undestand...
is if you want to get a particular piece of information out of the line instead of the whole line
Last edited by mrpeachy (2012-11-01 01:08:41)
Offline
re conky2 - so far it sounds like conky2 isn't the total overhaul of conky that was expected
particularly if lua isn't any more integrated into the conkyrc than it was before
Last edited by mrpeachy (2012-11-01 01:26:01)
Offline
Ok,now I understand.
But Im curious if its the string itself that cant store multiple lines,or the cairo drawing that doesnt know how to handle text blocks?
(BTW, Im sending this from a SonyEricson j10i2 via Opera Mini. Its pure awesomnes that this little baby can keep me online practically 24/7 everywhere.
F U smartphones! )
"Remember, don't pay attention to the competition itself. Ignore other racers. The one you need to beat is yourself." - Bunta Fujiwara
Offline
Offline
What exactly do I do when I Want to add something to conky? In tint2 I just select all and paste the new tint2 config.
This is the one I want
http://dobbie03.deviantart.com/art/My-F … -327206399
Offline
Download the file from devianart
Unpack it with the archiver tool to a new folder
Copy the .conkyrc file to ~/.conkyrc
Copy the font (BankGthd) to ~/.fonts/ (create the folder if not existing)
Log out and back, to be sure.
Sweaty lads picking up the soap | I love the new "Ignore user" button
Offline
Wait. Confused. what exactly is ''Copy the .conkyrc file to ~/.conkyrc''
So.. I open up conkyrc and then I right click > select all > paste the code from the conkyrc in that file I donwloaded?
Offline
^If you already have conky you will have a .conkyrc in your home folder.
~/ = home folder.
Rename or delete the .conkyrc in your home folder.
Paste the dowloaded .conkyrc into your home folder.
From a terminal;
killall conky
conky
Offline
@dk75
i tried installing the deb but got some missing dependancy issues, will try and track them down and see if i can get it running
Could you try this DEB (amd64, Debian Sid/unstable) and see if you have problem with dependencies?
Debian Sid (Minted) x86_64/3.12-10, Conky 2.0_pre, Xorg 7.7/1.15.0, KDE 4.11.5, Intel X3100
Lenovo T61, HITACHI HTS722010K9SA00 100GB, WDC_WD5000BEVT 500GB
Linux user No.: 483055 | Conky Pitstop
Offline
it is the limitation of cairo text, you have to specify an x,y coordinate for every instance of text to show
this is what i get if i dont break up the lines first
http://s10.postimage.org/xw4vmxnwl/Screenshot_at_2012_10_31_20_49_51.jpg
Is that with regard to conky v2? Or something to do with cairo in a LUA script?
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
It's limitation of Cairo internal text routine, which is called as "toy text api" by Cairo developers.
If only Conky developers could add LUA Cairo Pango to Conky... then whoa... londonali1010 tried to convince them for that... 3 years ago, already?
Another whoa.
Debian Sid (Minted) x86_64/3.12-10, Conky 2.0_pre, Xorg 7.7/1.15.0, KDE 4.11.5, Intel X3100
Lenovo T61, HITACHI HTS722010K9SA00 100GB, WDC_WD5000BEVT 500GB
Linux user No.: 483055 | Conky Pitstop
Offline
I run 11 conkys daily - 13 if I use johnraff's bonus find:
#!/bin/bash
# click to start, click to stop
if pidof conky | grep [0-9] > /dev/null
then
exec killall conky
else
# on all desktops
conky -c /media/5/Conky/S11_email.conky &
conky -c /media/5/Conky/S11_v9_R.conky &
#conky -c /media/5/Conky/S11_jraff_1.conky & -- sets and empty space on the
#conky -c /media/5/Conky/S11_jraff_2.conky & -- program title bar.
# on desktop 2 only
(sleep 1s && wmctrl -s 1 && conky -c /media/5/Conky/S11_Dates.conky) &
(sleep 1s && wmctrl -s 1 && conky -c /media/5/Conky/S11_v9_SM.conky) &
(sleep 1s && wmctrl -s 1 && conky -c /media/5/Conky/S11_VNS.conky) &
(sleep 1s && wmctrl -s 1 && conky -c /media/5/Conky/S11_mrp_FSYS.conky) &
(sleep 1s && wmctrl -s 1 && conky -c /media/5/Conky/S11_Rem_Cal.conky) &
(sleep 1s && wmctrl -s 1 && conky -c /media/5/Conky/S11_v9_H.conky) &
(sleep 1s && wmctrl -s 1 && conky -c /media/5/Conky/S11_Disk_Activity.conky) &
# on desktop 1 only
(sleep 5s && wmctrl -s 0 && conky -c /media/5/Conky/S11_Chronograph.conky) &
(sleep 5s && wmctrl -s 0 && conky -c /media/5/Conky/S11_coin.conky) &
(sleep 5s && wmctrl -s 0 && conky -c /media/5/Conky/VO_Radiotray.conky) &
exit
fi
None of them work with Conky v2:
01 Nov 12 | 14:21:41 ~
$ conky -c /media/5/Conky/S11_email.conky &
[1] 21701
01 Nov 12 | 14:22:05 ~
$ conky: Syntax error (/media/5/Conky/S11_email.conky:2: unexpected symbol near '#') while reading config file.
conky: Assuming it's in old syntax and attempting conversion.
conky: [string "..."]:150: [string "converted config"]:125: unexpected symbol near '}'
[1]+ Exit 1 conky -c /media/5/Conky/S11_email.conky
01 Nov 12 | 14:22:25 ~
$ conky -c /media/5/Conky/S11_v9_R.conky &
[1] 21718
01 Nov 12 | 14:22:42 ~
$ conky: Syntax error (/media/5/Conky/S11_v9_R.conky:2: unexpected symbol near '#') while reading config file.
conky: Assuming it's in old syntax and attempting conversion.
conky: [string "..."]:150: [string "converted config"]:123: unexpected symbol near '}'
[1]+ Exit 1 conky -c /media/5/Conky/S11_v9_R.conky
01 Nov 12 | 14:22:58 ~
$ conky -c /media/5/Conky/S11_Dates.conky
conky: Syntax error (/media/5/Conky/S11_Dates.conky:2: unexpected symbol near '#') while reading config file.
conky: Assuming it's in old syntax and attempting conversion.
conky: [string "..."]:150: [string "converted config"]:114: unexpected symbol near '}'
01 Nov 12 | 14:23:10 ~
$ conky -c /media/5/Conky/S11_v9_SM.conky
conky: Syntax error (/media/5/Conky/S11_v9_SM.conky:2: unexpected symbol near '#') while reading config file.
conky: Assuming it's in old syntax and attempting conversion.
conky: [string "..."]:150: [string "converted config"]:133: unexpected symbol near '}'
01 Nov 12 | 14:23:50 ~
$ conky -c /media/5/Conky/S11_Rem_Cal.conky
conky: Syntax error (/media/5/Conky/S11_Rem_Cal.conky:2: unexpected symbol near '#') while reading config file.
conky: Assuming it's in old syntax and attempting conversion.
conky: [string "..."]:150: [string "converted config"]:123: unexpected symbol near '}'
01 Nov 12 | 14:24:15 ~
$ conky -c /media/5/Conky/S11_v9_H.conky
conky: Syntax error (/media/5/Conky/S11_v9_H.conky:2: unexpected symbol near '#') while reading config file.
conky: Assuming it's in old syntax and attempting conversion.
conky: [string "..."]:150: [string "converted config"]:134: unexpected symbol near '}'
01 Nov 12 | 14:24:34 ~
$ conky -c /media/5/Conky/S11_Disk_Activity.conky
conky: Syntax error (/media/5/Conky/S11_Disk_Activity.conky:2: unexpected symbol near '#') while reading config file.
conky: Assuming it's in old syntax and attempting conversion.
conky: [string "..."]:150: [string "converted config"]:121: unexpected symbol near '}'
01 Nov 12 | 14:24:56 ~
$ conky -c /media/5/Conky/S11_Chronograph.conky
conky: Syntax error (/media/5/Conky/S11_Chronograph.conky:2: unexpected symbol near '#') while reading config file.
conky: Assuming it's in old syntax and attempting conversion.
conky: [string "..."]:150: [string "converted config"]:131: unexpected symbol near '}'
01 Nov 12 | 14:25:17 ~
$ conky -c /media/5/Conky/S11_coin.conky
conky: Syntax error (/media/5/Conky/S11_coin.conky:2: unexpected symbol near '#') while reading config file.
conky: Assuming it's in old syntax and attempting conversion.
conky: [string "..."]:150: [string "converted config"]:126: unexpected symbol near '}'
01 Nov 12 | 14:25:33 ~
$ conky -c /media/5/Conky/VO_Radiotray.conky
conky: Syntax error (/media/5/Conky/VO_Radiotray.conky:2: unexpected symbol near '#') while reading config file.
conky: Assuming it's in old syntax and attempting conversion.
conky: [string "..."]:150: [string "converted config"]:123: unexpected symbol near '}'
01 Nov 12 | 14:25:51 ~
$
And since I have over 500 conkys here, I test commands, scripts and OPC's (Conkys; not cigarettes) is it really worth converting them all, or the 11/13 I use, to the format for Conky v2 ?
What advantage does this Conky v2 have over Conky v1.9.0-2 ?
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
It's limitation of Cairo internal text routine, which is called as "toy text api" by Cairo developers.
If only Conky developers could add LUA Cairo Pango to Conky... then whoa... londonali1010 tried to convince them for that... 3 years ago, already?
Another whoa.
Yea, I remember that. But I don't know enough about LUA to know the difference.
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Looking for an Opinion!
I run 11 conkys daily - 13 if I use johnraff's bonus find:
[cut](..)[/cut]
None of them work with Conky v2:
01 Nov 12 | 14:21:41 ~ $ conky -c /media/5/Conky/S11_email.conky & [1] 21701 01 Nov 12 | 14:22:05 ~ $ conky: Syntax error (/media/5/Conky/S11_email.conky:2: unexpected symbol near '#') while reading config file. conky: Assuming it's in old syntax and attempting conversion. conky: [string "..."]:150: [string "converted config"]:125: unexpected symbol near '}' [1]+ Exit 1 conky -c /media/5/Conky/S11_email.conky
And since I have over 500 conkys here, I test commands, scripts and OPC's (Conkys; not cigarettes) is it really worth converting them all, or the 11/13 I use, to the format for Conky v2 ?
What advantage does this Conky v2 have over Conky v1.9.0-2 ?
http://t.imgbox.com/adqKbzg1.jpg
There is a conkyrc converter for Conky2 - /usr/local/share/doc/conky-2.0.0_pre/convert.lua ; which is doing the job on the fly, but you can do it manually if you want, and correct resulting file if errors occur.
As for question "is it really worth converting"... so far, Conky2 isn't even listed as alpha/beta on Conky site so it might be long time or not at all when it hit release stadium, worth of use by normal user.
So, hard to tell.
Maybe, if more users will use it, developers will start to work on it harder, maybe adding more plug-ins (Pango, please!) to Cairo would be easier in Conky2... dunno.
Debian Sid (Minted) x86_64/3.12-10, Conky 2.0_pre, Xorg 7.7/1.15.0, KDE 4.11.5, Intel X3100
Lenovo T61, HITACHI HTS722010K9SA00 100GB, WDC_WD5000BEVT 500GB
Linux user No.: 483055 | Conky Pitstop
Offline
Sector11 wrote:Looking for an Opinion!
There is a conkyrc converter for Conky2 - /usr/local/share/doc/conky-2.0.0_pre/convert.lua ; which is doing the job on the fly, but you can do it manually if you want, and correct resulting file if errors occur.
As for question "is it really worth converting"... so far, Conky2 isn't even listed as alpha/beta on Conky site so it might be long time or not at all when it hit release stadium, worth of use by normal user.
So, hard to tell.
Maybe, if more users will use it, developers will start to work on it harder, maybe adding more plug-ins (Pango, please!) to Cairo would be easier in Conky2... dunno.
OK. So this is a preview of 'what might become' - something to play with.
Guess it boils down to personal choice at the moment though. Since 'convert.lua' isn't converting any of my daily conkys I'd have to say it will be an enormous job to do them manually.
I'll play with it though, I have the deb here and going back and forth between the two versions isn't all that hard.
Thanks dk75.
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
So I have decided that I would make up a little conky tutorial file that has some of my best scripts to save space.
I started making them when I ran into a laptop that had a short screen, that even my smallest conky at the time ran off.
So to make sure that I could keep the conky on the screen I started making things compress when not active.
Alright so here is the body of my conky tutorial, I do have a real conky that works and everything, this came out of.
If you would like it please let me know and I will do my best to get it to you.
People with netbooks will probably benifit from this the most, as well as anyone that likes the minimal look but still wants all the information.
Oh, please ignore the line ## this only works when it is in the original file.
----------------------------------------
Swap Information
----------------------------------------
this is just a simple method to compress the
swap information when it is not active
${if_match "0">"${swap}"}Swap usage:$alignr$swap / $swapmax
${swapbar 5,160}${alignr}${swapperc}%${else}Swap:${alignr}Not in Use${endif}
----------------------------------------
Ethernet (best if at the bottom of conky)
----------------------------------------
line 87 and 93 work together, they control
the whole sections size. if there is no
gateway in your network then there will be
no network section. instead you will see a
"Cable Unplugged"
line 89 and 90 are one thing, these are your
down speed and down speed graph. they will
only show up if your down speed rises to
1.0 or higher.
line 91 and 92 are one thing, these are your
up speed and up speed graph. they will
only show up if your up speed rises to
1.0 or higher.
${if_gw}Ethernet: eth0
IP:$alignr${addr}
${if_match "0">"${downspeedf eth0}"}Down Speed:${alignr}${downspeedf eth0}KB/s
${alignc}${downspeedgraph eth0 20,180 656667 ffffff}${else}${endif}
${if_match "0">"${upspeedf eth0}"}Up Speed:${alignr}${upspeedf eth0}KB/s
${alignc}${upspeedgraph eth0 20,180 656667 ffffff}${else}${endif}
${else}Ethernet: eth0${alignr}Cable Unplugged${endif}
----------------------------------------
Wireless Network (best if at the bottom of conky)
----------------------------------------
line 112 and 122 work together, they control
the whole sections size. if there is no
signal strength to the network you are
connected to this section will change to a
"not connected"
line 118 and 119 are one thing, these are your
down speed and down speed graph. they will
only show up if your down speed rises to
1.0 or higher.
line 120 and 121 are one thing, these are your
up speed and up speed graph. they will
only show up if your up speed rises to
1.0 or higher.
${if_match "0">"${wireless_link_qual wlan0}"}Wireless: wlan0
SSID:$alignr${wireless_essid wlan0}
Signal:$alignr${wireless_link_qual wlan0}/${wireless_link_qual_max wlan0} | ${wireless_link_qual_perc wlan0}%
${wireless_link_bar wlan0}
IP:$alignr${addr wlan0}
Type:$alignr${wireless_mode wlan0}
${if_match "0">"${downspeedf wlan0}"}Down Speed:$alignr${downspeedf wlan0}KB/s
${alignc}${downspeedgraph wlan0 20,180 656667 ffffff}${else}${endif}
${if_match "0">"${upspeedf wlan0}"}Up Speed:$alignr${upspeedf wlan0}KB/s
${alignc}${upspeedgraph wlan0 20,180 656667 ffffff}${else}${endif}
${else}Wireless: wlan0${alignr}Not Connectd${endif}
----------------------------------------
File System
----------------------------------------
now for this section i have 2 different
scripts. the first one i will be showing is
for removable media or atleast that is what
i use it for. the second script i will be
showing is for other internal hard drives.
i will be showing a example of the script
configured for a windows partition.
script 1: removable media
this will stay as DriveName: Disconnected,
till the media is connected and mounted.
other useful code i have added to this
is, the warning script (simple used percent
monitor via if_match). the warning script
will activate when the drive reads as 75%
or more full, then the used percent will
change from green to red and flashing to
catch your eye
(please see note / script section for more
information)
${if_existing /media/DriveName}DriveName:$alignr${fs_used /media/DriveName} / ${fs_size /media/DriveName}
${fs_bar 5,130 /media/DriveName}${if_match "74"<"${fs_used_perc /media/DriveName}"}${color red}${alignr}${blink ${fs_used_perc /media/DriveName}}%${color}${else}${alignr}${color green}${fs_used_perc /media/DriveName}%${color}${endif} : ${fs_free_perc /media/DriveName}%${else}DriveName:${alignr}Disconnected${endif}
script 2: internal hard drives
as i said this one will be configured for a
windows partion (windows 7 is what i set mine
up on). so things that are needed for this to
work. 1: a folder in your media folder called
"windows" (easy way "sudo mkdir /media/windows").
2: your windows partition mounted to this folder
(easy way sudo mount /dev/"partition" /media/windows)
3: this script does have a depend file (change as needed)
"/media/windows/pagefile.sys". the pagefile.sys
is a file that i believe every windows system
has, that is why i used it.
until the partition is mounted, it reads
"windows-partition: unmounted". once the
partition is mounted it will expand showing you
your drives information. i have also add the
warning script to this, so that you can track your
windows system the same as the removable media
script
Windows-partition:${if_existing /media/windows/pagefile.sys}$alignr${fs_used /media/windows} / ${fs_size /media/windows}
${fs_bar 5,130 /media/windows}${if_match "50"<"${fs_used_perc /media/windows}"}${color red}${alignr}${blink ${fs_used_perc /media/windows}}%${color}${else}${alignr}${color green}${fs_used_perc /media/windows}%${color}${endif} : ${fs_free_perc /media/windows}%${else}${alignr}Not Mounted${endif}
----------------------------------------
Note / Script sections
----------------------------------------
warning script all by it's self
this will be a little tutorial on how the
warning script works. this script works via
the if_match statement, this one's argument
is stated as:
"74"<"${fs_used_perc /media/DriveName}"
this simply means that if the dirve used percent
hits 75 or higher is should do what is listed
first. so the first choice is used percent
red and blinking, if used percent is below 75
it will choose the second choice marked by
"${else}", in this case used percent green.
this is all finished up with "${endif}" so that
the if_match statment knows we are done
${if_match "74"<"${fs_used_perc /media/DriveName}"}${color red}${alignr}${blink ${fs_used_perc /media/DriveName}}%${color}${else}${alignr}${color green}${fs_used_perc /media/DriveName}%${color}${endif}
Warning lights
now i did not add this into the above section
because it doesn't save space unless you want
to use it instead of the more traditional ways
or you don't care to know the exact information
also i have ran into some odd behavior from it
please see warning below for more information
on the issues that it has some times.
so there are 4 warning lights here: ram, swap,
system partition, and home partition.
each light has 3 settings they are written
backwards in the code but they are:
normal: is green text
level 1 warning: is orange text
level 2 warning: is red text that flashes
normal: 0-49%
level 1: 50-89%
level 2: 90-100%
these vaules are easy to change all you have to
do is replace the "89" or "49" with any number
you would like inside quotes, like "".
other things that are easy to change would be
the colors and the final green texts is not
really needed but it is nice to have a place
holder so that you know how much room your
lights will take up. i have my lights in their
own conky all side by side. as the lights side
by side would not fit so well in this small
conky and so that it will make it easier to
to take only the ones you want, i will be
seperating them. the order is the same as i
stated before:
ram
swap
system partition
home partition
also the system partition makes for a good base
when making lights for other partitions as it
only has a "/" for the path
Warning:
please also note some times the lights have
problems they may change levels for a moment,
for no visible reasons or they may sit at the
wrong level. my ram light likes to sit at
level 2 warning when it doesn't need to, this
is a simple fix, just flip the < to > and it
should be fine. the switching for no reason i
do not know how to fix, so i can not help you on
that. i have had no problems with the partition
warning lights so i would tentatively call them
stable, but the ram and swap are a different story.
${if_match "89"<"${memperc}"}${color red}${blink RAM WARNING}${color}${else}${if_match "49"<"${memperc}"}${color orange}RAM WARNING${color}${else}${color green}RAM WARNING${color}${endif}${endif}
${if_match "89"<"${swapperc}"}${color red}${blink SWAP WARNING}${color}${else}${if_match "49"<"${swapperc}"}${color orange}SWAP WARNING${color}${else}${color green}SWAP WARNING${color}${endif}${endif}
${if_match "89"<"${fs_used_perc /}"}${color red}${blink System WARNING}${color}${else}${if_match "49"<"${fs_used_perc /}"}${color orange}System WARNING${color}${else}${color green}System WARNING${color}${endif}${endif}
${if_match "89"<"${fs_used_perc /home}"}${color red}${blink Home WARNING}${color}${else}${if_match "49"<"${fs_used_perc /home}"}${color orange}Home WARNING${color}${else}${color green}Home WARNING${color}${endif}${endif}
Last edited by ansem_of_nexus (2012-11-01 23:14:23)
Offline
mrpeachy wrote:@dk75
i tried installing the deb but got some missing dependancy issues, will try and track them down and see if i can get it runningCould you try this DEB (amd64, Debian Sid/unstable) and see if you have problem with dependencies?
Thanks dk75... tried it, got this
Error: Dependency is not satisfiable:
libmicrohttpd10
i should probably mention that i am using linux mint 12
Offline
I don't think I have ever shown this so here goes ...
<<-- S11_Chronograph_Full.conky
# killall conky && conky -c /media/5/Conky/S11_Chronograph_Full.conky &
#
# Thank you:
# Chronograph LUA - mrpeachy (originally 4 clocks - tweaked by Sector11)
# v9000 LUA weather - mrpeachy
# background - londonali1010, mrpeachy, dk75
# filesystem code by dk75
### 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
# 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 340 760 ##420 420 ## width, height
maximum_width 340 ##420 ## width, usually a good idea to equal minimum width
gap_x 10 #15 ### 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
# 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
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 ###########################################################
## 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.3
#
# TEXT
##
#
################### Chronograph ##############################################
lua_load /media/5/Conky/LUA/Chronograph.lua
#lua_load /media/5/Conky/LUA/chrono.lua
#lua_load /media/5/Conky/LUA/clock_rings_mrp.lua
lua_draw_hook_pre main
################### Weather ##################################################
lua_load ~/v9000/v9000.lua
lua_draw_hook_post weather
lua_load /media/5/Conky/LUA/crono_full.template.lua
####################################################### End LUA Settings ###
# The all important - How often conky refreshes.
# If you have a "Crey" try: 0.2 - smokin' - but watch the CPU useage go UP!
update_interval 1
TEXT
${lua conky_draw_bg 15 0 0 0 0 0x000000 0.6} CPU ${platform f71882fg.2560 temp 1}°${alignr 10}MB ${platform f71882fg.2560 temp 2}°
1: ${if_match ${cpu cpu1} < 10}00${cpu cpu1}\
${else}${if_match ${cpu cpu1} < 100}0${cpu cpu1}\
${else}${cpu cpu1}\
${endif}${endif}%\
${alignr 10}2: ${if_match ${cpu cpu2} < 10}00${cpu cpu2}\
${else}${if_match ${cpu cpu2} < 100}0${cpu cpu2}\
${else}${cpu cpu2}\
${endif}${endif}%
FAN:${alignr 10}${platform f71882fg.2560 fan 1}
${voffset -7} 3: ${if_match ${cpu cpu3} < 10}00${cpu cpu3}\
${else}${if_match ${cpu cpu3} < 100}0${cpu cpu3}\
${else}${cpu cpu3}\
${endif}${endif}%\
${alignr 5}A: ${if_match ${cpu cpu0} < 10}00${cpu cpu0}\
${else}${if_match ${cpu cpu0} < 100}0${cpu cpu0}\
${else}${cpu cpu0}\
${endif}${endif}%
SDA ${execi 15 hddtemp -n /dev/sda}°${alignr 5}GPU ${nvidia temp}°
Today's Forecast ${color8}${cpubar cpu0 1,140}${color}
${color8}${hr 2}${color}
${alignc} ${color7}1${color8} CAD = ARS ${color7}${execi 1800 wget --timeout=1.0 --tries=1 -O - http://themoneyconverter.com/rss-feed/CAD/rss.xml | grep "Argentine Peso" | cut -c 40-47} \
${color7}1${color8} ARS = CAD ${color7}${execi 1800 wget --timeout=1.0 --tries=1 -O - http://themoneyconverter.com/rss-feed/ARS/rss.xml | grep "Canadian Dollar" | cut -c 39-45} ${color}
${hr}
${color6}Fsys${goto 50}${color8}Size${goto 95}${color7}Free${goto 145}${color1}Used${goto 190}${color1}%${goto 235}${color}Mount Pt.
${color6}${execp df -H |gawk '/rootfs/ {gsub(/\/.*\//,"",$6); print "Root${goto 50}${color8}"$2"${goto 95}${color7}"$4"${goto 145}${color1}"$3"${goto 190}${color1}"$5"${goto 235}${color}"$6}'}
${color6}${execp df -H |gawk '/home/ {gsub(/\/.*\//,"",$1); print $1"${goto 50}${color8}"$2"${goto 95}${color7}"$4"${goto 145}${color1}"$3"${goto 190}${color1}"$5"${goto 235}${color}"$6}'}
${color6}${execp df -H |gawk '/sda5/ {gsub(/\/.*\//,"",$1); print $1"${goto 50}${color8}"$2"${goto 95}${color7}"$4"${goto 145}${color1}"$3"${goto 190}${color1}"$5"${goto 235}${color}"$6}'}
${color6}${execp df -H |gawk '/sda8/ {gsub(/\/.*\//,"",$1); print $1"${goto 50}${color8}"$2"${goto 95}${color7}"$4"${goto 145}${color1}"$3"${goto 190}${color1}"$5"${goto 235}${color}"$6}'}${if_existing /dev/sdb1}
${color6}${execp df -H |gawk '/sdb1/ {gsub(/\/.*\//,"",$1); print $1"${goto 50}${color8}"$2"${goto 95}${color7}"$4"${goto 145}${color1}"$3"${goto 190}${color1}"$5"${goto 235}${color}"$6}'}${else}${endif}${if_existing /dev/sdc1}
${color6}${execp df -H |gawk '/sdc1/ {gsub(/\/.*\//,"",$1); print $1"${goto 50}${color8}"$2"${goto 95}${color7}"$4"${goto 145}${color1}"$3"${goto 190}${color1}"$5"${goto 235}${color}"$6}'}${else}${endif}${if_existing /dev/sdd1}
${color6}${execp df -H |gawk '/sdd1/ {gsub(/\/.*\//,"",$1); print $1"${goto 50}${color8}"$2"${goto 95}${color7}"$4"${goto 145}${color1}"$3"${goto 190}${color1}"$5"${goto 235}${color}"$6}'}${else}${endif}${color}
Chronograph.lua
--[[ 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
use in conkyrc
lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT
-- INDEX (use find with):
-- ###### 12 OR 24 CLOCK FACE
-- SET BORDER OPTIONS ###### ALL CLOCKS
-- ### START CLOCK A ######################################
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
-- CLOCK A HOUR HAND
-- CLOCK A MINUTE HAND SETUP
-- CLOCK A SECOND HAND SETUP
-- CLOCK A ###### 24 HR TIME
-- ### START DIAL B ### Top - Week Day Names Dial #########
-- ### START DIAL C ### Right - Month Names Dial ##########
-- ### START DIAL D ### Left - Day Numbers Dial ###########
-- ### START CLOCK E ######################################
-- MARKS AROUND CLOCK E -- Bottom - 12 HR Clock
-- CLOCK E HOUR HAND
-- CLOCK E MINUTE HAND SETUP
-- CLOCK E SECOND HAND SETUP
-- CLOCK E ###### 12 HR TIME
NOTE: Putting ### CLOCK A ### last insures that it's functions are written
over the other dials.
]]
--[[
[quote=mrpeachy]^if you look at the chronograph lua you will have the centers of all the dials set as variables\
then drawing circles in lua is easy
set up a the color then
[code]
cairo_arc(cr,middle_x,middle_y,radius,0,2*math.pi)
cairo_fill(cr)
[/code]
but it is important to draw the circle BEFORE you draw the hands, dots and titles, otherwise it will cover them up[/quote]
21 Oct 12: Saw this this morning just before going out for the day. Got a full schedule coming up but have this in a comment block in the script to look at as soon as I get a moment.
]]
require 'cairo'
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)
-- ########################################################
-- SETTINGS AREA
-- local cpu=conky_parse("${cpu}")
-- local red-1=conky_parse("${image /media/5/Conky/images/red_1.png -p 0,0 -s 35x35}")
-- ###### 12 OR 24 CLOCK FACE #############################
local clock_type_A=24 -- Large Main 24 HR Clock
local clock_type_E=12 -- Bottom - 12 HR Clock
-- ###### CLOCK SETTINGS ##################################
-- 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=1
-- ########################################################
-- ### START DIAL B ### Top - Week Day Names Dial #########
-- DIAL POSITION FOR TEXT
local center_x=175
local center_y=95
local radius=50
-- FONT
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 10)
cairo_set_source_rgba (cr,194/255,204/255,255/255,1) -- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
--text_days={"SUN","MON","TUE","WED","THR","FRI","SAT",}
text_days={"Dom","Lun","Mar","Mie","Jue","Vie","Sab",}
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
local extents=cairo_text_extents_t:create()
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=35
for i=1,7 do
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
-- DRAW HAND -- snaps to current day of week
local hand_length=30
local day_number=tonumber(os.date("%w"))
local point=(math.pi/180)*((360/7)*(day_number))
local x=0+hand_length*(math.sin(point))
local y=0-hand_length*(math.cos(point))
local hand_width=2
cairo_move_to (cr,center_x,center_y)
cairo_line_to (cr,center_x+x,center_y+y)
cairo_stroke (cr)
-- ### END DIAL B #########################################
-- ########################################################
-- ### START DIAL C ### Right - Month Names Dial ##########
-- DIAL POSITION FOR TEXT
local center_x=260
local center_y=175
local radius=45
-- FONT
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 10)
cairo_set_source_rgba (cr,194/255,204/255,255/255,1) -- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
--text_days={"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC",}
text_days={"Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic",}
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
local extents=cairo_text_extents_t:create()
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=32
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_stroke (cr)
end
-- DRAW HAND -- snaps to current month
local this_month=tonumber(os.date("%m"))
local hand_length=28 --radius for this calculation
local point=(math.pi/180)*((360/12)*(this_month-1))
local x=0+hand_length*(math.sin(point))
local y=0-hand_length*(math.cos(point))
cairo_move_to (cr,center_x,center_y)
cairo_line_to (cr,center_x+x,center_y+y)
cairo_stroke (cr)
-- ### END CLOCK C ########################################
-- ########################################################
-- ### START DIAL D ### Left - 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});
febdaynum=tonumber((os.difftime(t1,t2))/(24*60*60))
-- MONTH TABLE
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
local center_x=95
local center_y=175
local radius=50
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 8)
cairo_set_source_rgba (cr,194/255,204/255,255/255,1) -- (cr,1,1,1,1)
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
local text=i
local extents=cairo_text_extents_t:create()
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=40
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))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
-- DRAW HAND -- snaps to current DAY
local this_day=tonumber(os.date("%d"))
local hand_length=35--radius for this calculation
local point=(math.pi/180)*((360/number_days)*(this_day-1))
local x=0+hand_length*(math.sin(point))
local y=0-hand_length*(math.cos(point))
cairo_move_to (cr,center_x,center_y)
cairo_line_to (cr,center_x+x,center_y+y)
cairo_stroke (cr)
-- ### END CLOCK D ########################################
-- ########################################################
-- ### START CLOCK E ######################################
-- MARKS AROUND CLOCK E -- Bottom - 12 HR Clock
local number_marks_E=12
-- set mark length
local m_length_E=0
-- set mark width
local m_width_E=0
-- 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,0,1-- opaque white
-- SETUP HOUR HANDS #######################################
-- CLOCK E HOUR HAND
-- set length of hour hand
hh_length_E=25
-- set hour hand width
hh_width_E=2
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
hhr,hhg,hhb,hha=1,1,0,1-- fully opaque white
-- SETUP MINUTE HANDS #####################################
-- CLOCK E MINUTE HAND SETUP
-- set length of minute hand
mh_length_E=35
-- set minute hand width
mh_width_E=2
-- set minute hand line cap
mh_cap=CAIRO_LINE_CAP_ROUND
-- set minute hand color
mhr,mhg,mhb,mha=1,1,0,1-- fully opaque white
-- SETUP SECOND HANDS #####################################
-- CLOCK E SECOND HAND SETUP
-- set length of seconds hand
sh_length_E=32
-- set hour hand width
sh_width_E=1
-- 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
-- CLOCK E ###### 12 HR TIME ##############################
-- CLOCK SETTINGS
clock_radius=45
clock_centerx=175
clock_centery=260
-- DRAWING CODE
-- DRAW BORDER
cairo_set_source_rgba (cr,cbr,cbg,cbb,cba)
cairo_set_line_width (cr,clock_border_width)
cairo_arc (cr,clock_centerx,clock_centery,clock_radius,0,2*math.pi)
cairo_stroke (cr)
-- 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_E
-- set line cap type
cairo_set_line_cap (cr, m_cap)
-- set line width
cairo_set_line_width (cr,m_width_E)
-- set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
-- START LOOP FOR SECOND MARKS
for i=1,number_marks_E 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_E))
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_E))
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
-- TIME CALCULATIONS CLOCK E
if clock_type_E==12 then
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
elseif clock_type_E==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 and draw it
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*clock_type_E))-- use equation ~ eliminate decimals
-- set radius to calculate hand points
radius=hh_length_E
-- 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)*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_E)
cairo_set_source_rgba (cr,hhr,hhg,hhb,hha)
cairo_set_line_cap (cr, hh_cap)
cairo_stroke (cr)
-- DRAW MINUTE HAND
-- get minutes and seconds 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_E
-- 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_E)
cairo_set_source_rgba (cr,mhr,mhg,mhb,mha)
cairo_set_line_cap (cr, mh_cap)
cairo_stroke (cr)
-- DRAW SECOND HAND
-- calculate degrees for each second
sec_degs=seconds*6
-- set radius to calculate hand points
radius=sh_length_E
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of seconds hand
point=(math.pi/180)*sec_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
cairo_set_line_width (cr,sh_width_E)
cairo_set_source_rgba (cr,shr,shg,shb,sha)
cairo_set_line_cap (cr, sh_cap)
cairo_stroke (cr)
-- POSITION FOR TEXT HOUR NUMBERS
local center_x=175
local center_y=260
local radius=45
-- FONT
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 10)
cairo_set_source_rgba (cr,7/255,142/255,187/255,1) -- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
--text_days={"12","01","02","03","04","05","06","07","08","09","10","11",}
-- FOR A 12 HOUR CLOCK WITH THE NUMBERS 13-00
text_days={"00","13","14","15","16","17","18","19","20","21","22","23",}
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
local extents=cairo_text_extents_t:create()
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=32
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_stroke (cr)
end
-- ### END CLOCK E ########################################
-- ########################################################
-- ### START CLOCK A ######################################
-- SET MARKS ##############################################
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
local number_marks_A=24
-- set mark length
local m_length_A=0
-- set mark width
local m_width_A=0
-- 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,1-- opaque white
-- SETUP HOUR HANDS #######################################
-- CLOCK A HOUR HAND
-- set length of hour hand
hh_length_A=130
-- set hour hand width
hh_width_A=3
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
hhr,hhg,hhb,hha=1,1,1,1-- fully opaque white
-- SETUP MINUTE HANDS #####################################
-- CLOCK A MINUTE HAND SETUP
-- set length of minute hand
mh_length_A=145
-- 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,1-- fully opaque white
-- SETUP SECOND HANDS #####################################
-- CLOCK A SECOND HAND SETUP
-- set length of seconds hand
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
-- CLOCK A ###### 24 HR TIME ##############################
-- CLOCK SETTINGS
clock_radius=200
clock_centerx=175
clock_centery=175
-- DRAWING CODE
-- DRAW BORDER
cairo_set_source_rgba (cr,cbr,cbg,cbb,cba)
cairo_set_line_width (cr,clock_border_width)
cairo_arc (cr,clock_centerx,clock_centery,clock_radius,0,2*math.pi)
cairo_stroke (cr)
-- 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
-- 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,hhr,hhg,hhb,hha)
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,mhr,mhg,mhb,mha)
cairo_set_line_cap (cr, mh_cap)
cairo_stroke (cr)
-- DRAW SECOND HAND
--[[
-- calculate degrees for each second
sec_degs=seconds*6
-- set radius to calculate hand points
radius=sh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of seconds hand
point=(math.pi/180)*sec_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
cairo_set_line_width (cr,sh_width_A)
cairo_set_source_rgba (cr,shr,shg,shb,sha)
cairo_set_line_cap (cr, sh_cap)
cairo_stroke (cr)
]]
-- ####################################################################
-- part of a second hand
--position
local center_x=175
local center_y=175
--get seconds value
local seconds=tonumber(os.date("%S"))
--calculate rotation of second hand in degrees
local arc=(math.pi/180)*((360/60)*seconds)
--calculate point 1
local radius1=149
local x1=0+radius1*math.sin(arc)
local y1=0-radius1*math.cos(arc)
--calculate point 2
local radius2=151
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)
cairo_stroke (cr)
-- ####################################################################
-- POSITION FOR TEXT HOUR NUMBERS
local center_x=175
local center_y=175
local radius=160
-- FONT
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 10)
cairo_set_source_rgba (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
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
local extents=cairo_text_extents_t:create()
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=150
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_stroke (cr)
end
-- ### END CLOCK A ########################################
-- ########################################################
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function
You'll need mrpeachy's v9000 LUA script for this and this: crono_full.template.lua
--[[
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="CorporateMonoExtraBold"--font must be in quotes
default_font_size=12
default_color=0xffffff--white
default_alpha=1--fully opaque
default_image_width=50
default_image_height=50
--END OF DEFAULTS #######################################################
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE
-- Today
datadx=110
datadxx=150 --datadx+(datadxx*1)
datay=395
datayy=15 --datay+(datayy*1)
-- forecast
datafx1=20
datafx2=42
datafxx=60 -- datafx1+(datafxx*1)
imgx=35
imgy=520
imgyy=60 -- imgy+(imgyy*1)
-- Forecast day 1 - What is forecasted for TODAY
-- out({c=0xFAFAEC,a=1,x=datafx1,y=datay-24,txt=forecast_day_short[1]})
-- out({c=0xFAFAEC,a=1,x=datafx2,y=datay-24,txt=forecast_date[1]})
out({c=0xFF8C00,a=1,x=datafx2*3,y=datay-24,txt=high_temp[1]})
image({x=147,y=355,w=25,h=25,file=weather_icon[1]})
out({c=0x00BFFF,a=1,x=datafxx*3,y=datay-24,txt=low_temp[1]})
-- ---------------------------------------------------
image({x=20,y=380,w=80,h=80,file=now["weather_icon"]})
out({c=0xFAFAEC,a=1,x=datadx,y=datay,txt="Temp:"})
out({c=0x9ACD32,a=1,x=datadxx,y=datay,txt=now["temp"].."°"})
out({c=0xFAFAEC,a=1,x=datadx*2+14,y=datay,txt="DP:"})
out({c=0x48D1CC,a=1,x=datadxx+datadx,y=datay,txt=now["dew_point"].."°"})
out({c=0xFAFAEC,a=1,x=datadx+14,y=datay+(datayy*1),txt="FL:"})
out({c=0x00BFFF,a=1,x=datadxx,y=datay+(datayy*1),txt=now["feels_like"].."°"})
out({c=0xFAFAEC,a=1,x=datadx*2+14,y=datay+(datayy*1),txt="UV:"})
out({c=0x48D1CC,a=1,x=datadxx+datadx,y=datay+(datayy*1),txt=uv_index_num[1]})
out({c=0x48D1CC,a=1,x=datadxx+130,y=datay+(datayy*1),txt=uv_index_txt[1]})
out({c=0xFAFAEC,a=1,x=datadx,y=datay+(datayy*2),txt=" Bar:"})
out({c=0x48D1CC,a=1,x=datadxx,y=datay+(datayy*2),txt=now["pressure_mb"]})
out({c=0xFAFAEC,a=1,x=datadx*2.07,y=datay+(datayy*2),txt="Hum:"})
out({c=0x48D1CC,a=1,x=datadxx+datadx,y=datay+(datayy*2),txt=now["humidity"].."%"})
-- Sun & Moon Rise & Set
out({c=0xFAFAEC,a=1,x=datadx,y=datay+(datayy*3),txt=" SR: "..sun_rise_24[1]})
out({c=0xFAFAEC,a=1,x=datadx*2.14,y=datay+(datayy*3),txt="SS:"})
out({c=0x48D1CC,a=1,x=datadxx+datadx,y=datay+(datayy*3),txt=sun_set_24[1]})
out({c=0xFAFAEC,a=1,x=datadx,y=datay+(datayy*4),txt=" MR: "..moon_rise_24[1]})
out({c=0xFAFAEC,a=1,x=datadx*2.14,y=datay+(datayy*4),txt="MS:"})
out({c=0x48D1CC,a=1,x=datadxx+datadx,y=datay+(datayy*4),txt=moon_set_24[1]})
-- Wind
out({c=0xFAFAEC,a=1,x=datafx1,y=datay+(datayy*5),txt="Wind:"})
out({c=0x48D1CC,a=1,x=55,y=datay+(datayy*5),txt=now["wind_km"]})
out({c=0x48D1CC,a=1,x=122,y=datay+(datayy*5),txt=now["wind_nesw"]})
out({c=0xFAFAEC,a=1,x=150,y=datay+(datayy*5),txt="@"})
out({c=0x48D1CC,a=1,x=163,y=datay+(datayy*5),txt=now["wind_deg"]})
-- ceiling
out({c=0xFAFAEC,a=1,x=datadx*2,y=datay+(datayy*5),txt="Ceil:"})
out({c=0x48D1CC,a=1,x=datadxx+datadx,y=datay+(datayy*5),txt=now["ceiling"]})
-- Chance of Rain
out({c=0xFAFAEC,a=1,x=datadx+40,y=datay+(datayy*6),txt="Chance of Rain:"})
out({c=0x48D1CC,a=1,x=datadxx+datadx,y=datay+(datayy*6),txt=precipitation[1].."%"})
-- cloud cover
out({c=0xFAFAEC,a=1,x=datafx1,y=datay+(datayy*6),txt="Cloud Cover:"})
out({c=0x48D1CC,a=1,x=110,y=datay+(datayy*6),txt=cloud_cover[1].."%"})
-- moon phase
out({c=0xFAFAEC,a=1,x=datafx1,y=datay+(datayy*7),txt="Moon Phase:"})
out({c=0x48D1CC,a=1,x=100,y=datay+(datayy*7),txt=moon_phase[1]})
-- FORECAST
-- Forecast day 2 SUN
out({c=0x9ACD32,a=1,x=datafx1*1.8,y=datay+(datayy*8),txt=forecast_day_short[2]})
out({c=0x9ACD32,a=1,x=datafx1*3.2,y=datay+(datayy*8),txt=forecast_date[2]})
image({x=imgx,y=imgy,file=weather_icon[2]})
out({c=0xFF8C00,a=1,x=datafx1,y=datay+(datayy*9.5),txt=high_temp[2]})
out({c=0x00BFFF,a=1,x=datafx1,y=datay+(datayy*11),txt=low_temp[2]})
-- Forecast day 3 MON
out({c=0x9ACD32,a=1,x=datafx1*7.5,y=datay+(datayy*8),txt=forecast_day_short[3]})
out({c=0x9ACD32,a=1,x=datafx1*8.9,y=datay+(datayy*8),txt=forecast_date[3]})
image({x=imgx*4.35,y=imgy,file=weather_icon[3]})
out({c=0xFF8C00,a=1,x=datafx1*6.7,y=datay+(datayy*9.5),txt=high_temp[3]})
out({c=0x00BFFF,a=1,x=datafx1*6.7,y=datay+(datayy*11),txt=low_temp[3]})
-- Forecast day 4 TUE
out({c=0x9ACD32,a=1,x=datafx1*13.2,y=datay+(datayy*8),txt=forecast_day_short[4]})
out({c=0x9ACD32,a=1,x=datafx1*14.6,y=datay+(datayy*8),txt=forecast_date[4]})
image({x=imgx*7.55,y=imgy,file=weather_icon[4]})
out({c=0xFF8C00,a=1,x=datafx1*12.4,y=datay+(datayy*9.5),txt=high_temp[4]})
out({c=0x00BFFF,a=1,x=datafx1*12.4,y=datay+(datayy*11),txt=low_temp[4]})
-- Forecast day 5 WED
out({c=0x9ACD32,a=1,x=datafx1*1.8,y=datay+(datayy*13),txt=forecast_day_short[5]})
out({c=0x9ACD32,a=1,x=datafx1*3.2,y=datay+(datayy*13),txt=forecast_date[5]})
image({x=imgx,y=imgy+(imgyy*1.2),file=weather_icon[5]})
out({c=0xFF8C00,a=1,x=datafx1,y=datay+(datayy*14.5),txt=high_temp[5]})
out({c=0x00BFFF,a=1,x=datafx1,y=datay+(datayy*16),txt=low_temp[5]})
-- Forecast day 6 THU
out({c=0x9ACD32,a=1,x=datafx1*7.5,y=datay+(datayy*13),txt=forecast_day_short[6]})
out({c=0x9ACD32,a=1,x=datafx1*8.9,y=datay+(datayy*13),txt=forecast_date[6]})
image({x=imgx*4.35,y=imgy+(imgyy*1.2),file=weather_icon[6]})
out({c=0xFF8C00,a=1,x=datafx1*6.7,y=datay+(datayy*14.5),txt=high_temp[6]})
out({c=0x00BFFF,a=1,x=datafx1*6.7,y=datay+(datayy*16),txt=low_temp[6]})
-- Forecast day 7 FRI
out({c=0x9ACD32,a=1,x=datafx1*13.2,y=datay+(datayy*13),txt=forecast_day_short[7]})
out({c=0x9ACD32,a=1,x=datafx1*14.6,y=datay+(datayy*13),txt=forecast_date[7]})
image({x=imgx*7.55,y=imgy+(imgyy*1.2),file=weather_icon[7]})
out({c=0xFF8C00,a=1,x=datafx1*12.4,y=datay+(datayy*14.5),txt=high_temp[7]})
out({c=0x00BFFF,a=1,x=datafx1*12.4,y=datay+(datayy*16),txt=low_temp[7]})
-- Forecast day 8 SAT
out({c=0x9ACD32,a=1,x=datafx1*1.8,y=datay+(datayy*18),txt=forecast_day_short[8]})
out({c=0x9ACD32,a=1,x=datafx1*3.2,y=datay+(datayy*18),txt=forecast_date[8]})
image({x=imgx,y=imgy+(imgyy*2.5),file=weather_icon[8]})
out({c=0xFF8C00,a=1,x=datafx1,y=datay+(datayy*19.5),txt=high_temp[8]})
out({c=0x00BFFF,a=1,x=datafx1,y=datay+(datayy*21),txt=low_temp[8]})
-- Forecast day 9 SUN
out({c=0x9ACD32,a=1,x=datafx1*7.5,y=datay+(datayy*18),txt=forecast_day_short[9]})
out({c=0x9ACD32,a=1,x=datafx1*8.9,y=datay+(datayy*18),txt=forecast_date[9]})
image({x=imgx*4.35,y=imgy+(imgyy*2.5),file=weather_icon[9]})
out({c=0xFF8C00,a=1,x=datafx1*6.7,y=datay+(datayy*19.5),txt=high_temp[9]})
out({c=0x00BFFF,a=1,x=datafx1*6.7,y=datay+(datayy*21),txt=low_temp[9]})
-- Forecast day 10 MON
out({c=0x9ACD32,a=1,x=datafx1*13.2,y=datay+(datayy*18),txt=forecast_day_short[10]})
out({c=0x9ACD32,a=1,x=datafx1*14.6,y=datay+(datayy*18),txt=forecast_date[10]})
image({x=imgx*7.55,y=imgy+(imgyy*2.5),file=weather_icon[10]})
out({c=0xFF8C00,a=1,x=datafx1*12.4,y=datay+(datayy*19.5),txt=high_temp[10]})
out({c=0x00BFFF,a=1,x=datafx1*12.4,y=datay+(datayy*21),txt=low_temp[10]})
--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################
And optional, I'm using it: draw-bg.lua - this version has a LUA calendar in it as well (not in use here.)
--[[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!)
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#######################################################
That's it.
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Error: Dependency is not satisfiable: libmicrohttpd10
i should probably mention that i am using linux mint 12
This might help if you don't run into dependency problems, check the list of dependencies:
http://packages.debian.org/testing/libs/libmicrohttpd10
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
thanks sector11
but to be honest i cant see any particular reason to switch to conky2 at the moment
i think i'll wait until it is officially released
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat