Page 25 of 32 FirstFirst ... 152324252627 ... LastLast
Results 241 to 250 of 313

Thread: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

  1. #241
    Join Date
    May 2008
    Beans
    Hidden!

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Quote Originally Posted by vickoxy View Post
    Thanks a lot. That did it.

    Code:
    ${voffset -72}${font andale mono:size=7}${color ffffff}${execpi 3600 cal -m | sed '1d' | sed '/^ *$/d' | sed -r '0,/./s/^(.{0})(.{20})/\1${color BFEEFC}\2${color}/' | sed 's/\<'"$(date +%-d)"'\>/${color 4CD5FF}&${color}/'|sed 's/^/${alignc -30}/'}
    Just don´t understand those lines and where to put colors and other stuff. Once again, thanks a lot.
    I edited the code a little bit. Nothing important so you don't need to edit yours.

    Here it is with color coding to explain the different parts:
    Code:
    cal -m | sed '1d' | sed '/^ *$/d' | sed -r '0,/./s/.*/${color BFEEFC}&${color}/' | sed 's/\<'"$(date +%-d)"'\>/${color 4CD5FF}&${color}/'|sed 's/^/${alignc -30}/'
    Removes the first line. (Month and year)
    Removes any blank lines.
    The 0 means it'll only change the first line. It adds the color to the beginning and end of the line. (Names of the days of the week.)
    Surrounds the current day number with color code.
    Adds the alignment code to the beginning of each line.

  2. #242
    Join Date
    Jan 2009
    Location
    Europe-Austria
    Beans
    1,047
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Quote Originally Posted by mobilediesel View Post
    I edited the code a little bit. Nothing important so you don't need to edit yours.

    Here it is with color coding to explain the different parts:
    Code:
    cal -m | sed '1d' | sed '/^ *$/d' | sed -r '0,/./s/.*/${color BFEEFC}&${color}/' | sed 's/\<'"$(date +%-d)"'\>/${color 4CD5FF}&${color}/'|sed 's/^/${alignc -30}/'
    Removes the first line. (Month and year)
    Removes any blank lines.
    The 0 means it'll only change the first line. It adds the color to the beginning and end of the line. (Names of the days of the week.)
    Surrounds the current day number with color code.
    Adds the alignment code to the beginning of each line.
    Well, thanks-i just have to add this answer to my bookmarks. Still it is hard to know where exactly to put those values.
    MacBook Pro7,1, Ubuntu 11.04 64bit

  3. #243
    Join Date
    Oct 2009
    Location
    frisco-->native
    Beans
    324
    Distro
    Ubuntu

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    anyone have a suggestion for making {mixer} and {mixerbar} work...
    all I get is a 0 for master volume and an empty bar...

    tia
    wbg

    PHP Code:
    # set to yes if you want Conky to be forked in the background
    background yes

    # Use Xft?
    use_xft yes

    # Xft font when Xft is enabled
    xftfont Trebuchet MS:size=10

    # Text alpha when using Xft
    xftalpha 0.9

    # Update interval in seconds
    update_interval 1.0

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

    # Create own window instead of using desktop (required in nautilus)
    own_window yes

    # If own_window is yes, you may use type normal, desktop or override
    own_window_type override

    # Use pseudo transparency with own_window?
    own_window_transparent yes

    # If own_window is yes, these window manager hints may be used
    own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

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

    # Minimum size of text area
    #minimum_size 150 5

    # Maximum width
    maximum_width 140

    # Draw shades?
    draw_shades no

    # Draw outlines?
    draw_outline no

    # Draw borders around text
    draw_borders no

    # Draw borders around graphs
    draw_graph_borders no

    # Stippled borders?
    # stippled_borders 8

    # border margins
    # border_margin 2

    # border width
    # border_width 1

    # Default colors and also border colors
    default_color black
    default_shade_color red
    default_outline_color green

    # Text alignment, other possible values are commented
    #alignment top_left
    alignment top_right
    #alignment bottom_left
    #alignment bottom_right
    #alignment none

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

    # Subtract file system buffers from used memory?
    no_buffers yes

    # set to yes if you want all text to be in uppercase
    uppercase no

    # number of cpu samples to average
    # set to 1 to disable averaging
    cpu_avg_samples 2

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

    # variable is given either in format $variable or in ${variable}

    # stuff after 'TEXT' will be formatted on screen

    #  unused text
    #  $sysname $kernel
    #  Uptime:$alignr$uptime
    #  ${time %A}$alignr${time %F}
    #  hda1: ${fs_used_perc /mnt/FILES}% ${color lightgray}${fs_bar /mnt/FILES/}$color
    #  Swap: $swapperc% ${color lightgray}$swapbar$color
    #  Signal:$alignr${linkstatus  ath0}
    #  Current:${alignr}${execi 20 /home/tonyt/scripts/.conky_ath0} Mbits/sec
    #  eth2:$alignr${addr eth2}
    #  ${upspeedgraph wlan0 20,130 000000 ffffff}
    #  ${downspeedgraph wlan0 20,130 000000 ffffff}

    TEXT

    ${color black}${time %%%G}
    ${
    color black}${time %I:%%P}
    Up-load ${upspeed wlan0k/s
    Down
    -Load ${downspeed wlan0}k/s${color}
    RAM$mem/$memmax 
    ${color darkgray}$membar$color
    CPU0 
    ${cpu cpu1}% ${color darkgray}${cpubar cpu1}$color
    CPU1 
    ${cpu cpu2}% ${color darkgray}${cpubar cpu2}$color
    sda1
    : ${fs_used_perc /}% ${color darkgray}${fs_bar /}$color
    Processes
    $processes ${alignr}Running$running_processes
    HDD Temp 
    ${execi 5 hddtemp /dev/sda1 cut -c 34-36}Deg C
    Battery
    $battery_short
    ${color black}$battery_bar
    Volume
    :${mixer
    ${
    color blue}${mixerbar
    Lenovo ThinkPad T400 Core 2 Duo 4GB Ram Mint 13 XFCE
    500 GB spinning iron and 64 GB Crucial SSD in DVD bay.

  4. #244
    Join Date
    Aug 2009
    Location
    East of Atlantic
    Beans
    81
    Distro
    Ubuntu

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Hi folks !

    For my personal use I wrote a Lua script used to transform square image to "rounded" image (ie circle with transparency).
    I also wrote a script to get images from Moon or from Earth...

    From this image to this one (in a conky)


    First, the script to get the moon or earth image : get_moon_earth.sh (to get the moon you need to pass moon as parameter). The parameters at the beginning of the script are the same as on this page : http://www.fourmilab.ch/earthview/expert.html
    Code:
    #!/bin/bash
    #This script download image from Earth or from Moon (if first parameter = "moon")
    #the parameters are the sames as on this page
    #http://www.fourmilab.ch/earthview/expert.html
    #version1.0, wlourf 07 avril 2010
    #http://u-scripts.blogspot.com/
    
    
    #===========début des paramètres===============
    dir="/tmp/earth"
    
    if [[ "$1" == "moon" ]]; then
        Latitude=46        #number
        NorthSouth=n    #n/s
        Longitude=0        #number
        EastWest=e        #e/w
        Altitude=401725 #altitude in kilometers (max=401725)
        #___Image___
        Image=topo         #topo,albedo
        Size=320        #number (default=320)
        ShowNight=true     #true/false
        file1=$dir/get_moon.txt        #temp file for url
        file2=$dir/moon_image        #final image
    else
        #___View___
        Latitude=33       #number
        NorthSouth=n    #n/s
        Longitude=70      #number
        EastWest=e          #e/w
        Altitude=35785     #altitude in kilometers (max=35785)
        #___Image___
        Image=live         #live,marble,nasa,topo,cloudy,ir,cweather,vapour_bg,vapour
        Size=320        #number (default=320)
        ShowNight=true     #true/false
        file1=$dir/get_earth.txt    #temp file for url
        file2=$dir/earth_image        #final image
    fi
    
    #===========fin des paramètres===============
    
    base=http://www.fourmilab.ch
    
    #mise en forme des paramètres
    if [[ "$NorthSouth" == "s" ]]; then
        NorthSouth="South"
    else
        NorthSouth="North"
    fi
    if [[ "$EastWest" == "e" ]]; then
        EastWest="East"
    else
        EastWest="West"
    fi
    
    if [[ "$ShowNight" == true ]]; then
        DayNight=""
    else
        DayNight="&daynight=d"
    fi
    if [[ "$1" == "moon" ]]; then
        case $Image in
            "topo")    Image="MoonTopo.evif";;
            *)        Image="Moon.evif";;
        esac
    else
        case $Image in
            "marble")    Image="NASA500m.evif";;
            "nasa")        Image="nasa.evif";;
            "topo")        Image="NOAAtopo.evif";;
            "clouds")    Image="cloudy.bmp";;
            "ir")        Image="irsat.bmp";;
            "cweather")    Image="wx-cmap.bmp";;
            "vapour_bg")Image="vapour_bg.bmp";;
            "vapour")    Image="vapour.bmp";;
            *)            Image="learth.evif";;
        esac
    fi
    
    #get the url
    mkdir -p $dir
    cd $dir
    
    GET http://www.fourmilab.ch/cgi-bin/Earth?lat=$Latitude\&ns=l$NorthSouth\&lon=$Longitude\&ew=$EastWest\&alt=$Altitude$DayNight\&img=$Image\&imgsize=$Size > $file1
    
    #extract the line of the image
    match="<img src="
    url_line=""
    while read line
    do
        if [[ "$line" =~ "${match}" ]]; then
            url_line=$line
            break
        fi
    done <  $file1
    
    if [[ "$url_line" == "" ]]; then
        echo "no url matched"
        exit
    fi
    
    #extract the link of the image and save the image
    begin="<img src=\""
    end="\" ismap"
    
    a=$(($(expr "$url_line" : ".*$begin")))
    b=$(($(expr "$url_line" : ".*$end")-$a-${#end}))
    url_image=${url_line:$a:$b}
    GET $base$url_image > $file2
    
    exit
    The Lua script square_to_round.lua :
    Code:
    --[[ SQUARE_TO_ROUND WIDGET by Wlourf (07 April 2010, version 1.0.1)
    http://u-scripts.blogspot.com/
    
    This widget display a rounded image on your conky from a square image only.
    
    Parameters are
    filename        --name of picture to use
    xc,yc           --coordinates of the center of circle relative to top left corner of conky window
    radius          --radius of the circle
    angle           --angle of rotation in degrees
    radius_crop        --percentage of original image to keep (0-100)
    period            --convert input image to output image every 'period' seconds
    
    ]]
    
    require 'cairo'
    require 'imlib2'
    
    
    function convert_square(fileIn,fileOut,radius,angle,radius_crop)
        --convert Input file from jpg to png, scale it and rotate it
        local imageInput = imlib_load_image(fileIn)
        local out_size = radius*2/(radius_crop/100)
        imlib_context_set_image(imageInput)
        w = imlib_image_get_width();
        h = imlib_image_get_height();
        imlib_image_set_format("png")
        buffer = imlib_create_image(out_size,out_size);
        imlib_context_set_image(buffer);
    
        imlib_blend_image_onto_image(imageInput, 0, 
                                                   0, 0, w, h, 
                                                   0,0, out_size,out_size)
        rot_img=imlib_create_rotated_image(angle*math.pi/180)
        imlib_context_set_image(rot_img)  
        imlib_save_image(fileOut)
        imlib_free_image()
        
        imlib_context_set_image(buffer)
        imlib_free_image()
        imlib_context_set_image(imageInput)
        imlib_free_image()
    end
    
    function crop_square_to_round(filename,xc,yc,radius)
        local surface = cairo_image_surface_create_from_png(filename)
        local img_w = cairo_image_surface_get_width (surface);
        
        local cw,ch = conky_window.width, conky_window.height
        local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, cw,ch)
        local cr=cairo_create(cs)
        cairo_translate(cr,xc-img_w/2,yc-img_w/2)
        cairo_arc (cr, img_w/2,img_w/2, radius, 0, 2*math.pi)
        cairo_clip (cr)
        cairo_new_path (cr)    
        cairo_set_source_surface (cr, surface, 0, 0)
    
        cairo_paint (cr)
        cairo_destroy(cr)
        cairo_surface_destroy (cs)
        cairo_surface_destroy (surface)
        
    end
    
    function display_round(filename,xc,yc,radius,angle,radius_crop,period)
        if conky_window == nil then return end
    
        if tonumber(conky_parse('${updates}')) <2  then return end
        local filepng = filename .. ".png"
        local actual_time  = os.time()
        
        if last_time == nil then last_time=0 end
        local actual_img = io.open(filepng,"r")    
        if  last_time+period < actual_time or last_time == 0 or actual_img == nil then
            print ('convert image ' .. filename)
            convert_square(filename,filepng,radius,angle,radius_crop)
            last_time=actual_time
        end
        crop_square_to_round(filepng,xc,yc,radius)
        io.close()
    end
    
    
    --[[END OF SQUARE TO ROUND WIDGET]]
    
    function conky_main(filename)
        if conky_window == nil then return end
        display_round(filename,
                    275,275,120,  --xc,yc,radius
                    5,            --angle
                    98,              --radius_crop (1-100)
                    3600          --period
                    
        )
    end
    And the conkyrc
    Code:
    # -- Conky settings -- #
    background no
    update_interval 10
    
    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 normal
    own_window_transparent yes
    #own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
    own_window_colour FFFFFF
    own_window_title square to round
    
    border_inner_margin 0
    border_outer_margin 0
    
    minimum_size 450 550
    
    alignment tm
    gap_y 0
    gap_x 0
    
    # -- Graphics settings -- #
    draw_shades no
    draw_outline no
    draw_borders no
    draw_graph_borders no
    
    # -- Text settings -- #
    use_xft yes
    xftfont Santana:size=12
    xftalpha 0
    
    uppercase no
    
    default_color 000000
    text_buffer_size 2048 
    imlib_cache_size 0 
    #--- LUA ---
    lua_load ~/wip/earth/square_to_round.lua 
    #first parameter is the square image to use
    lua_draw_hook_pre main /tmp/earth/earth_image
    
    TEXT
    ${execpi 3600 ~/wip/earth/get_moon_earth.sh earth}
    And if you are inspired, you can get amazing conkys like this one :



    Happy conkying

    EDIT : a more simple way to have rounded images is here, with a script from larryni : http://wwww.ubuntuforums.org/showpos...ostcount=13076
    You need the 2 masks from the above topic.

    I use it now in my script, so it gives that :
    Code:
    #!/bin/bash
    #This script download image from Earth or from Moon (if first parameter = "moon")
    #the parameters are the sames as on this page
    #http://www.fourmilab.ch/earthview/expert.html
    #version1.1, wlourf 14 sept. 2010
    #http://u-scripts.blogspot.com/
    #http://ubuntuforums.org/showpost.php?p=9088516&postcount=244
    
    #http://ubuntuforums.org/showpost.php?p=8117609&postcount=9846
    #http://wwww.ubuntuforums.org/showpost.php?p=9541241&postcount=13076
    
    #first parameter moon to display moon, other or mssing = earth
    
    #===========début des paramètres===============
    dir="/tmp/earth"
    dirmasks="/home/ll/conky/earth"
    
    if [[ "$1" == "moon" ]]; then
        Latitude=47.243055556        #number
        NorthSouth=n    #n/s
        Longitude=6.021944444        #number
        EastWest=e        #e/w
        Altitude=401725 #altitude in kilometers (max=401725)
        #___Image___
        Image=topo         #topo,albedo
        Size=100        #number (default=320)
        ShowNight=true     #true/false
        file1=$dir/get_moon.txt        #temp file for url
        file2=$dir/moon_image        #final image
        basename="moon"
    else
        #___View___
        Latitude=47.243055556       #number
        NorthSouth=n    #n/s
        Longitude=6.021944444      #number
        EastWest=e          #e/w
        Altitude=35785     #altitude in kilometers (max=35785)
        #___Image___
        Image=live         #live,marble,nasa,topo,cloudy,ir,cweather,vapour_bg,vapour
        Size=100            #number (default=320)
        ShowNight=true     #true/false
        file1=$dir/get_earth.txt    #temp file for url
        file2=$dir/earth_image        #final image
        basename="earth"
    fi
    
    #===========fin des paramètres===============
    
    base=http://www.fourmilab.ch
    
    #mise en forme des paramètres
    if [[ "$NorthSouth" == "s" ]]; then
        NorthSouth="South"
    else
        NorthSouth="North"
    fi
    if [[ "$EastWest" == "e" ]]; then
        EastWest="East"
    else
        EastWest="West"
    fi
    
    if [[ "$ShowNight" == true ]]; then
        DayNight=""
    else
        DayNight="&daynight=d"
    fi
    if [[ "$1" == "moon" ]]; then
        case $Image in
            "topo")    Image="MoonTopo.evif";;
            *)        Image="Moon.evif";;
        esac
    else
        case $Image in
            "marble")    Image="NASA500m.evif";;
            "nasa")        Image="nasa.evif";;
            "topo")        Image="NOAAtopo.evif";;
            "clouds")    Image="cloudy.bmp";;
            "ir")        Image="irsat.bmp";;
            "cweather")    Image="wx-cmap.bmp";;
            "vapour_bg")Image="vapour_bg.bmp";;
            "vapour")    Image="vapour.bmp";;
            *)            Image="learth.evif";;
        esac
    fi
    
    #get the url
    mkdir -p $dir
    cd $dir
    
    wget -q http://www.fourmilab.ch/cgi-bin/Earth?lat=$Latitude\&ns=l$NorthSouth\&lon=$Longitude\&ew=$EastWest\&alt=$Altitude$DayNight\&img=$Image\&imgsize=$Size -O $file1
    
    #extract the line of the image
    url_image="$(cat $file1 | grep "<img src=" | awk -F'\"' '{print $2}' )"
    
    if [[ "$url_image" == "" ]]; then
        echo "no url matched"
        exit
    fi
    
    #extract the link of the image and save the image
    wget -q  $base$url_image -O $file2
    
    convert $file2 -colorspace Gray $dirmasks/overlay$Size.png -compose HardLight -composite $dirmasks/mask$Size.png -alpha off -compose CopyOpacity -composite $dir/$basename-out.png
    
    #convert $file2  -colorspace Gray $dirmasks/mask$Size.png -alpha off -compose CopyOpacity -composite $dir/$basename-out.png
    
    exit 0
    Last edited by wlourf; September 29th, 2010 at 05:13 PM.

  5. #245
    Join Date
    Jul 2008
    Location
    Connecticut, U.S.
    Beans
    106
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Quote Originally Posted by wlourf View Post
    Hi folks !

    For my personal use I wrote a Lua script used to transform square image to "rounded" image (ie circle with transparency).
    I also wrote a script to get images from Moon or from Earth...

    From this image to this one (in a conky)


    First, the script to get the moon or earth image : get_moon_earth.sh (to get the moon you need to pass moon as parameter). The parameters at the beginning of the script are the same as on this page : http://www.fourmilab.ch/earthview/expert.html
    Code:
    #!/bin/bash
    #This script download image from Earth or from Moon (if first parameter = "moon")
    #the parameters are the sames as on this page
    #http://www.fourmilab.ch/earthview/expert.html
    #version1.0, wlourf 07 avril 2010
    #http://u-scripts.blogspot.com/
    
    
    #===========début des paramètres===============
    dir="/tmp/earth"
    
    if [[ "$1" == "moon" ]]; then
        Latitude=46        #number
        NorthSouth=n    #n/s
        Longitude=0        #number
        EastWest=e        #e/w
        Altitude=401725 #altitude in kilometers (max=401725)
        #___Image___
        Image=topo         #topo,albedo
        Size=320        #number (default=320)
        ShowNight=true     #true/false
        file1=$dir/get_moon.txt        #temp file for url
        file2=$dir/moon_image        #final image
    else
        #___View___
        Latitude=33       #number
        NorthSouth=n    #n/s
        Longitude=70      #number
        EastWest=e          #e/w
        Altitude=35785     #altitude in kilometers (max=35785)
        #___Image___
        Image=live         #live,marble,nasa,topo,cloudy,ir,cweather,vapour_bg,vapour
        Size=320        #number (default=320)
        ShowNight=true     #true/false
        file1=$dir/get_earth.txt    #temp file for url
        file2=$dir/earth_image        #final image
    fi
    
    #===========fin des paramètres===============
    
    base=http://www.fourmilab.ch
    
    #mise en forme des paramètres
    if [[ "$NorthSouth" == "s" ]]; then
        NorthSouth="South"
    else
        NorthSouth="North"
    fi
    if [[ "$EastWest" == "e" ]]; then
        EastWest="East"
    else
        EastWest="West"
    fi
    
    if [[ "$ShowNight" == true ]]; then
        DayNight=""
    else
        DayNight="&daynight=d"
    fi
    if [[ "$1" == "moon" ]]; then
        case $Image in
            "topo")    Image="MoonTopo.evif";;
            *)        Image="Moon.evif";;
        esac
    else
        case $Image in
            "marble")    Image="NASA500m.evif";;
            "nasa")        Image="nasa.evif";;
            "topo")        Image="NOAAtopo.evif";;
            "clouds")    Image="cloudy.bmp";;
            "ir")        Image="irsat.bmp";;
            "cweather")    Image="wx-cmap.bmp";;
            "vapour_bg")Image="vapour_bg.bmp";;
            "vapour")    Image="vapour.bmp";;
            *)            Image="learth.evif";;
        esac
    fi
    
    #get the url
    mkdir -p $dir
    cd $dir
    
    GET http://www.fourmilab.ch/cgi-bin/Earth?lat=$Latitude\&ns=l$NorthSouth\&lon=$Longitude\&ew=$EastWest\&alt=$Altitude$DayNight\&img=$Image\&imgsize=$Size > $file1
    
    #extract the line of the image
    match="<img src="
    url_line=""
    while read line
    do
        if [[ "$line" =~ "${match}" ]]; then
            url_line=$line
            break
        fi
    done <  $file1
    
    if [[ "$url_line" == "" ]]; then
        echo "no url matched"
        exit
    fi
    
    #extract the link of the image and save the image
    begin="<img src=\""
    end="\" ismap"
    
    a=$(($(expr "$url_line" : ".*$begin")))
    b=$(($(expr "$url_line" : ".*$end")-$a-${#end}))
    url_image=${url_line:$a:$b}
    GET $base$url_image > $file2
    
    exit
    The Lua script square_to_round.lua :
    Code:
    --[[ SQUARE_TO_ROUND WIDGET by Wlourf (07 April 2010, version 1.0.1)
    http://u-scripts.blogspot.com/
    
    This widget display a rounded image on your conky from a square image only.
    
    Parameters are
    filename        --name of picture to use
    xc,yc           --coordinates of the center of circle relative to top left corner of conky window
    radius          --radius of the circle
    angle           --angle of rotation in degrees
    radius_crop        --percentage of original image to keep (0-100)
    period            --convert input image to output image every 'period' seconds
    
    ]]
    
    require 'cairo'
    require 'imlib2'
    
    
    function convert_square(fileIn,fileOut,radius,angle,radius_crop)
        --convert Input file from jpg to png, scale it and rotate it
        local imageInput = imlib_load_image(fileIn)
        local out_size = radius*2/(radius_crop/100)
        imlib_context_set_image(imageInput)
        w = imlib_image_get_width();
        h = imlib_image_get_height();
        imlib_image_set_format("png")
        buffer = imlib_create_image(out_size,out_size);
        imlib_context_set_image(buffer);
    
        imlib_blend_image_onto_image(imageInput, 0, 
                                                   0, 0, w, h, 
                                                   0,0, out_size,out_size)
        rot_img=imlib_create_rotated_image(angle*math.pi/180)
        imlib_context_set_image(rot_img)  
        imlib_save_image(fileOut)
        imlib_free_image()
        
        imlib_context_set_image(buffer)
        imlib_free_image()
        imlib_context_set_image(imageInput)
        imlib_free_image()
    end
    
    function crop_square_to_round(filename,xc,yc,radius)
        local surface = cairo_image_surface_create_from_png(filename)
        local img_w = cairo_image_surface_get_width (surface);
        
        local cw,ch = conky_window.width, conky_window.height
        local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, cw,ch)
        local cr=cairo_create(cs)
        cairo_translate(cr,xc-img_w/2,yc-img_w/2)
        cairo_arc (cr, img_w/2,img_w/2, radius, 0, 2*math.pi)
        cairo_clip (cr)
        cairo_new_path (cr)    
        cairo_set_source_surface (cr, surface, 0, 0)
    
        cairo_paint (cr)
        cairo_destroy(cr)
        cairo_surface_destroy (cs)
        cairo_surface_destroy (surface)
        
    end
    
    function display_round(filename,xc,yc,radius,angle,radius_crop,period)
        if conky_window == nil then return end
    
        if tonumber(conky_parse('${updates}')) <2  then return end
        local filepng = filename .. ".png"
        local actual_time  = os.time()
        
        if last_time == nil then last_time=0 end
        local actual_img = io.open(filepng,"r")    
        if  last_time+period < actual_time or last_time == 0 or actual_img == nil then
            print ('convert image ' .. filename)
            convert_square(filename,filepng,radius,angle,radius_crop)
            last_time=actual_time
        end
        crop_square_to_round(filepng,xc,yc,radius)
        io.close()
    end
    
    
    --[[END OF SQUARE TO ROUND WIDGET]]
    
    function conky_main(filename)
        if conky_window == nil then return end
        display_round(filename,
                    275,275,120,  --xc,yc,radius
                    5,            --angle
                    98,              --radius_crop (1-100)
                    3600          --period
                    
        )
    end
    And the conkyrc
    Code:
    # -- Conky settings -- #
    background no
    update_interval 10
    
    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 normal
    own_window_transparent yes
    #own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
    own_window_colour FFFFFF
    own_window_title square to round
    
    border_inner_margin 0
    border_outer_margin 0
    
    minimum_size 450 550
    
    alignment tm
    gap_y 0
    gap_x 0
    
    # -- Graphics settings -- #
    draw_shades no
    draw_outline no
    draw_borders no
    draw_graph_borders no
    
    # -- Text settings -- #
    use_xft yes
    xftfont Santana:size=12
    xftalpha 0
    
    uppercase no
    
    default_color 000000
    text_buffer_size 2048 
    imlib_cache_size 0 
    #--- LUA ---
    lua_load ~/wip/earth/square_to_round.lua 
    #first parameter is the square image to use
    lua_draw_hook_pre main /tmp/earth/earth_image
    
    TEXT
    ${execpi 3600 ~/wip/earth/get_moon_earth.sh earth}
    And if you are inspired, you can get amazing conkys like this one :


    The 3 files are in the attachment.

    Happy conkying
    You don't cease to amaze me with the stuff you are doing with LUA. Keep it up!
    Registered Ubuntu User #29430

  6. #246
    Join Date
    Aug 2009
    Location
    East of Atlantic
    Beans
    81
    Distro
    Ubuntu

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Quote Originally Posted by dmillerct View Post
    You don't cease to amaze me with the stuff you are doing with LUA. Keep it up!
    Thanks dmillerct, and it's a pleasure to see captures around with some of my scripts
    And I didn't start to use conky 1.8.0 ... better setup are coming

  7. #247
    Join Date
    Jun 2008
    Beans
    13
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Great script
    Thanks.


  8. #248
    Join Date
    Nov 2009
    Location
    Bullet Hell
    Beans
    Hidden!

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Too bad I can't use lua scripts

    I can't compile 1.7.2 for debian: http://ubuntuforums.org/showthread.php?t=1441834

  9. #249
    Join Date
    Aug 2009
    Location
    East of Atlantic
    Beans
    81
    Distro
    Ubuntu

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Quote Originally Posted by wannabegeek View Post
    anyone have a suggestion for making {mixer} and {mixerbar} work...
    all I get is a 0 for master volume and an empty bar...

    tia
    wbg
    Hi, do you have ALSA mixer enabled in your conky, type conky -v to check.
    I am compiling version 1.8.0 and ALSA is not enabled by default, so ${mixer} doesn't work anymore ...
    I tried to compile conky with --enabled-alsa but without success, If someone can help

  10. #250
    Join Date
    Aug 2009
    Location
    East of Atlantic
    Beans
    81
    Distro
    Ubuntu

    Re: Conky Support Scripts: Show us your "Scripts" & Screenshots of what they do.

    Quote Originally Posted by Psumi View Post
    Too bad I can't use lua scripts

    I can't compile 1.7.2 for debian: http://ubuntuforums.org/showthread.php?t=1441834
    Did you try last version 1.8.0 :
    http://sourceforge.net/projects/conky/files/conky/
    there are some deb for Ubuntu if you use it :
    https://launchpad.net/~norsetto/+archive/ppa/+packages

    (I didn't test them )

Page 25 of 32 FirstFirst ... 152324252627 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •