You are not logged in.
Looks great Ekaradon, I think Sector11's howto will work for you --> click here <--
Conky | SMXI HowTo | Super Grub | VastOnes GMB HowTo | VSIDO
Offline
thanks jed.
@Ekardon - post your conkyrc; my first guess is that the:
own_window_type <type>
own_window_hints <hints>
part of your configuration needs some adjusting.
"It does not require many words to speak the truth." - Chief Joseph, Nez Perce tribe
Offline
Looks great Ekaradon, I think Sector11's howto will work for you --> click here <--
@Ekardon - post your conkyrc; my first guess is that the part of your configuration needs some adjusting.
Thanks to both of you, I found the solution with this property:
sticky - means the conky is on every desktop.
You will find my version of Conky which is largely based on Georgy Stoyanov work.
#Author url = http://dobbie03.deviantart.com/art/My-First-Conky-Config-327206399
#Modified by Georgi Stoyanov = http://www.gstoyanov.com
#Modified by Ekaradon
alignment top_middle
background yes
border_margin 5
border_width 5
default_color gray #5f5f5f 413536 # grey 5f5f5f 3F3F3F 183149 3B3B3B 26211F
default_shade_color black
default_outline_color black
double_buffer yes
draw_borders no
draw_outline yes
draw_shades yes
gap_x 0
gap_y 150
minimum_size 1600 175
no_buffers yes
override_utf8_locale yes
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager,sticky
text_buffer_size 8000
total_run_times 0
update_interval 30
uppercase no
stippled_borders 8
use_xft yes
xftalpha 1
xftfont Freesans:pixelsize=9
# fonts
# Blue Highway
# Zegoe Light - U
# Zekton
# Calibri
# Engebrechtre
# Opeln2001
# Pricedown
lua_load ~/.scripts/draw_bg.lua
lua_draw_hook_pre draw_bg
TEXT
${font BankGothic Md BT:pixelsize=20}${alignc}${time [ %A, %H:%M ]}${font}
${font BankGothic Md BT:pixelsize=65}${alignc}${time %d %B, %Y}${font}
${font BankGothic Md BT:pixelsize=12}${alignc}[ Kernel: ${kernel} | Name: ${nodename} | System Uptime: ${uptime_short} ]
${font BankGothic Md BT:pixelsize=12}${alignc}[ Root: ${fs_free /} / ${fs_size /} | Home: ${fs_free /home} / ${fs_size /home} ]
${font BankGothic Md BT:pixelsize=12}${alignc}[ CPU1: ${cpu cpu0}% CPU2: ${cpu cpu1}% | RAM Usage: ${mem} ]
${font BankGothic Md BT:pixelsize=12}${alignc}[ WiFi Network: ${wireless_essid wlan0} | Signal: ${wireless_link_qual_perc wlan0}% ]
${font BankGothic Md BT:pixelsize=12}${alignc}[ Battery: ${battery_percent BAT0}% | Time Left: ${battery_time} ]
The lua script is already well-known on this topic I think, but there it is: http://www.smipple.net/snippet/bluepica … or%20conky
Offline
i want to include the script to draw a background into v9000.lua:
--[[
Background by londonali1010 (2009)
This script draws a background to the Conky window. It covers the whole of the Conky window, but you can specify rounded corners, if you wish.
To call this script in Conky, use (assuming you have saved this script to ~/scripts/):
lua_load ~/scripts/draw_bg.lua
lua_draw_hook_pre
Changelog:
+ v1.0 -- Original release (07.10.2009)
]]
-- Change these settings to affect your background.
-- "corner_r" is the radius, in pixels, of the rounded corners. If you don't want rounded corners, use 0.
--corner_r=20
-- Set the colour and transparency (alpha) of your background.
--bg_colour=0x000000
--bg_alpha=0.5
require 'cairo'
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
--function conky_draw_bg()
function draw_bg(wb)
bg_width=(wb.bgw or conky_window.width)
bg_height=(wb.bgh or conky_window.heigth)
bg_posx=(wb.bgx or 0)
bg_posy=(wb.bgy or 0)
bg_colour=(wb.bgcl or 0x000000)
bg_corner=(wb.bgcr or 20)
bg_alpha=(wb.bga or 0.5)
if conky_window==nil then return end
-- local bg_width=conky_window.width
-- local bg_height=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, bg_width, bg_height)
cr=cairo_create(cs)
cairo_move_to(cr,bg_corner,0)
cairo_line_to(cr,bg_width-bg_corner,0)
cairo_curve_to(cr,bg_width,0,bg_width,0,bg_width,bg_corner)
cairo_line_to(cr,bg_width,bg_height-bg_corner)
cairo_curve_to(cr,bg_width,bg_height,bg_width,bg_height,bg_width-bg_corner,bg_height)
cairo_line_to(cr,bg_corner,bg_height)
cairo_curve_to(cr,0,bg_height,0,bg_height,0,bg_height-bg_corner)
cairo_line_to(cr,0,bg_corner)
cairo_curve_to(cr,0,0,0,0,bg_corner,0)
cairo_close_path(cr)
cairo_set_source_rgba(cr,rgb_to_r_g_b(bg_colour,bg_alpha))
cairo_fill(cr)
end
this is the message when i open the template within the terminal:
Conky: llua_do_call: function conky_weather execution failed: /home/alexander/v9000/template-rss.lua:229: error in function 'cairo_xlib_surface_create'.
argument #5 is 'nil'; 'number' expected.
this is line 229:
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, bg_width, bg_height)
Offline
i want to include the script to draw a background into v9000.lua:
--[[
Background by londonali1010 (2009)
This script draws a background to the Conky window. It covers the whole of the Conky window, but you can specify rounded corners, if you wish.
To call this script in Conky, use (assuming you have saved this script to ~/scripts/):
lua_load ~/scripts/draw_bg.lua
lua_draw_hook_pre
Changelog:
+ v1.0 -- Original release (07.10.2009)
]]
-- Change these settings to affect your background.
-- "corner_r" is the radius, in pixels, of the rounded corners. If you don't want rounded corners, use 0.
--corner_r=20
-- Set the colour and transparency (alpha) of your background.
--bg_colour=0x000000
--bg_alpha=0.5
require 'cairo'
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
--function conky_draw_bg()
function draw_bg(wb)
bg_width=(wb.bgw or conky_window.width)
bg_height=(wb.bgh or conky_window.heigth)
bg_posx=(wb.bgx or 0)
bg_posy=(wb.bgy or 0)
bg_colour=(wb.bgcl or 0x000000)
bg_corner=(wb.bgcr or 20)
bg_alpha=(wb.bga or 0.5)
if conky_window==nil then return end
-- local bg_width=conky_window.width
-- local bg_height=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, bg_width, bg_height)
cr=cairo_create(cs)
cairo_move_to(cr,bg_corner,0)
cairo_line_to(cr,bg_width-bg_corner,0)
cairo_curve_to(cr,bg_width,0,bg_width,0,bg_width,bg_corner)
cairo_line_to(cr,bg_width,bg_height-bg_corner)
cairo_curve_to(cr,bg_width,bg_height,bg_width,bg_height,bg_width-bg_corner,bg_height)
cairo_line_to(cr,bg_corner,bg_height)
cairo_curve_to(cr,0,bg_height,0,bg_height,0,bg_height-bg_corner)
cairo_line_to(cr,0,bg_corner)
cairo_curve_to(cr,0,0,0,0,bg_corner,0)
cairo_close_path(cr)
cairo_set_source_rgba(cr,rgb_to_r_g_b(bg_colour,bg_alpha))
cairo_fill(cr)
end
this is the message when i open the template within the terminal:
Conky: llua_do_call: function conky_weather execution failed: /home/alexander/v9000/template-rss.lua:229: error in function 'cairo_xlib_surface_create'.
argument #5 is 'nil'; 'number' expected.
this is line 229:
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, bg_width, bg_height)
Offline
I haven't learned Lua and I'm not familiar with either Conky or your V9000, but it seems that this value:
bg_height=(wb.bgh or conky_window.heigth)
is null. So You could try to set it manually or search why it's not setted unlike bg_width apparently.
Offline
Sorry - this was solved.
Last edited by Sector11 (2013-01-21 17:15:04)
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
I'd be remiss if I didn't give everyone the full story or at least a fairly good running break down of what this is and how it came about.
We can all thank GrouchyGaijin for this!
I love it when someone says "Nope, not possible" and the answer is "Oh yea, watch this!" type of thing.
This started when GrouchyGaijin asked stinkeye this question regarding the "start stop conky" script (ssc.sh)
Cool idea. Thanks for sharing. I have a question though, does the toggle script allow you to kill the conkies one at a time or is it all or nothing?
stinkeye responded:
Scripts been around a while. Not my idea.
All or nuttin'. Go hard or go home.
A little while later GrouchyGaijin came back with:
For what it is worth, I wrote a script that will find the PID of a particular conky, then kill it.
I'm sure this could be done more efficiently. But this works on my system.
#!/bin/bash ##This is something like the 5th script I've ever written ## var1=$(ps xu | grep calendar-conky | grep -v grep | awk '{ print $2 }') echo "$var1" kill $var1
Change calendar-conky to the name of your conkyrc file.
Then, make a launcher, put it in a quick list or whatever.
arclance piped up:
Why not use?
pkill -f "conky.*-c.*calendar-conky"
That will kill conky process running with the "calendar-conky" .conkyrc.
It should also not kill certain text editors if you have your .conkyrc open in them.
Can you see where this is going?
After a discussion between arclance and stinkeye, about it not working with a conky in a terminal stinkeye has a version that will work with his demo conky in a terminal:
Could't find a solution so I added a sed command to change
background yes
to
background no
in any pasted in configs.#!/bin/bash ## click to start, click to stop if pgrep -f "conky -c /home/glen/conky/configs/demo-conkyrc" then pkill -xf "conky -c /home/glen/conky/configs/demo-conkyrc" else [b]sed -i 's/background yes/background no/g' /home/glen/conky/configs/demo-conkyrc &[/b] gnome-terminal -e "conky -c /home/glen/conky/configs/demo-conkyrc" fi
From GrouchyGaijin's "oh yea, watch this post!" I started playing ... incorporating things as it happened.
All my conkys start with "conky -c /path/to/the/conkyrc", I don't run conkys in a terminal, start them yes, run them no!
I played with this a lot yesterday getting "ERROR" here an "Oops!" there, but not before one tweak restarted my entire session.
Now that was an Oops!
The second last line is the fix it was:
"conky -c $1"
Here's the 'first' working version, - "SUPER" script
that requires two clicks, or twice in a terminal:
ggsia <<-- the bash script for GrouchyGaijin, Stinkeye and arclance
#!/bin/bash
## Original idea by: GrouchyGaijin
## This idea by: Stinkeye - Jan 2013
## With another tweak by: arclance
## Final tweak by: Sector11
## click to start, click to re-start
if pgrep -f "conky -c $1"
then
pkill -xf "conky -c $1"
else
conky -c "$1"
fi
Terminal output
sector11 @ sector11
21 Jan 13 | 09:29:06 ~
$ ggsia /media/5/Conky/S11_VSIDO_v9.conkyrc
18708
sector11 @ sector11
21 Jan 13 | 09:29:48 ~
$ ggsia /media/5/Conky/S11_VSIDO_v9.conkyrc
Conky: forked to background, pid is 19627
sector11 @ sector11
21 Jan 13 | 09:29:50 ~
$
Conky: desktop window (260) is root window
Conky: window type - normal
Conky: drawing to created window (0x1c00001)
Conky: drawing to double buffer
gathering data with curl
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 71036 100 71036 0 0 81086 0 --:--:-- --:--:-- --:--:-- 99k
not checking for alerts
processing complete
sector11 @ sector11
21 Jan 13 | 09:30:06 ~
$
Stopped it and started it like it was meant to do!
but it took one to kill it, one to start it
Thank you GrouchyGaijin, stinkeye & arclance
I didn't stop there ... I have another version of ssc.sh that uses "exit" .... hmmmmmmmmm!!!
So here it is, the new improved ggsia that is even better, this is for "conky addicts", because sometimes just "saving a conky" isn't enough, you need to kill it and restart it!
If you are developing a conky and
[o]have not started it yet, this will start it.
[o]if it is already running, this script will kill it and restart it 2 seconds later
ggsia - Super script #2
#!/bin/bash
## Original idea by: GrouchyGaijin
## This idea by: Stinkeye - Jan 2013
## With another tweak by: arclance
## Final tweak by: Sector11
## click to start, click to stop & re-start
if pgrep -f "conky -c $1"
then
pkill -xf "conky -c $1"
(sleep 2s && conky -c "$1") &
exit
else
conky -c "$1"
exit
fi
Nice stuff guys!
stinkeye points out a weakness of the above with a question:
HA!!!! jedi has compition!
Along comes: CapMan
Hi Sector11,
just a bit confused as to what the $1 variable is
and how to use the script.
Do I just add the path to a conkyrc as a variable to the script?It may appear I know what I'm doing but I'm essentially a copy and paste man.
CapMan
$1 for a bash script is a command line variable.
stinki
#!/bin/bash
echo $1 $2
sector11 @ sector11
21 Jan 13 | 11:52:44 ~
$ stinki something
something
sector11 @ sector11
21 Jan 13 | 11:52:46 ~
$ stinki something else[/color]
something else
sector11 @ sector11
21 Jan 13 | 11:52:50 ~
$ stinki Hi stinkeye
Hi stinkeye
sector11 @ sector11
21 Jan 13 | 11:54:16 ~
$
To continue:
Yea, me too, I gotta use that line, CapMan sounds like a superhero!
Maybe change it to C&PDude so as not to interfere with any © you may have.
The top of 90% of my conkys have something like this:
# killall conky && conky -c /media/5/Conky//S11_all-text.conky &
I copy that line - less the hash - to kill all conkys and restart the one I'm working on. BUT it does what you said a while back:
All or nuttin'. Go hard or go home.
So now at the top of my conkys I'll do:
# ggsia /media/5/Conky//S11_all-text.conky
then I'll pull a CapMan in the terminal
sector11 @ sector11
21 Jan 13 | 11:25:16 ~
$ ggsia /media/5/Conky/S11_VSIDO_v9.conkyrc
Like I said earlier in this post,
[o] if the conky is not running that script will start it,
[o] if it is running, it will kill it, wait 2 seconds and restart it.
Perfect for editing!
Now to do a search and replace on "all files" in my conky directories:
Search: "# killall conky && conky -c"
Replace: "# ggsia"
Hmmmm, that will take a while, I'll probably have to watch a movie.
Thanks GrouchyGaijin ǝʎǝʞuıʇs sʞuɐɥʇ & arclance
Last edited by Sector11 (2013-08-11 23:09:41)
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
it's possible to define the width and the height. but i can not define the horizontal and the vertical position it seems that the script uses the standard-values. can u please help me?
i call the function like this:
draw_bg({bgcl=0xff0000,bgw=200,bgh=100})
this is the complete script:
require 'cairo'
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
--function conky_draw_bg()
function draw_bg(wb)
bg_width=(tonumber(wb.bgw) or tonumber(conky_window.width))
bg_height=(tonumber(wb.bgh) or tonumber(conky_window.height))
bg_posx=(wb.bgx or 0)
bg_posy=(wb.bgy or 0)
bg_colour=(wb.bgcl or 0x000000)
bg_corner=(wb.bgcr or 20)
bg_alpha=(wb.bga or 0.5)
if conky_window==nil then return end
-- local bg_width=conky_window.width
-- local bg_height=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, bg_width, bg_height)
cr=cairo_create(cs)
cairo_move_to(cr,bg_corner,0)
cairo_line_to(cr,bg_width-bg_corner,0)
cairo_curve_to(cr,bg_width,0,bg_width,0,bg_width,bg_corner)
cairo_line_to(cr,bg_width,bg_height-bg_corner)
cairo_curve_to(cr,bg_width,bg_height,bg_width,bg_height,bg_width-bg_corner,bg_height)
cairo_line_to(cr,bg_corner,bg_height)
cairo_curve_to(cr,0,bg_height,0,bg_height,0,bg_height-bg_corner)
cairo_line_to(cr,0,bg_corner)
cairo_curve_to(cr,0,0,0,0,bg_corner,0)
cairo_close_path(cr)
cairo_set_source_rgba(cr,rgb_to_r_g_b(bg_colour,bg_alpha))
cairo_fill(cr)
end
when i call the function within the template (lua) the script draws the background above the text. do u have an idea why this happens?
Offline
@ lionhead:
You are using:
draw_bg({bgcl=0xff0000,bgw=200,bgh=100})
add the x & y positions:
bg_posx=(wb.bgx or 0)
bg_posy=(wb.bgy or 0)
like this:
draw_bg({bgcl=0xff0000,bgx=10,bgy=25,bgw=200,bgh=100})
Also call this function BEFORE you call any text function to get it behind the text.
Last edited by Sector11 (2013-01-21 18:41:24)
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
this should work but it still uses the default-values?! this is not logical, or? this would say spock
draw_bg({bgcl=0x000000,bgx=100,bgw=100,bgh=100,bga=0.5})
although i even call this function after the text it still covers the text
Offline
I am in search on one of this (look at the subject above), which I can configure easily on my desktop. I have stumble upon some links available here in the forums and I ended up not finishing what I have started since I got confused and lost in the way of following some steps which a noob often do, like me I should say.
Okay, this might sound or this really sound like I am on an SOS. Will someone give me a hand regarding this post? Thanks.
Last edited by observingly (2013-01-21 20:23:17)
"You see, but you do not observe." -Sherlock Holmes
Offline
This was the one I found easiest to get going: http://crunchbang.org/forums/viewtopic. … 67#p212567
(I'm not saying it was 'easy' just that it was the easiest!) If you follow the instructions through it's fairly straightforward to get going, if you subsequently want to tidy up the installation then there's a bit of tweaking to do. I am using 1a.
Have a go following the instructions in the readme and let us know where you get stuck.
Offline
this should work but it still uses the default-values?! this is not logical, or? this would say spock
draw_bg({bgcl=0x000000,bgx=100,bgw=100,bgh=100,bga=0.5})
although i even call this function after the text it still covers the text
No call this BEFORE the text function so it gets drawn first.
Where did this script come from? Why not try using the draw-bg.lua that londonali101, mrpeachy and dk75 worked on?
These functions are built in and work.
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
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Statler or Waldorf? If Waldorf, it seems weather-util (it's in the Debian repos) has been fixed to work with the new NOAA website format; a simple execi command in your Conky can give you a very basic weather report and forecast.
Offline
do u mean the allcombined lua-script? i try this in the morning. but i wanna work with v9000.
Offline
do u mean the allcombined lua-script? i try this in the morning. but i wanna work with v9000.
No I meant draw-bg.lua. But if you are writing your own function into what you call "v9000" then I can not help you as I know nothing about LUA, only how to follow instructions to use them.
You should rename your "v9000" to something else because "v9000" is really mrpeachy's weather script.
lh9000 would be good, or D9000 (for Deutsch9000) just a thought.
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
@ lionhead and Sector11
No one should be using that version (v1.0) of the "draw_bg.lua" lua script, it leaks memory.
Last edited by arclance (2013-01-22 00:56:04)
Offline
Statler or Waldorf? If Waldorf, it seems weather-util (it's in the Debian repos) has been fixed to work with the new NOAA website format; a simple execi command in your Conky can give you a very basic weather report and forecast.
weather-util not required, there is a "weather" command built into conky that requires no execi command at all:
code deleted .... it seems that the conky stops running after 10 minutes or so.
Will check out this weather-util and see what happens.
Last edited by Sector11 (2013-01-22 03:26:59)
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
@ lionhead and Sector11
No one should be using that version of the "draw_bg.lua" lua script, it leaks memory.
Where?
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
arclance wrote:@ lionhead and Sector11
No one should be using that version of the "draw_bg.lua" lua script, it leaks memory.Where?
In the version posted by lionhead (the original v1.0) at the end right after "cairo_fill(cr)" because it is missing
cairo_destroy(cr)
cairo_surface_destroy(cs)
which clears the memory allocated by cairo.
This is the memory leak fix that was added by someone several years ago.
I can't find any clean version of it here so I can't say who did it.
Last edited by arclance (2013-01-22 00:53:17)
Offline
Sector11 wrote:arclance wrote:@ lionhead and Sector11
No one should be using that version of the "draw_bg.lua" lua script, it leaks memory.Where?
In the version posted by lionhead (the original v1.0) at the end right after "cairo_fill(cr)" because it is missing
cairo_destroy(cr) cairo_surface_destroy(cs)
which clears the memory allocated by cairo.
This is the memory leak fix that was added by someone several years ago.
I can't find any clean version of it here so I can't say who did it.
Well, in that case I agree with you, londonali1010's original did leak, I thought lionhead had done that code himself as part of his v9000 script. My error for not reading closer, sorry for the mix-up.
I have never used that version but have used the version edited by mrpeachy and dk75 for quite some time - and have included it in many of my posts with conky & lua code.
Here it is again - it has a LUA calendar as well, compliments of mrpeachy, and the two lines to 'plug the leak' you mentioned above and the end of the script:
draw-bg.lua
--[[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 #########################################################
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
is there a way to show CPU temp in C but outside (metar) temp in F? i'm a silly american and i need my precious fahrenheit because of reasons.
Offline
is there a way to show CPU temp in C but outside (metar) temp in F? i'm a silly american and i need my precious fahrenheit because of reasons.
Yes, do you have lm-sensors installed? if yes what is the terminal output of
sensors
sector11 @ sector11
22 Jan 13 | 00:20:08 ~
$ sensors
acpitz-virtual-0
Adapter: Virtual device
temp1: +30.0°C (crit = +110.0°C)
k10temp-pci-00c3
Adapter: PCI adapter
temp1: +35.0°C (high = +70.0°C)
f71862fg-isa-0a00
Adapter: ISA adapter
+3.3V: +3.46 V
in1: +1.35 V
in2: +1.51 V
in3: +0.85 V
in4: +0.00 V
in5: +0.00 V
in6: +0.00 V
3VSB: +3.39 V
Vbat: +2.91 V
fan1: 2423 RPM
fan2: 0 RPM ALARM
fan3: 0 RPM ALARM
temp1: +44.0°C (high = +85.0°C, hyst = +81.0°C)
(crit = +70.0°C, hyst = +66.0°C) sensor = transistor
temp2: +38.0°C (high = +85.0°C, hyst = +81.0°C)
(crit = +100.0°C, hyst = +96.0°C) sensor = thermistor
temp3: +127.0°C (high = +70.0°C, hyst = +68.0°C) ALARM (CRIT)
(crit = +85.0°C, hyst = +83.0°C) sensor = transistor
sector11 @ sector11
22 Jan 13 | 00:20:12 ~
$
Now when you use a "script" to get the weather, you tell the script what unit you want °C or °F
Teo's weather
prpeachy's v9000 lua script
We're here to help.
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Statler or Waldorf? If Waldorf, it seems weather-util (it's in the Debian repos) has been fixed to work with the new NOAA website format; a simple execi command in your Conky can give you a very basic weather report and forecast.
It stopped running after about 10 minutes. ... I'll check out that weather-util and see it that helps.
Thanks
Looks good - I see bash aliases too!
alias sabe='weather SABE'
sector11 @ sector11
22 Jan 13 | 00:37:12 ~
$ weather SABE
Searching via station...
[caching result Aeroparque Bs. As. Aerodrome, Argentina]
Current conditions at Aeroparque Bs. As. Aerodrome, Argentina (SABE) 34-34S 058-25W 6M
Last updated Jan 21, 2013 - 10:00 PM EST / 2013.01.22 0300 UTC
Temperature: 71 F (22 C)
Relative Humidity: 73%
Wind: from the E (090 degrees) at 16 MPH (14 KT)
sector11 @ sector11
22 Jan 13 | 00:37:16 ~
$ weather SAEZ
Searching via station...
[caching result Ezeiza Aerodrome, Argentina]
Current conditions at Ezeiza Aerodrome, Argentina (SAEZ) 34-49S 058-32W 20M
Last updated Jan 21, 2013 - 10:00 PM EST / 2013.01.22 0300 UTC
Temperature: 68 F (20 C)
Relative Humidity: 88%
Wind: from the ESE (110 degrees) at 7 MPH (6 KT)
sector11 @ sector11
22 Jan 13 | 00:38:13 ~
$ weather CYXU
Searching via station...
[caching result London, Ont., Canada]
Current conditions at London, Ont.
Last updated Jan 21, 2013 - 10:00 PM EST / 2013.01.22 0300 UTC
Temperature: 8 F (-13 C)
Relative Humidity: 55%
Wind: from the W (270 degrees) at 14 MPH (12 KT) gusting to 25 MPH (22 KT)
Windchill: -9 F (-23 C)
Sky conditions: mostly clear
sector11 @ sector11
22 Jan 13 | 00:38:35 ~
$
But in the US - YEA!!!!!!!!
sector11 @ sector11
22 Jan 13 | 00:44:46 ~
$ weather -fv fips3755000
RALEIGH-DURHAM INTERNATIONAL AIRPORT, NC, United States (KRDU) 35-54N 078-46W 130M
Jan 21, 2013 - 09:51 PM EST / 2013.01.22 0251 UTC
Wind: from the WNW (290 degrees) at 8 MPH (7 KT) gusting to 18 MPH (16 KT):0
Visibility: 10 mile(s):0
Sky conditions: mostly clear
Temperature: 48.0 F (8.9 C)
Dew Point: 15.1 F (-9.4 C)
Relative Humidity: 26%
Pressure (altimeter): 29.94 in. Hg (1013 hPa)
Pressure tendency: 0.06 inches (1.9 hPa) higher than three hours ago
ob: KRDU 220251Z 29007G16KT 10SM FEW200 09/M09 A2994 RMK AO2 SLP138 T00891094 51019
cycle: 3
***** Zone Forecast *****
Expires:201301220915;;163901
FPUS52 KRAH 220129
ZFPRAH
ZONE FORECAST PRODUCT FOR NORTH CAROLINA
NATIONAL WEATHER SERVICE RALEIGH NC
829 PM EST MON JAN 21 2013
NCZ041-220915-
WAKE-
INCLUDING THE CITIES OF...RALEIGH
829 PM EST MON JAN 21 2013
.REST OF TONIGHT...CLEAR. COLD WITH LOWS IN THE MID 20S.
NORTHWEST WINDS 10 TO 15 MPH WITH GUSTS UP TO 30 MPH.
.TUESDAY...MOSTLY SUNNY. MUCH COOLER WITH HIGHS IN THE UPPER 30S.
NORTHWEST WINDS 10 TO 15 MPH WITH GUSTS UP TO 25 MPH.
.TUESDAY NIGHT...MOSTLY CLEAR. COLD WITH LOWS AROUND 18. NORTH
WINDS 5 TO 10 MPH.
.WEDNESDAY...PARTLY SUNNY. HIGHS AROUND 40. NORTH WINDS AROUND
5 MPH...BECOMING SOUTHWEST AROUND 5 MPH IN THE AFTERNOON.
.WEDNESDAY NIGHT...PARTLY CLOUDY. COLD WITH LOWS IN THE MID 20S.
WEST WINDS AROUND 5 MPH.
.THURSDAY...MOSTLY SUNNY. HIGHS IN THE LOWER 40S.
.THURSDAY NIGHT...PARTLY CLOUDY. COLD WITH LOWS IN THE UPPER 20S.
.FRIDAY...CLOUDY. A CHANCE OF RAIN IN THE AFTERNOON. HIGHS AROUND
50. CHANCE OF RAIN 50 PERCENT.
.FRIDAY NIGHT...CLOUDY IN THE EVENING...THEN BECOMING PARTLY
CLOUDY. A 50 PERCENT CHANCE OF RAIN. COLD WITH LOWS IN THE UPPER
20S.
.SATURDAY THROUGH SUNDAY...CLEAR. HIGHS AROUND 40. LOWS AROUND
20.
.SUNDAY NIGHT...MOSTLY CLEAR. COLD WITH LOWS IN THE UPPER 20S.
.MONDAY...PARTLY SUNNY. NOT AS COOL WITH HIGHS IN THE LOWER 50S.
$$
sector11 @ sector11
22 Jan 13 | 00:44:56 ~
$
Last edited by Sector11 (2013-01-22 03:46:13)
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
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