You are not logged in.
i want to make a countdown similar like the built in countdown within conky-forecast. i do not want to install conkyForecast for only one feature!
xxx hours xxx minutes daylight or
xxx hours xxx minutes till sunset or
xxx hours xxx minutes till sunrisei've tried doing it within lua. i've started with this:
can u help me please?
this is my actual screenshot: http://i.imgbox.com/acdibt5j.png
regards, alex
The most accurate way to do a countdown timer is to convert the time of the event you are counting down to and the current time into seconds since an arbitrary time in the past.
Most programing languages use seconds since Epoch as this arbitrary time.
Then you subtract the current time from the event time to get the number of seconds until the event.
You then convert the seconds until the event back into hours and minutes for display in conky.
You can get the current time in seconds since epoch and convert a date and time to seconds since epoch by using the os.time() function in Lua.
I don't have any examples of the Lua for that on hand right now but I could make one if you need it.
Last edited by arclance (2012-12-19 00:00:00)
Offline
Hi All !
The Last ConkyForecast:
fired
Sorry...I will may be fired... ]:D
Good one. 8o
Back on topic - not many changes, if any - need to get on the lua clock bandwagon
"It does not require many words to speak the truth." - Chief Joseph, Nez Perce tribe
Offline
ragamatrix wrote:Hi All !
The Last ConkyForecast:
fired
Sorry...I will may be fired... ]:DGood one. 8o
Back on topic - not many changes, if any - need to get on the lua clock bandwagon
![]()
Hey PackRat...
How about a nice little clock to go with your conky on the top left?
I think it would look nice with that conky, just an opinion.
Not my work, I only modified it!
conky
# author : SLK
# version : v2011011601
# license : Distributed under the terms of GNU GPL version 2 or later
#
#=== Modified by: Sector11 09 Oct 12 ===========================================
# killall conky && conky -c /media/5/.conky/conky5/clock_conky &
### Begin Window Settings ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager
#own_window_colour black
own_window_class Conky
own_window_title Clock
### 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 override
own_window_argb_visual yes
### When ARGB visuals are enabled, this use this to modify the alpha value
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
#own_window_argb_value 200
# 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
minimum_size 156 156 ## width, height
maximum_width 156 ## width
gap_x 5 # left-right
gap_y 5 # up-down
alignment top_left
################################################### End Window Settings ###
### Font Settings #########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont WenQuanYi Micro Hei Mono:size=8
# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 0
# Force UTF8? requires XFT ###
override_utf8_locale yes
draw_shades no
default_shade_color black
draw_outline no # amplifies text if yes
default_outline_color black
uppercase no
###################################################### End Font Settings ###
### Color Settings #########################################################
default_shade_color grey
default_outline_color black
default_color DCDCDC #220 220 220 Gainsboro
color0 8FBC8F #143 188 143 DarkSeaGreen
color1 778899 #119 136 153 LightSlateGray
color2 FF8C00 #255 140 0 DarkOrange
color3 7FFF00 #127 255 0 Chartreuse
color4 FFA07A #255 160 122 LightSalmon
color5 FFDEAD #255 222 173 NavajoWhite
color6 00BFFF # 0 191 255 DeepSkyBlue
color7 00FFFF # 0 255 255 Cyan
color8 FFFF00 #255 255 0 Yellow
color9 B22222 #178 34 34 FireBrick
##################################################### End Color Settings ###
### Borders Section ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 0
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders no #yes
default_graph_size 15 40
##################################################### End Borders Secton ###
### Miscellaneous Section ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background no
# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none
# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 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
############################################## End Miscellaneous Section ###
### LUA Settings ###########################################################
## Above and After TEXT - requires a composite manager or blinks.
##
# lua_load ~/Conky/LUA/draw-bg.lua
#TEXT
#${lua conky_draw_bg 10 0 0 0 0 0x000000 0.6}
#
## ${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
##
## OR Both above TEXT (No composite manager required - no blinking!)
#
lua_load ~/Conky/LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.3
#
lua_load /media/5/.conky/conky5/clock_conky.lua
lua_draw_hook_pre main
#
####################################################### End LUA Settings ###
# The all important - How often conky refreshes.
# If you have a "Crey" try: 0.2 - smokin' - but watch the CPU useage go UP!
update_interval 1
TEXT
${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}\
${voffset 55}${goto 75}${color7}${font White Rabbit:size=22}${time %e}${color1}${goto 45}${font WenQuanYi Micro Hei Mono:size=10}${time %a}
${goto 55}${color2}${font WenQuanYi Micro Hei Mono:size=9}${time %b}${color3} ${font WenQuanYi Micro Hei Mono:size=12}${time %y}${font}
clock_conky.lua
--==============================================================================
-- Modifired from: conky_orange.lua
-- author : SLK
-- version : v2011011601
-- license : Distributed under the terms of GNU GPL version 2 or later
--
-- Sector11: 09 Oct 12 - clock_conky.lua
--==============================================================================
require 'cairo'
--------------------------------------------------------------------------------
-- clock DATA
-- HOURS
clock_h = {
{
name='time', arg='%H', max_value=12,
x=78, y=80,
graph_radius=53,
graph_thickness=3,
graph_unit_angle=30, graph_unit_thickness=30,
graph_bg_colour=0xffffff, graph_bg_alpha=0.0,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
txt_radius=34,
txt_weight=1, txt_size=10.0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.6,
graduation_radius=53,
graduation_thickness=6, graduation_mark_thickness=2,
graduation_unit_angle=30,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
},
}
-- MINUTES
clock_m = {
{
name='time', arg='%M', max_value=60,
x=78, y=80,
graph_radius=57,
graph_thickness=2,
graph_unit_angle=6, graph_unit_thickness=6,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
txt_radius=70,
txt_weight=0, txt_size=9.0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.6,
graduation_radius=57,
graduation_thickness=0, graduation_mark_thickness=2,
graduation_unit_angle=30,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
},
}
-- SECONDS
clock_s = {
{
name='time', arg='%S', max_value=60,
x=78, y=80,
graph_radius=50,
graph_thickness=2,
graph_unit_angle=6, graph_unit_thickness=2,
graph_bg_colour=0xffffff, graph_bg_alpha=0.0,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.2,
txt_radius=40,
txt_weight=0, txt_size=12.0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.3,
graduation_radius=0,
graduation_thickness=0, graduation_mark_thickness=0,
graduation_unit_angle=0,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0,
},
}
--------------------------------------------------------------------------------
-- rgb_to_r_g_b
-- converts color in hexa to decimal
--
function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
-------------------------------------------------------------------------------
-- angle_to_position
-- convert degree to rad and rotate (0 degree is top/north)
--
function angle_to_position(start_angle, current_angle)
local pos = current_angle + start_angle
return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end
-------------------------------------------------------------------------------
-- draw_clock_ring
-- displays clock
--
function draw_clock_ring(display, data, value)
local max_value = data['max_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
-- background ring
cairo_arc(display, x, y, graph_radius, 0, 2 * math.pi)
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
-- arc of value
local val = (value % max_value)
local i = 1
while i <= val do
cairo_arc(display, x, y, graph_radius,( ((graph_unit_angle * i) - graph_unit_thickness)*(2*math.pi/360) )-(math.pi/2),((graph_unit_angle * i) * (2*math.pi/360))-(math.pi/2))
cairo_set_source_rgba(display,rgb_to_r_g_b(graph_fg_colour,graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = (graph_unit_angle * i) - graph_unit_thickness
-- graduations marks
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = 360 / graduation_unit_angle
local i = 1
while i <= nb_graduation do
cairo_set_line_width(display, graduation_thickness)
cairo_arc(display, x, y, graduation_radius, (((graduation_unit_angle * i)-(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2),(((graduation_unit_angle * i)+(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
-- text
local txt_radius = data['txt_radius']
local txt_weight, txt_size = data['txt_weight'], data['txt_size']
local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
local movex = txt_radius * (math.cos((angle * 2 * math.pi / 360)-(math.pi/2)))
local movey = txt_radius * (math.sin((angle * 2 * math.pi / 360)-(math.pi/2)))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight);
cairo_set_font_size (display, txt_size);
cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha));
cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3);
cairo_show_text (display, value);
cairo_stroke (display);
end
-------------------------------------------------------------------------------
-- go_clock_rings
-- loads data and displays clock
--
function go_clock_rings(display)
local function load_clock_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_clock_ring(display, data, value)
end
for i in pairs(clock_h) do
load_clock_rings(display, clock_h[i])
end
for i in pairs(clock_m) do
load_clock_rings(display, clock_m[i])
end
for i in pairs(clock_s) do
load_clock_rings(display, clock_s[i])
end
end
-------------------------------------------------------------------------------
-- MAIN
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)
local display = cairo_create(cs)
--[[ local updates = conky_parse('${updates}')
update_num = tonumber(updates)
if update_num<=5 then end]]
go_clock_rings(display)
--go_gauge_rings(display)
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
lionhead wrote:i want to make a countdown similar like the built in countdown within conky-forecast. i do not want to install conkyForecast for only one feature!
xxx hours xxx minutes daylight or
xxx hours xxx minutes till sunset or
xxx hours xxx minutes till sunrisei've tried doing it within lua. i've started with this:
can u help me please?
this is my actual screenshot: http://i.imgbox.com/acdibt5j.png
regards, alex
The most accurate way to do a countdown timer is to convert the time of the event you are counting down to and the current time into seconds since an arbitrary time in the past.
Most programing languages use seconds since Epoch as this arbitrary time.Then you subtract the current time from the event time to get the number of seconds until the event.
You then convert the seconds until the event back into hours and minutes for display in conky.You can get the current time in seconds since epoch and convert a date and time to seconds since epoch by using the os.time() function in Lua.
I don't have any examples of the Lua for that on hand right now but I could make one if you need it.
Here you have:
#!/usr/bin/env lua
time_event=os.time({year=2012, month=12, day=21, hour=11, min=11, sec=0}) --Mayan "End of the World"
time_current=os.time() --current time
tcount=time_event-time_current
tcY=tonumber(os.date("%Y", tcount))-1970
tcM=tonumber(os.date("%m", tcount))-1
tcD=tonumber(os.date("%d", tcount))-1
tch=tonumber(os.date("%H", tcount))
tcm=tonumber(os.date("%M", tcount))
tcs=tonumber(os.date("%S", tcount))
dateS=string.format("Years: %4i ", tcY)
dateS=string.format("%sMonths: %2i ", dateS, tcM)
dateS=string.format("%sDays: %2i ", dateS, tcD)
dateS=string.format("%sHours: %2i ", dateS, tch)
dateS=string.format("%sMinutes: %2i ", dateS, tcm)
dateS=string.format("%sSeconds: %2i ", dateS, tcs)
print(dateS)
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
Hi ! Thanks for this beautiful and simple clock.
I'm trying to make a conky DeadBeef to display music and covers in conky. At the moment there are text infos artists displayed in lua with a bar progression lua too.I'd like to have something wich look like this one : musicsphere
But I'm using a bash script to get and "spherised the covers" I would use the ring lua of progression around the cover but I don't know how make it work...
I'm here at the moment:
sphremusic
Little Help ?
Offline
Hey all - Very very new to conky so I do apologise in advance if I make stupid mistakes.
I found this conky script to show a stack of photos on the desktop (http://fav.me/d2iz14r)
But when I run it in terminal I am getting
"Conky: invalid configuration file 'home/ca/.conky/conkySlideshow'"
Below is a copy of what's in conkySlideshow - Is there anything you can notice that would be causing it not to work?
# -- Conky settings -- #
background no
update_interval 15
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
double_buffer yes
no_buffers yes
text_buffer_size 2048
imlib_cache_size 0
# -- Window specifications -- #
own_window yes
own_window_type desktop
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
minimum_size 800 800
alignment tr
gap_x 0
gap_y 0
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color FFFFFF
#For pictures on hard drive folder :
# -- Lua Load -- #
lua_load ~/scripts/photo_album_stack.lua
lua_draw_hook_pre photo_album
#For random pictures generated by an external script (i.e get_deiation;sh)
# -- Lua Load -- #
#lua_load ~/scripts/photo_album_stack.lua
#lua_draw_hook_pre photo_album /tmp/img-deviant
TEXT
${exec ~/scripts/get_deviation.sh /tmp/img-deviant}
Offline
What do you think :
To use the circle writing script lua from Mr Peachy and display time artist and album infos around the cover-sphere-artist ?
The answer is that I'm crazy ...
Offline
Hey all - Very very new to conky so I do apologise in advance if I make stupid mistakes.
I found this conky script to show a stack of photos on the desktop (http://fav.me/d2iz14r)
But when I run it in terminal I am getting
"Conky: invalid configuration file 'home/ca/.conky/conkySlideshow'"Below is a copy of what's in conkySlideshow - Is there anything you can notice that would be causing it not to work?
'home/ca/.conky/conkySlideshow' is not a valid path since it does not start with a / so you are passing a bad value to the "-c" option when you start conky.
You likely want to start it with this command.
conky -c /home/ca/.conky/conkySlideshow
Offline
'home/ca/.conky/conkySlideshow' is not a valid path since it does not start with a / so you are passing a bad value to the "-c" option when you start conky.
You likely want to start it with this command.conky -c /home/ca/.conky/conkySlideshow
Ah many thanks! Damn I feel stupid What's worse is I had two versions of conkyStart, one in my home folder and one in home/bin - Every time I was running what I thought was the corrected file it kept displaying the previous error... But thanks
It's giving me different errors now but at least it's a start, I'll give it shot at sorting it out myself before asking for help again.
This community rocks!
UPDATE: Got it all working now, thanks arclance!
Last edited by Thoralder (2012-12-19 13:53:45)
Offline
Hi ! Thanks for this beautiful and simple clock.
I'm trying to make a conky DeadBeef to display music and covers in conky. At the moment there are text infos artists displayed in lua with a bar progression lua too.I'd like to have something wich look like this one : musicsphere
But I'm using a bash script to get and "spherised the covers" I would use the ring lua of progression around the cover but I don't know how make it work...
I'm here at the moment:
sphremusic
Little Help ?
It's going better and better...
conkyDeadBeef_circle_rings
Offline
lionhead wrote:i want to make a countdown similar like the built in countdown within conky-forecast. i do not want to install conkyForecast for only one feature!
Here you have:
#!/usr/bin/env lua time_event=os.time({year=2012, month=12, day=21, hour=11, min=11, sec=0}) --Mayan "End of the World" time_current=os.time() --current time tcount=time_event-time_current tcY=tonumber(os.date("%Y", tcount))-1970 tcM=tonumber(os.date("%m", tcount))-1 tcD=tonumber(os.date("%d", tcount))-1 tch=tonumber(os.date("%H", tcount)) tcm=tonumber(os.date("%M", tcount)) tcs=tonumber(os.date("%S", tcount)) dateS=string.format("Years: %4i ", tcY) dateS=string.format("%sMonths: %2i ", dateS, tcM) dateS=string.format("%sDays: %2i ", dateS, tcD) dateS=string.format("%sHours: %2i ", dateS, tch) dateS=string.format("%sMinutes: %2i ", dateS, tcm) dateS=string.format("%sSeconds: %2i ", dateS, tcs) print(dateS)
Ooooooooo I gotta try that
Thanks DK75
Oops! How do I run that in a conky? I'm such a 8o
Last edited by Sector11 (2012-12-19 16:25:53)
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
I don't have any examples of the Lua for that on hand right now but I could make one if you need it.
if u offer this then i should say that i need an example!
Offline
Hi ! Thanks for this beautiful and simple clock.
I'm trying to make a conky DeadBeef to display music and covers in conky. At the moment there are text infos artists displayed in lua with a bar progression lua too.I'd like to have something wich look like this one : musicsphere
But I'm using a bash script to get and "spherised the covers" I would use the ring lua of progression around the cover but I don't know how make it work...
I'm here at the moment:
sphremusic
Little Help ?
There is a certain How To floating around these forums that does the spheres ... and conky and lua and deadbeef and 17 other music apps... That first zynga image is a creation from that How To.
Offline
@VastOne
Hi;
Yes I know, the thing I wanted was to make it work with lua and bash.I only need the deadbeef conky for that.I got an quite old machine and then it's use few ram and cpu.
That's now easier to configurate, because I'm bad in writing line codes...I've seen the how to but I think I did not all undestood.(my technical English)
Thanks for your works, great what you made for us in the how-to
Offline
Hey PackRat...
How about a nice little clock to go with your conky on the top left?
I think it would look nice with that conky, just an opinion.
Why not.
Last edited by PackRat (2012-12-19 18:06:43)
"It does not require many words to speak the truth." - Chief Joseph, Nez Perce tribe
Offline
@sector11 can i get a copy of your current chronograph 24-hour version, the clock is what I am after.
Offline
Ooooooooo I gotta try that
Thanks DK75Oops! How do I run that in a conky?
I'm such a 8o
No, you are slave driver...
countdown.lua
--[[
###############################################################################
count down to date script
© 2012 by dk75
usage:
load it above "TEXT" by:
lua_load path/to/script/countdown.lua
TEXT
use it below "TEXT" by:
TEXT
${lua conky_countdown {t={year=2012, month=12, day=21, hour=11, min=11}, x=50, y=100, color=0xff0000, alpha=1, font="DejaVu Sans", size=24, style="normal", weight="bold", alignH="left", alignV="center"})
where (if not set, default values will be used):
style = [normal(default)|italic|oblique]
weight = [normal(default)|bold]
alignH = [left(default)|center|right] -- horizontal align
alignV = [top|center|bottom(default)] -- vertical align
###############################################################################
--]]
do
require 'cairo'
local extents = cairo_text_extents_t:create() -- initialize text_extents structure (generic, a must be for following functions)
tolua.takeownership(extents)
function rgb2rgba(colour,alpha) -- colour = hex color code, alpha = float [0.0 - 1.0] transparency factor
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
-- returns color used by "cairo_set_rgba()" function
end
function print_text(cr, x, y, _text_, color, alpha, font, font_size, style, weight, alignHorizontal, alignVertical) -- style = [normal(default)|italic|oblique]; weight = [normal(default)|bold]; alignHorizontal = [left(default)|center|right]; alignVertical = [top|center|bottom(default)]
if style == "italic" then style = CAIRO_FONT_SLANT_ITALIC
elseif style == "oblique" then style = CAIRO_FONT_SLANT_OBLIQUE
else style = CAIRO_FONT_SLANT_NORMAL end
if weight == "bold" then weight = CAIRO_FONT_WEIGHT_BOLD
else weight = CAIRO_FONT_WEIGHT_NORMAL end
cairo_save(cr)
cairo_select_font_face(cr, font, style, weight)
cairo_set_font_size(cr, font_size)
cairo_set_source_rgba(cr, rgb2rgba(color, alpha))
cairo_text_extents(cr, _text_, extents)
if alignHorizontal == "center" then alignHorizontal = tonumber(extents.x_advance/2)
elseif alignHorizontal == "right" then alignHorizontal = tonumber(extents.x_advance)
else alignHorizontal = 0 end
if alignVertical == "top" then alignVertical = tonumber(extents.height)
elseif alignVertical == "center" then alignVertical = tonumber(extents.height/2)
else alignVertical = 0 end
--print(extents.x_advance, "x", extents.y_advance, "/", extents.x_bearing, "x", extents.y_bearing)
cairo_move_to(cr, x-alignHorizontal, y+alignVertical)
cairo_show_text(cr, _text_)
cairo_stroke(cr)
cairo_restore(cr)
end
function conky_countdown(ctab)
local updates=tonumber(conky_parse('${updates}'))
if updates<=5 then return "" end
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)
local ctab=loadstring("return "..ctab)()
if type(ctab) ~= "table" then return ""
elseif type(ctab.t) ~= "table" then return "" end
local tcount=os.time(ctab.t)-os.time()
local dateS=string.format("Years: %4i ", tonumber(os.date("%Y", tcount))-1970)
dateS=string.format("%sMonths: %2i ", dateS, tonumber(os.date("%m", tcount))-1)
dateS=string.format("%sDays: %2i ", dateS, tonumber(os.date("%d", tcount))-1)
dateS=string.format("%sHours: %2i ", dateS, tonumber(os.date("%H", tcount)))
dateS=string.format("%sMinutes: %2i ", dateS, tonumber(os.date("%M", tcount)))
dateS=string.format("%sSeconds: %2i ", dateS, tonumber(os.date("%S", tcount)))
print_text(cr, ctab.x, ctab.y, dateS, ctab.color, ctab.alpha, ctab.font, ctab.size, ctab.style, ctab.weight, ctab.alignH, ctab.alignV)
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr, cs = nil
return ""
end
end
conkyrc
# ~/.conkyrc-test47
#-----Conky settings
background no
no_buffers yes
# out_to_console yes
top_cpu_separate no
# cpu_avg_samples 10
# net_avg_samples 10
# max_port_monitor_connections 10
update_interval 1
total_run_times 0
#-----Text setings
use_xft yes
xftfont Bitstream Vera Sans Mono:bold:size=10
xftalpha 0.8
# uppercase no
override_utf8_locale yes
# format_human_readable no
# short_units
# max_user_text 64
# text_buffer_size 1024
#-----Window settings
own_window yes
own_window_type normal
# own_window_argb_visual no
# own_window_argb_value 0
own_window_transparent yes
own_window_colour black
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_class Conky
own_window_title Conky
#----Layout settings
minimum_size 800 100
maximum_width 800
alignment top_left
use_spacer right
gap_x 25
gap_y 50
#-----Graphics settings
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
stippled_borders 0
# border_inner_margin 16
border_width 1
double_buffer yes
# max_specials 64
# imlib_cache_size 0
#-----Color settings
default_color white
default_shade_color black
default_outline_color black
#-----LUA
lua_load $HOME/.conky/lua/countdown.lua
TEXT
${font Avdira:bold:size=20}${alignc}${color ff0000}Mayan "End of the World"${color}${font}
${lua conky_countdown {t={year=2012, month=12, day=21, hour=11, min=11}, x=conky_window.width/2, y=conky_window.height/2, color=0xff0000, alpha=1, font="Avdira", size=20, style="normal", weight="bold", alignH="center", alignV="top"} }
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
arclance wrote:I don't have any examples of the Lua for that on hand right now but I could make one if you need it.
if u offer this then i should say that i need an example!
I have to go to a meeting tonight so I can't do it today but I can do it tomorrow.
dk75 posted a example that you could take a look at if you want to try to work on it yourself until then.
His example did not have the exact output format you wanted but it might be enough to get you started.
Offline
Sector11 wrote:Hey PackRat...
How about a nice little clock to go with your conky on the top left?
I think it would look nice with that conky, just an opinion.Why not.
Simplistic beauty and zen - what a combo!
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
@sector11 can i get a copy of your current chronograph 24-hour version, the clock is what I am after.
Grab it from the source - 24 hour version it's a mrpeachy creation!
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Sector11 wrote:Ooooooooo I gotta try that
Thanks DK75Oops! How do I run that in a conky?
I'm such a 8o
No, you are slave driver...
Hahahaha ... somehow it looks better on your system than on mine.
I had to reduce the font size and increase the width or I didn't see the seconds and missed the "Yea" of years.
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Ok I'm still testing with DeadBeef player; may be not the taste of everyone, It's ...special a bit strange.??
Offline
Offline
Offline
PeachyChrono (thanks for sharing Mr. Peachy):
http://s14.postimage.org/fbert1tj1/2012_12_19_073308_1368x768_scrot.jpg
How can I get a translucent white background(for PeachyChrono)?
Try this. Notation at top of lua as to how and where to use it.
--[[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
]]
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-- end main function#######################################################
Nice wallpaper!
"The nine most terrifying words in the English language are, 'I'm from the government and I'm here to help.'.” ~Ronald Reagan
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