SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#376 2012-01-29 18:05:07

barrybarrykelly
Member
Registered: 2012-01-25
Posts: 34

Re: The New Monster Conky Thread

mrpeachy wrote:

xwininfo is how to get your "inside conky window" coordinates

Yeah at the minute this seems like the like the best way for getting the window offset, then I can just use the draw coords and sizes to test against, that way it'll always work with pixel accurate coordinates no matter how someone aligns or positions the window

eval $(xwininfo -id $(xdotool search --name music_conky) |
    sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
           -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
           -e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
           -e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" )
  echo "$x $y
mrpeachy wrote:

ive got my mechanism working in lua, just need to think of something to do with it! (but have some other things to finish off first)
worked out how to get things going with a single click rather than double so its more responsive
this way much easier than a previous method of getting clicks i used

I used this line to initialise the xdotool

xdotool search --classname Conky behave %@ mouse-click getmouselocation > ~/.conky/mouseTrap.log exec ~/Code/conky/audacious-applet/mouseCatcher.sh 2>&1 &

That way the script that compares the coordinates gets triggered on the mouse release event every time (completely independent of conky) then all the actions are just carried out by shell commands so even though conky might take a second or two to redraw and update the song has already been paused skipped etc

mrpeachy wrote:

you can try this out

I'll definitely be taking a look at those more in depth soon I've been going over the lua scripts for conky posted around here for the past few days, i'm just not very artistic lol

Offline

Be excellent to each other!

#377 2012-01-29 18:20:01

ackernan
#! Junkie
Registered: 2011-01-10
Posts: 403

Re: The New Monster Conky Thread

joypunk wrote:

New question....

${execi 3600 wget -O - http://whatismyip.org/ | tail}

This is returning (null) for some reason. It was working before but not anymore. Anything wrong with this variable that you can see?

Try something like this...

External IP: ${execi 1800 wget -q -O - checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'}

Offline

#378 2012-01-29 18:21:38

joypunk
Member
Registered: 2012-01-27
Posts: 27

Re: The New Monster Conky Thread

ackernan wrote:

[Try something like this...

External IP: ${execi 1800 wget -q -O - checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'}

Beautiful! Thanks! Works like a charm!

Offline

#379 2012-01-29 18:48:33

ackernan
#! Junkie
Registered: 2011-01-10
Posts: 403

Re: The New Monster Conky Thread

joypunk wrote:
ackernan wrote:

[Try something like this...

External IP: ${execi 1800 wget -q -O - checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'}

Beautiful! Thanks! Works like a charm!

Great!!

Offline

#380 2012-01-29 20:16:21

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,986
Website

Re: The New Monster Conky Thread

falldown wrote:
Sector11 wrote:

And I'm NOT "Sir" just Sector11, Sector, S11 SR71 or whatever but not Sir.

I grabbed it and re-GIMPed the size.  It's OK, really!

lol

Alright.. I will refrain from calling you sir (although it is because I have respect for you)

S11 it is.. big_smile

I have respect for you and your work as well, but we're on a first name, informal, basis here.  Or "whatever suits the fancy" of the writer at the time.  Some really strange nicknames pop up from time to time.

Besides, I'm not a Knight of the Realm, Bobobex, the Queen of #!, probably would have chopped off one of my ears in the process.  big_smile  {did I say that?}

help someone hacked my system and took control of my keyboard ....


To #! or not to #!?  That is the question! | #! Forum Moderator
#! Conky = 16 Threads & the Conky Archives | Conky PitStop | OTHCG'er
StartPage -  protect your privacy   |   LinuxBBQ

Offline

#381 2012-01-29 20:28:07

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,163
Website

Re: The New Monster Conky Thread

The skills and development in this thread is at an incredible level.  It is amazing to see and sometimes hard to keep up with.

Well done everyone!


VSIDO | Words That Build Or Destroy

We do not run from challenges, they become new innovations within VSIDO!

Offline

#382 2012-01-29 20:52:00

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,986
Website

Re: The New Monster Conky Thread

Deegan wrote:

Hi boys, have a problem with this conky ( VLC )

TEXT
${stippled_hr}
${color #FF4D00}$alignc VLC${color} ${hr 2}
${font Lucida Grande:size=7}\\
Artist: ${alignr}${execpi 300 ~/lua/vlc2conky.sh --artist}
Song: ${alignr}${execpi 300 ~/lua/vlc2conky.sh --title}
Album: ${alignr}${execpi 300 ~/lua/vlc2conky.sh --album}
Duration: ${alignr}${execpi 300 ~/lua/vlc2conky.sh --duration}
Genre: ${alignr}${execpi 300 ~/lua/vlc2conky.sh --genre}
    #!/bin/bash
    # I made this script to have vlc metadata in conky
    # Just add "${execpi 300 /path-of-this-script/vlc2conky.sh --artist}" to have the artist metadata
    # If you have more than one vlc instance the script will work with the first listed by "ps -eF"
    # If you change the name of the script don't forget to change the last "grep -v" with the correct name of the script
    # Licence : GPL v3
    # Parts by Dgellow Jons , 1 September 2010 and crimson from the official VLC Forum Jul 24, 2009
    # Created and Modified by Patrick "Suicide" Schadewitz , 20 June 2011    

    t=`ps -eF|grep vlc|grep -v grep|grep -v vlc2conky.sh`

    # Function to extract the metadata
    Extraction()
    {
    mega=`echo "status" | nc.openbsd -U /tmp/vlc.sock -D -q 1 | grep "input" | cut -b 29-700`
    metadata=`exiftool -$metadata -s -s -s "${mega/%.*/.mp3}"`
    if [ "$metadata" ]; then
            echo $metadata
    else
            echo "UNKNOWN"
    fi
    return
    }

    if test $# -ne 1; then
            echo "C'thulu's Avatar says : \"Give me one option if you want my services ! GHUAAAAA ! \""
            exit 0
    fi

    # Test if vlc is running
    if [ "$t" ]
    then
            # Setting the path
            case $1 in
                    "--artist") metadata="Artist"
                                       Extraction;;
                    "--album") metadata="Album"
                                            Extraction;;
                    "--title") metadata="Title"
                                       Extraction;;
                    "--genre") metadata="Genre"
                                       Extraction;;
                    "--duration") metadata="Duration"
                                       Extraction;;
                    "--file") echo ${t##*/};;
                    *) echo "Bad option. --title, --artist or --album"
            esac
    else
            echo "VLC is not running"
    fi


   # does not exist

exit 0
Conky: '.conkyrcVLC' modified, reloading...
Conky: desktop window (16000b5) is subwindow of root window (110)
Conky: window type - override
Conky: drawing to created window (0x4c00001)
Conky: drawing to double buffer
/home/deegan/lua/vlc2conky.sh: 50: Bad substitution
/home/deegan/lua/vlc2conky.sh: 50: Bad substitution
/home/deegan/lua/vlc2conky.sh: 50: Bad substitution
/home/deegan/lua/vlc2conky.sh: 50: Bad substitution
/home/deegan/lua/vlc2conky.sh: 50: Bad substitution

Any bash gurus that can help Deegan?
Knowledge of Italian may will help as well.


To #! or not to #!?  That is the question! | #! Forum Moderator
#! Conky = 16 Threads & the Conky Archives | Conky PitStop | OTHCG'er
StartPage -  protect your privacy   |   LinuxBBQ

Offline

#383 2012-01-29 20:53:29

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,163
Website

Re: The New Monster Conky Thread

^ Not a guru, but I do have it pulled down and testing it to see what is going on, trying to recreate the issue.


VSIDO | Words That Build Or Destroy

We do not run from challenges, they become new innovations within VSIDO!

Offline

#384 2012-01-29 22:14:25

gmonti
#! CrunchBanger
From: Caracas, Venezuela
Registered: 2011-12-07
Posts: 108

Re: The New Monster Conky Thread

@Sector11 I can help with the italian, but where.....????
@Deegan

I'm not an bash expert, but i notice that in the script, you are using nc.openbsd. Which distro are you using? Mine doesn't have that -U option.

At: http://nixdoc.net/man-pages/openbsd/man1/nc.1.html
-U Specifies to use Unix Domain Sockets <<<== What do you want to accomplish??

I'm using Debian, so normal netcat thought.
Another question... where do you use vlc in this script???

EDIT: maybe this pages can help you
http://wiki.videolan.org/How_to_use_VLC … n_in_linux
http://forum.videolan.org/viewtopic.php?f=13&t=41938

or ask the author of the script (Suicide) in this forum: http://crunchbanglinux.org/pastebin/1222

Last edited by gmonti (2012-01-29 22:31:27)


Giuliano Monti Avellino
Debian/Squeeze
Gnome

Offline

#385 2012-01-29 22:39:16

barrybarrykelly
Member
Registered: 2012-01-25
Posts: 34

Re: The New Monster Conky Thread

http://www.wupload.com/file/2655734397/ … applet.zip
I've uploaded my audacious2 conky if anyone wants to play with it, the mouse stuff is commented heavily and easy to read if you're just curious, there's a readme inside it too but let me know how you get on with it. ie if it works for you lol

Offline

#386 2012-01-29 23:37:54

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,986
Website

Re: The New Monster Conky Thread

gmonti wrote:

@Sector11 I can help with the italian, but where.....????
@Deegan

I am no bash scripter and I know Deegan is Italian.  So if there is a language problem with English you could use Italian.  I've known Deegan for years ... a very nice person.

Last edited by Sector11 (2012-01-29 23:38:13)


To #! or not to #!?  That is the question! | #! Forum Moderator
#! Conky = 16 Threads & the Conky Archives | Conky PitStop | OTHCG'er
StartPage -  protect your privacy   |   LinuxBBQ

Offline

#387 2012-01-30 00:03:45

gmonti
#! CrunchBanger
From: Caracas, Venezuela
Registered: 2011-12-07
Posts: 108

Re: The New Monster Conky Thread

Sector11 wrote:
gmonti wrote:

@Sector11 I can help with the italian, but where.....????
@Deegan

I am no bash scripter and I know Deegan is Italian.  So if there is a language problem with English you could use Italian.  I've known Deegan for years ... a very nice person.

Oh It is ok, i would help anyway. Hope what i have posted, could help him.

I remembered that case here: http://crunchbanglinux.org/forums/post/147509/#p147509, so it is why i referred to Suicide post.


Giuliano Monti Avellino
Debian/Squeeze
Gnome

Offline

#388 2012-01-30 00:24:45

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,986
Website

Re: The New Monster Conky Thread

gmonti wrote:
Sector11 wrote:
gmonti wrote:

@Sector11 I can help with the italian, but where.....????
@Deegan

I am no bash scripter and I know Deegan is Italian.  So if there is a language problem with English you could use Italian.  I've known Deegan for years ... a very nice person.

Oh It is ok, i would help anyway. Hope what i have posted, could help him.

I remembered that case here: http://crunchbanglinux.org/forums/post/147509/#p147509, so it is why i referred to Suicide post.

I forgot about that.  It must be my age.


To #! or not to #!?  That is the question! | #! Forum Moderator
#! Conky = 16 Threads & the Conky Archives | Conky PitStop | OTHCG'er
StartPage -  protect your privacy   |   LinuxBBQ

Offline

#389 2012-01-30 15:12:13

Deegan
Member
From: Italy Varese
Registered: 2011-11-19
Posts: 36

Re: The New Monster Conky Thread

Sector11 wrote:

So if there is a language problem with English you could use Italian.  I've known Deegan for years ... a very nice person.

Or my god I am touched
1238701789-Faccine_Eu_1.gif

-----

Sector11 wrote:

I forgot about that.  It must be my age.

I am 38 years old.:D

Last edited by Deegan (2012-01-30 15:28:24)

Offline

#390 2012-01-30 23:34:44

bartos
Member
Registered: 2011-12-20
Posts: 25

Re: The New Monster Conky Thread

My new Conky
Started with this http://gnome-look.org/content/show.php/ … ent=139024

cd8369172459187.jpg

Then just moved and added stuff

Last edited by bartos (2012-01-31 01:30:44)


Geek by nature
Linux by choice.
Crunchbang by default

Offline

#391 2012-01-31 02:42:09

ackernan
#! Junkie
Registered: 2011-01-10
Posts: 403

Re: The New Monster Conky Thread

bartos wrote:

My new Conky
Started with this http://gnome-look.org/content/show.php/ … ent=139024

cd8369172459187.jpg

Then just moved and added stuff

Looks good.  What's with number and circle inside cpu1?

Offline

#392 2012-01-31 02:52:09

bartos
Member
Registered: 2011-12-20
Posts: 25

Re: The New Monster Conky Thread

ackernan wrote:
bartos wrote:

My new Conky
Started with this http://gnome-look.org/content/show.php/ … ent=139024

cd8369172459187.jpg

Then just moved and added stuff

Looks good.  What's with number and circle inside cpu1?

Cpu temp ( no room for a label and didn't look good anywhere else)


Geek by nature
Linux by choice.
Crunchbang by default

Offline

#393 2012-02-01 00:54:03

sapristi
New Member
Registered: 2012-02-01
Posts: 3

Re: The New Monster Conky Thread

Hi,
i recently installed #! on my netbook, and discovered the (not so) new conky bindings with lua. Being a huge conky fan, i couldnt resist making some nice applets with this great new tool !
First here are some screentshots :

low CPU load
20eb6f172612077.jpg
1 CPU full load:
836a82172612081.jpg

So basically there are 2 clocks (a graphical one and a text one), and 2 gauges to show system load (memory  and cpu use).  I tried to use at most the new possibilities, something that i (surprisingly !) saw nowhere else ; use shape, size and color to represent a value. Get rid of the numbers !

I tried to make them really easy to use and configure (colors, fonts and size). They are split in different files, thats easier to use, but you loose the dynamic change you make to the other files than the one loaded by conky.

Here is what's in my .conky directory :
.conky:
functions.lua      --> miscallenous functions
global.lua           --> loaded by conky, loads all the stuff and launch the applets
applets/

.conky/applets:
clock.lua           --> moon clock !
clock_text.lua    --> more regular clock
conf.lua             --> global conf, not much in here for now
gauges.lua        --> the 2 system gauges applets

And here is the code :
global.lua

require "cairo"

conkypath = os.getenv("HOME").."/.conky"
funs = assert(loadfile(conkypath.."/functions.lua"))
conf = assert(loadfile(conkypath.."/applets/conf.lua"))

clock_applet = assert(loadfile(conkypath.."/applets/clock.lua"))
clock_text_applet = assert(loadfile(conkypath.."/applets/clock_text.lua"))
print(conkypath)
gauges_applet = assert(loadfile(conkypath.."/applets/gauges.lua"))

funs()
conf()
clock_applet()
clock_text_applet()
gauges_applet()



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 cr=cairo_create(cs)

   
   draw_clock(cr)
   draw_clock_text(cr, {x = 800})
   draw_system_gauge(cr, {x = 1200, y = 600,
              inner_max_radius = 70, surround_max_radius = 70, fontsize = 15,
              hwload_0 = Color(0.7, 0.7, 1, 0.8),hwload_1 = Color(1, 0.7, 0.7, 0.8)})
   draw_system_gauge2(cr,  {x = 1200, y = 400,hwload_1 = Color(1, 0.7, 0.7, 0.8)})
end

functions.lua

------------------------------------------
--    COLOR MANIPULATION        --
------------------------------------------

--converts a color from hexa format + alpha to 4 values between 0 and 1
function rgb_to_r_g_b(color,alpha)
   return ((color / 0x10000) % 0x100) / 255., ((color / 0x100) % 0x100) / 255., (color % 0x100) / 255., alpha
end

-- RGBA color constructor (functional programming in lua!)
function Color(_r, _g, _b, _a)
   return function(fn) return fn(_r,_g,_b,_a) end
end
-- basic functions
function id(a,b,c,d) return a,b,c,d end
function r(_x, _y, _z, _a) return _x end
function g(_x, _y, _z, _a) return _y end
function b(_x, _y, _z, _a) return _z end
function a(_x, _y, _z, _a) return _a end

--return a color between c1 and c2, with a factor t (between 0 and 1)
function mixRGBA(c1,c2,t)
   return Color(
      c1(r)*t + (1-t)*c2(r),
      c1(g)*t + (1-t)*c2(g),
      c1(b)*t + (1-t)*c2(b),
      c1(a)*t + (1-t)*c2(a))
end


------------------------------------------
--    TABLE MANIPULATION        --
------------------------------------------
-- merges t2 into t1
function merge(t1, t2)
    for k, v in pairs(t2) do
        if (type(v) == "table") and (type(t1[k] or false) == "table") then
            merge(t1[k], t2[k])
        else
            t1[k] = v
        end
    end
    return t1
end

----------------------------------------------
--     GENERAL PURPOSE DRAWING FUNCTIONS
----------------------------------------------

--[[ draws a ring, uses arc_adapt to correctly handle all angle values    
    cr : surface to draw
    pt : static data
        x,y (coordinates),
        radius, thickness, start_angle, end_angle, (in degree)
        color (Color format), alpha
]]

function draw_ring(cr,pt)
   local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
   local color = pt['color']
   --angle conversion
   local angle_0=sa*(math.pi/180)
   local angle_f=ea*(math.pi/180)
   
   -- Draws the ring
   cairo_arc_adapt(cr,xc,yc,ring_r + ring_w/2,angle_0,angle_f)
   cairo_set_source_rgba(cr,color(id))
   cairo_set_line_width(cr,ring_w)
   cairo_stroke(cr)
end




--[[draw gradations
   cr : surface to draw
   pt : static data
      x,y : coordinates
      inner_radius, outer_radius, thickness
      start_angle, end_angle
      grad_tot, grad_todraw
      color, alpha
]]
function draw_gradations(display,pt)
   local x,y,inner_radius,outer_radius,thickness, start_angle,end_angle=pt['x'],pt['y'],pt['inner_radius'], pt['outer_radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
   local nb_total_grad, nb_grad = pt['grad_tot'], pt['grad_to_draw']
   local color, alpha = pt['color'], pt['alpha']

   local graduation_unit_angle = (end_angle-start_angle)/nb_total_grad
   local i = 0
   while i < nb_grad do
      cairo_set_line_width(display, outer_radius - inner_radius)
      begin_g_a = (start_angle + graduation_unit_angle * i - thickness/2)*(2*math.pi/360)
      end_g_a = (start_angle + graduation_unit_angle * i + thickness/2)*(2*math.pi/360)
      cairo_arc(display, x, y, inner_radius + (outer_radius-inner_radius)/2, begin_g_a,end_g_a)
      cairo_set_source_rgba(display,color(id))
      cairo_stroke(display)
      i = i + 1
   end
end


-- handles all angle values for cairo_arc
function cairo_arc_adapt(display, x, y, radius, angle1, angle2)
   if angle1 < angle2
   then cairo_arc(display, x, y, radius, angle1, angle2)
   else cairo_arc_negative(display, x, y, radius, angle1, angle2)
   end
end


--------------------------
--    MISC        --
--------------------------

function merge_cfg(c1, c2)
   if (c2 == nil) or (type(c2) ~= "table")
   then 
      c2 = {}
      --DEBUG  print("cfg arg  given : ", custom_cfg)
   end
   -- final configuration
   return merge(c1, c2)
end

gauges.lua

conf = assert(loadfile(conkypath.."/applets/conf.lua"))
conf()

--        displays an arc relative to a conky value between 0 and 100.
--        constant angles, 
--        thickness and color depend on value
--    To be called by draw_system_gauge#
function draw_load_arc(cr, conky_fun, pt, fg_c1, fg_c2, font, fontsize)
   -- safely get conky value
   local load = conky_parse(conky_fun)
   if load == nil
   then load = 0 end
   local loadperc = tonumber(load)/100
   
   -- computes color and thickness
   pt['color'] = mixRGBA(fg_c2, fg_c1, math.pow(loadperc,1.3))
   pt['thickness'] = pt['thickness'] * loadperc
   
   --draw the arc
   draw_ring(cr, pt)

   --draw the text of the value to the right place (or tries to!)
   cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, 0)
   cairo_set_font_size (cr, fontsize)
   xtmp = (pt['radius'] + pt['thickness']+fontsize)*(math.cos((pt['start_angle'] + pt['end_angle'])/2/180*math.pi)) - fontsize/4
   ytmp = (pt['radius'] + pt['thickness']+fontsize)*(math.sin((pt['start_angle'] + pt['end_angle'])/2/180*math.pi)) + fontsize/4
   cairo_move_to(cr, pt['x'] + xtmp, pt['y']+ytmp)
   cairo_show_text(cr,load)
   cairo_stroke(cr)
end



-- multivalue system gauge
--    Inner ring :    radius and color is proportional to the value returned by conky function
--    Outer ring :    multiple arcs displaying thir own value, 
--            with radius starting from the inner ring 
function draw_system_gauge(cr, custom_cfg)
   
   local default_cfg = {
      --= colors =--
      hwload_0 = Color(0.7, 0.7, 1, 0.4), hwload_1 = Color(1, 0.7, 0.7, 0.4),
      inner_text = Color(0,0,0,0.6),
      --= geometry =--
      x = globalcfg.geom.x, y = globalcfg.geom.y,
      inner_max_radius = 40, surround_max_radius = 40,
      --= font =--
      font = globalcfg.font, fontsize = globalcfg.fontsize,
      arcs = {
     {conky_fun = "${cpu cpu0}", start_angle = -2, end_angle = -88},
     {conky_fun = "${cpu cpu1}", start_angle = 182, end_angle = 268},
     {conky_fun = "${cpu cpu2}", start_angle = 2, end_angle = 88},
     {conky_fun = "${cpu cpu3}", start_angle = 178, end_angle = 92}
      },
      inner = {conky_fun = "${memperc}", start_angle = 0, end_angle = 360, shrink = 0.9 }
   }
   
   
   -- final configuration
   local cfg = merge_cfg(default_cfg, custom_cfg)
   
   --inner radius computation
   local innerload = tonumber(conky_parse(cfg.inner.conky_fun))
   local gauge_radius = cfg.inner_max_radius*(innerload/100)^1
   local inner_gauge_radius = gauge_radius*cfg.inner.shrink

   --inner gauge
   cairo_move_to(cr,cfg.x,cfg.y)
   cairo_set_line_cap( cr, CAIRO_LINE_CAP_ROUND )
   cairo_set_line_width(cr,2*inner_gauge_radius)
   cairo_set_source_rgba(cr,mixRGBA(cfg.hwload_1, cfg.hwload_1, ((innerload)/100)^1.2)(id))
   cairo_line_to(cr,cfg.x,cfg.y)
   cairo_stroke(cr)
   --inner percent (text) 
   
--move_to ????
   cairo_line_to(cr,cfg.x-cfg.fontsize/4,cfg.y+cfg.fontsize/4)
   cairo_set_source_rgba(cr,cfg.inner_text(id))
   cairo_select_font_face (cr, cfg.font, CAIRO_FONT_SLANT_NORMAL, 0)
   cairo_set_font_size (cr, cfg.fontsize)
   cairo_show_text(cr,innerload)
   cairo_stroke(cr)
   
   --outer gauges
   cairo_set_line_cap( cr, CAIRO_LINE_CAP_BUTT )
   for _,obj in pairs(cfg.arcs) do
      --=====DEBUG==== print(obj.conky_fun)
      draw_load_arc(cr, obj.conky_fun,
            {x = cfg.x, y = cfg.y,
             start_angle = obj.start_angle, end_angle = obj.end_angle,
             radius = gauge_radius, thickness = cfg.surround_max_radius}, 
            cfg.hwload_0, cfg.hwload_1, cfg.font, cfg.fontsize)
   end
   cairo_stroke(cr)
end

function draw_system_gauge2(cr,custom_cfg)
   
   local default_cfg = {
      --= colors =--
      hwload_0 = Color(0.7, 0.7, 1, 0.4), hwload_1 = Color(1, 0.7, 0.7, 0.4),
      --= geometry =--
      x = globalcfg.geom.x-90, y = globalcfg.geom.y,
      inner_empty_radius = 10,space = 2,
      rings = {
     {conky_fun = "${memperc}",  thickness = 30, mode = "add"},
     {conky_fun = "${cpu cpu0}", thickness = 70, mode = "keep"},
     {conky_fun = "${cpu cpu1}", thickness = 70, mode = "keep"},
     {conky_fun = "${cpu cpu2}", thickness = 70, mode = "keep"},
     {conky_fun = "${cpu cpu3}", thickness = 70, mode = "keep"}
      }
   }
   
   
   -- final configuration
   local cfg = merge_cfg(default_cfg, custom_cfg)
   
   local current_thickness = cfg.inner_empty_radius
   local value,color,thickness = 0,0,0
   
   for _,ring in pairs(cfg.rings) do
      value = tonumber(conky_parse(ring.conky_fun))/100
      color = mixRGBA(cfg.hwload_1, cfg.hwload_0, value)
      thickness = ring.thickness*value
      
      draw_ring(cr, 
        {x = cfg.x, y = cfg.y, 
         radius = current_thickness, 
         thickness = thickness, 
         start_angle = 0, end_angle = 360,
         color = color
          })
      if ring.mode == "add"
      then current_thickness = current_thickness+ thickness+cfg.space 
      end
   end
   
end

clock :

-- default parameters; custom parameters should be given in the same format 
local default_cfg = {
   x = 391.8, y = 167.3,
   marks = {
      color = Color(0.85, 0.85, 1, 0.5),
      inner_radius = 95, outer_radius = 100, thickness = 1
   },
   seconds = {
      color = Color(0.65, 0.65, 0.75, 0.7),
      arc_measure = 40, radius = 121, thickness = 2
   },
   minutes = {
      color = Color(0.95,0.95,1, 0.7),
      inner_radius = 55, outer_radius = 135, thickness = 1
   },
   hours = {
      color = Color(0.95,0.95,1, 0.7),
      inner_radius = 63, outer_radius = 115, thickness = 5 
   }
}



function draw_clock(cr, custom_cfg)
   
   
   -- final configuration
   local cfg = merge_cfg(default_cfg, custom_cfg)
   

   --get time and angles
   local hours, mins, secs=os.date("%H"),os.date("%M"), os.date("%S")
   local hours_angle = math.mod(hours,12)*30+mins/10-90
   local mins_angle = mins*360/60+secs/10-90
   local secs_angle = secs*360/60 -90
   
   cairo_set_line_cap( cr, CAIRO_LINE_CAP_ROUND )
   --clock marks
   draw_gradations(cr,
           {x= cfg.x, y = cfg.y, start_angle = -90, end_angle = 270,
            inner_radius = cfg.marks.inner_radius, 
            outer_radius = cfg.marks.outer_radius , 
            thickness = 1,
            grad_tot = 12, grad_to_draw = 12,
            color = cfg.marks.color})

   --seconds ring
   draw_ring(cr,
         {x= cfg.x, y = cfg.y,
          start_angle = secs_angle - cfg.seconds.arc_measure/2,
          end_angle = secs_angle + cfg.seconds.arc_measure/2,
          radius = cfg.seconds.radius, thickness = cfg.seconds.thickness,
          color = cfg.seconds.color})
   
   

   cairo_set_line_cap( cr, CAIRO_LINE_CAP_BUTT )   
   -- minutes hand
   draw_gradations(cr,
           {x= cfg.x, y = cfg.y,
            start_angle = mins_angle, end_angle = mins_angle,
            inner_radius = cfg.minutes.inner_radius, 
            outer_radius = cfg.minutes.outer_radius , 
            thickness = cfg.minutes.thickness,
            grad_tot = 1, grad_to_draw = 1,
            color = cfg.minutes.color})
   --hours hand
   draw_gradations(cr,
           {x= cfg.x, y = cfg.y,
            start_angle = hours_angle, end_angle = hours_angle,
            inner_radius = cfg.hours.inner_radius, 
            outer_radius = cfg.hours.outer_radius , 
            thickness = cfg.hours.thickness,
            grad_tot = 1, grad_to_draw = 1,
            color = cfg.hours.color})
   --[[
   For debug, if you want to center the clock on something
   draw_ring(cr,
         {x= cfg.x, y = cfg.y,
          start_angle = 0, end_angle = 360,
          radius = 49, 
          thickness = 1,
          color = Color(0,0,0,1)})
    ]]
end


function conky_clock_applet()
   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)
   draw_clock(cr)
end

clock_text.lua

-- default parameters
local default_cfg = {
      x = 800,
      y = 165
   }


function draw_clock_text(cr, custom_cfg)
   

   -- final configuration
   local cfg = merge_cfg(default_cfg, custom_cfg)
   

   -- init
   cairo_select_font_face (cr, "Amplitude BRK", CAIRO_FONT_SLANT_NORMAL, 0);
   cairo_set_source_rgba(cr,rgb_to_r_g_b(0xF5F5FF,0.4))
   
   -- ligne horizontale
   cairo_move_to(cr, cfg.x, cfg.y)
   cairo_line_to(cr, cfg.x + 530, cfg.y)
   cairo_set_line_width(cr,1)
   cairo_stroke(cr)


   -- heure
   cairo_set_font_size (cr, 150)
   cairo_set_source_rgba(cr,rgb_to_r_g_b(0xAAAACC,0.3))
   cairo_move_to(cr, cfg.x, cfg.y-5 )
   cairo_show_text(cr, os.date('%H'))
   cairo_set_font_size (cr, 100)
   cairo_show_text(cr, os.date(':%M'))
   cairo_stroke(cr)

   --date
   day = conky_parse("${time %A}")
   date = conky_parse("${time %d}")
   month = conky_parse("${time %B}")
   d = day:gsub("%a", string.upper, 1)
   m = month:gsub("%a", string.upper, 1)
   
   -- day name
   cairo_set_source_rgba(cr,rgb_to_r_g_b(0xF5F5FF,0.2))
   cairo_move_to(cr, cfg.x + 270, cfg.y -50  )
   cairo_set_font_size (cr, 45);
   cairo_show_text(cr, d)
   
   -- day number 
   cairo_move_to(cr, cfg.x + 360, cfg.y -10 )
   cairo_set_source_rgba(cr,rgb_to_r_g_b(0xE5E5FF,0.3))
   cairo_show_text(cr, date)

   -- month
   cairo_set_source_rgba(cr,rgb_to_r_g_b(0xF5F5FF,0.2))
   cairo_set_font_size (cr, 30)
   cairo_show_text(cr, " " ..  m)
   cairo_stroke(cr)

end



function conky_clock_text_applet()
   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)
   draw_clock_text(cr)
end

conf.lua

globalcfg = {
   font = "Amplitude BRK", fontsize = 10,
   geom = {
      x = 200, y = 50
   }
}


And here is one (unfinished) battery applet :

require "cairo"

conkypath = os.getenv("HOME").."/.conky"
conf = assert(loadfile(conkypath.."/applets/conf.lua"))
funs = assert(loadfile(conkypath.."/functions.lua"))

funs()
conf()


function draw_battery_gauge(cr, custom_cfg)
   
   local default_cfg = {
      --= colors =--
      empty = Color(0.7, 0.7, 1, 0.4), full = Color(1, 0.7, 0.7, 0.4),
      --= geometry =--
      x = 500, y = 600,
      inner_radius = 15, 
      min_ball_radius = 10, max_ball_radius = 10,
      min_spin_radius = 25, max_spin_radius = 70,
      idle_thickness = 4,
      --= font =--
      font = globalcfg.font, fontsize = globalcfg.fontsize,
      batt_name = "BAT1", spinning_speed = 0.1
   }
   
   
   -- final configuration
   local cfg = merge_cfg(default_cfg, custom_cfg)
   
   --initialisation
   local angle =  (_battery_angle or 0) 
   
   local battery_string = conky_parse("${battery "..cfg.batt_name.."}")
   local _,_,batt_status, batt_percent = string.find(battery_string, "(%w*) (%w*)")
   local timegrain =  conky_info.update_interval
   
   local radius = cfg.min_spin_radius + batt_percent/100*(cfg.max_spin_radius - cfg.min_spin_radius) 
   
   
   --inner ring
   cairo_set_source_rgba(cr, Color(0.6, 0.6, 0.6, 0.9, 0.7)(id))
   cairo_set_line_cap( cr, CAIRO_LINE_CAP_ROUND )
   cairo_set_line_width(cr,2*cfg.inner_radius)
   cairo_move_to(cr,cfg.x,cfg.y)
   cairo_line_to(cr,cfg.x,cfg.y)
   cairo_stroke(cr)
   
   if batt_status == "unknown"
   then 
      cairo_set_line_cap( cr, CAIRO_LINE_CAP_BUTT )
      draw_ring(cr, 
        {x = cfg.x,y =  cfg.y,
         start_angle = 0, end_angle = 360,
         radius = radius, thickness = cfg.idle_thickness,
         color = Color(0.6, 0.6, 0.6, 0.9, 0.7)})
   else
      if batt_status == "discharging"
      then spinning_mod = -1
      else spinning_mod = 1 end
      
      
      local speed = cfg.spinning_speed * cfg.max_spin_radius*spinning_mod*timegrain
      
      local new_angle = angle + speed/radius
      
      -- spinning ball
      cairo_set_line_width(cr,2*cfg.min_ball_radius)
      cairo_move_to(cr, 
            cfg.x + radius*math.cos(new_angle), 
            cfg.y + radius*math.sin(new_angle))
      cairo_line_to(cr, 
         cfg.x + radius*math.cos(new_angle), 
         cfg.y + radius*math.sin(new_angle))
      cairo_stroke(cr)
      _battery_angle = new_angle
   end
end

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 cr=cairo_create(cs)

   draw_battery_gauge(cr)
end

Hope you like it, please give feedback ! smile

= ) Special thanks for corenominal for providing this really good debian remodelling ! ( =

Last edited by sapristi (2012-02-01 01:40:13)

Offline

#394 2012-02-01 01:07:20

barrybarrykelly
Member
Registered: 2012-01-25
Posts: 34

Re: The New Monster Conky Thread

I made some more changes to my audacious conky, mostly just to tidy it up.
6798564481_6796df8cab.jpg
Short video of the 'finished' Conky
wupload link for conky
There's a short readme included and the bash script files are thoroughly commented, I'd have just posted on paste bin but it needed the images for the buttons and cd case overlay.

Feel free to edit distribute etc and any problems getting it working or questions just give me a shout and I'll help where I can.

Last edited by barrybarrykelly (2012-02-01 01:10:36)

Offline

#395 2012-02-01 14:28:21

fortyseven
#! Die Hard
From: Sector 7G
Registered: 2011-12-23
Posts: 514

Re: The New Monster Conky Thread

Ok, so my new conky is coming along ok. Still got a few tweaks to do:

tY2toNQ

One question I hope someone can answer though. If I enable text outlines and move the text around, why does the outline not move too? How do I get the text outlines to move with the text?


on the outside looking in

Offline

#396 2012-02-01 15:10:51

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,986
Website

Re: The New Monster Conky Thread

fortyseven wrote:

Ok, so my new conky is coming along ok. Still got a few tweaks to do:

tY2toNQ

One question I hope someone can answer though. If I enable text outlines and move the text around, why does the outline not move too? How do I get the text outlines to move with the text?

What command are you using to "enable text outlines"?  I don't see any.

Never mind:

draw_outline yes
draw_shades yes

Please show an example of how you move it and the shade or outline down'y move.  In my test they do.

Last edited by Sector11 (2012-02-01 15:18:34)


To #! or not to #!?  That is the question! | #! Forum Moderator
#! Conky = 16 Threads & the Conky Archives | Conky PitStop | OTHCG'er
StartPage -  protect your privacy   |   LinuxBBQ

Offline

#397 2012-02-01 23:30:47

BaconStation
New Member
Registered: 2012-02-01
Posts: 4

Re: The New Monster Conky Thread

Hello
I have used code from this forum to make a Conky Toy Story theme, my kids like it!
The trouble is I cannot speed up the scrolling text for my music it is really slow?

Screenshot_010212_15_41_52.jpg

Screenshot_070112_14_05_51.jpg

${voffset -6}MUSIC ${hr 2}
${if_running exaile}${voffset 6}${offset 0}${voffset 0}${font DotMatrix:size=18}${exec conkyExaile --datatype=PT} ${voffset 0}${font PizzaDude Bullets:size=10}BBBBB ${font} ${offset -65}${color 0778ec}${exec conkyExaile -n --datatype=RT --ratingchar=C}$color
${font DotMatrix:size=18:}${offset 0 font DotMatrix:size=18:}${scroll 15 1 ${exec conkyExaile --datatype=TI}} ${font}
${font DotMatrix:size=18:}${offset 0 font DotMatrix:size=18:}${scroll 15 1 ${exec conkyExaile --datatype=AR}} ${font}
${font DotMatrix:size=18:}${offset 0 font DotMatrix:size=18:}${scroll 15 1 ${exec conkyExaile --datatype=AL}} ${font}
${image ~/cover.jpg -p 0,2 -s 64x64}
${else}       ..:: Exaile not running ::..
${endif}
${voffset -12}${HR 2}

Offline

#398 2012-02-02 01:55:23

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,163
Website

Re: The New Monster Conky Thread

^ Really cool Conky and Toy Story Theme...

I have looked the the scroll variable in Conky and see no options for speeding it up, but I will wait for others with more experience to confirm.


VSIDO | Words That Build Or Destroy

We do not run from challenges, they become new innovations within VSIDO!

Offline

#399 2012-02-02 02:38:57

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 11,986
Website

Re: The New Monster Conky Thread

I have to agree with VastOne - no speed adjust for scroll.  Sorry!

Nice theme for your kids.

EDIT:

I tested with this:

all the stuff needed here
and

TEXT
${scroll 20 1 Scroll 'text' by 'step' characters showing 'length' number of characters at the same time. The text may also contain variables. 'step' is optional and defaults to 1 if not set. If a var creates output on multiple lines then the lines are placed behind each other separated with a '|'-sign. If you change the textcolor inside scroll it will automatically have it's old value back at the end of scroll. The end and the start of text will be separated by 'length' number of spaces.}

Last edited by Sector11 (2012-02-02 02:41:35)


To #! or not to #!?  That is the question! | #! Forum Moderator
#! Conky = 16 Threads & the Conky Archives | Conky PitStop | OTHCG'er
StartPage -  protect your privacy   |   LinuxBBQ

Offline

Be excellent to each other!

#400 2012-02-02 03:10:25

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: The New Monster Conky Thread

would i be mistaken to say that if you want a faster scroll just increase step?
step is how many characters the text moves per cycle

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo