Peppermint | Linux OS Community Forum
 
It is currently Sat Aug 24, 2019 7:40 am

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 64 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7
Author Message
 Post subject: Re: Conky scripts
PostPosted: Sat Jul 23, 2011 5:09 am 
Offline
User avatar

Joined: Thu May 20, 2010 8:56 am
Posts: 2132
It's a good question. I've seen those numbers for ages now and just sort of accepted them.

There's an article at Wikipedia about it, as you might imagine.

_________________
Admin


Top
 Profile  
 
 

 Post subject: Re: Conky scripts
PostPosted: Sat Jul 23, 2011 10:33 pm 
Offline

Joined: Sat Jul 23, 2011 2:02 am
Posts: 2
Rich_Roast wrote:
It's a good question. I've seen those numbers for ages now and just sort of accepted them.

There's an article at Wikipedia about it, as you might imagine.


Thank you for the reply.

It had actually never crossed my mind there would be a Wiki article on it.

I read it, not sure I am any closer to understanding it, but still... good info.

Again, thanx,
Have a good one,
geo


Top
 Profile  
 
 Post subject: Re: Conky scripts
PostPosted: Wed Apr 11, 2012 6:12 pm 
Offline
User avatar

Joined: Tue Dec 21, 2010 10:13 pm
Posts: 51
Location: Victoria, Canada
Here's my effort with Conky. I'm fairly new to Conky, so considering that, I don't think it turned out too bad, if I do say so myself.
:)

Image


BTW; the icons "Trash", "Dropbox", "Ubuntu 1" and "PM OS" all open folders with PCManFM

Code:
##############################################
#
#  Peppermint Conky Settings

##############################################
#  Settings
##############################################
background no
use_xft yes
xftfont mono:size=9.5
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_colour 530201
double_buffer yes
minimum_size 200 250
maximum_width 300
border_inner_margin 10
border_width 5
draw_borders yes
draw_graph_borders yes
default_color f1a1a2
alignment top_right
gap_x 35
gap_y 59
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no
##############################################
#  Output
##############################################
TEXT
$alignc PEPPERMINT OS
$alignc $nodename
${hr}
   Time  ${time %H:%M:%S}
# not necessary, but it looks nice
Uptime  $uptime
Battery  $battery_bar
# for some reason battery_bar won't work using parameters nor $alignx commands
${hr}
$alignc File System Use
$alignc $fs_used/$fs_size ($fs_used_perc%)
$alignc ${fs_bar 10,150}
${hr}
$alignc Swap Space Use
$alignc $swap/$swapmax ($swapperc%)
$alignc ${swapbar 10,150}
${hr}
  Memory Use; $memperc%
  $mem / $memmax
$alignc${memgraph 20,140 b00000 f0b000}  ${memgauge 20,40}
${hr}
  CPU Use; ${cpu cpu0}%
$alignc${cpugraph cpu0 20,140 b00000 b000b0}  ${cpugauge cpu0 20,40}
${hr}
F11$alignr Full Screen
Alt+F2$alignr Run Dialog
Ctrl+Alt+Lt$alignr Go Left
Ctrl+Alt+Rt$alignr Go Right
Shft+Alt+Lt$alignr Send Left
Shft+Alt+Rt$alignr Send Right

_________________
~*~ M_Mynaardt ~*~


Top
 Profile  
 
 Post subject: Re: Conky scripts
PostPosted: Sun May 12, 2013 2:19 pm 
Offline

Joined: Fri May 10, 2013 8:40 pm
Posts: 13
This is based on the conky_rings by musieca.

Image

Made it just to have someting on my 1024x600 desktop. Will keep working at it.

Conky:
Code:
# — Conky settings — #
#background yes
update_interval 1

cpu_avg_samples 2
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 900
imlib_cache_size 0

# — Window specifications — #

own_window yes
#own_window_type override#
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

border_inner_margin 0
border_outer_margin 0

minimum_size 400 550
maximum_width 550

alignment top_right
gap_x 17
gap_y 15

# — Graphics settings — #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# — Text settings — #
use_xft yes
xftfont Droid Sans:size=10
xftalpha 0.5

uppercase no

default_color 3E3E3E
color1 D23000

# — Lua Load — #
lua_load ~/.conky/brush_rings.lua
lua_draw_hook_pre clock_rings

TEXT
${voffset 19}${color 3399FF}${font Droid Sans:size=18}${time %A}${font}
${color FFFFFF}${voffset -5}${color 3399FF}${font Droid Sans:size=18}${time %b}${font}${alignr 50}${color 3399FF}${voffset -32}${font Droid Sans:size=30}${time %e}${font}
${color #FF0000}${hr}
${voffset 2}${font Droid Sans:size=12}${color #FF0000}${alignr}${acpitemp}°C${font}
${voffset -22}Uptime:${color #FF0000}$uptime_short
${color #FF0000}${goto 87}${voffset 30}${cpu cpu0}%
${color 3399FF}${goto 87}CPU
${color #FF0000}${goto 277}${voffset -40}${memperc}%
${color 3399FF}${goto 277}RAM
${color #FF0000}${goto 130}${voffset 15}${upspeed eth1}
${color #FF0000}${goto 130}${voffset 0}${downspeed eth1}
${color 3399FF}${goto 120}${color 3399FF}Total up:${color #FF0000}${totalup eth1}
${color 3399FF}${goto 120}${color 3399FF}Total Down:${color #FF0000}${totaldown eth1}

#       ${voffset 5}${color}${font Droid Sans:size=17}&${font}${color slate grey} MusicPlayer:
#       ${color e0e0e0}${font Droid Sans:size=9}${exec rhythmbox-client --no-start --print-playing-format %tt} -
#       ${exec rhythmbox-client --no-start --print-playing-format %aa}  ${color adadad}#${font Droid Sans:size=8}


Lua script:
Code:
--[[
Clock Rings by londonali1010 (2009) , mod by arpinux

This script draws percentage meters as rings, and also draws clock hands if you want! It is fully customisable; all options are described in the script. This script is based off a combination of my clock.lua script and my rings.lua script.

IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 145 uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num>5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num>3; conversely if you update Conky every 0.5s, you should use update_num>10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.

To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
    lua_load ~/scripts/clock_rings.lua
    lua_draw_hook_pre clock_rings
   
Changelog:
+ v1.0 -- Original release (30.09.2009)
]]

settings_table = {
    {
            name='time',
            arg='%I',
            max=12,
            bg_colour=0xF90101,
            bg_alpha=0.9,
            fg_colour=0x3399cc,
            fg_alpha=1,
            x=200, y=90,
            radius=40,
            thickness=5,
            start_angle=0,
            end_angle=360
        },
    {
            name='time',
            arg='%M',
            max=60,
            bg_colour=0xF90101,
            bg_alpha=0.9,
            fg_colour=0x3399cc,
            fg_alpha=1,
            x=200, y=90,
            radius=46,
            thickness=5,
            start_angle=0,
            end_angle=360
        },
        {
            name='time',
            arg='%S',
            max=60,
            bg_colour=0xF90101,
            bg_alpha=0.9,
            fg_colour=0x3399cc,
            fg_alpha=1,
            x=200, y=90,
            radius=52,
            thickness=5,
            start_angle=0,
            end_angle=360
        },
    {
            name='cpu',
            arg='cpu0',
            max=100,
            bg_colour=0xffffff,
            bg_alpha=0.2,
            fg_colour=0xffff00,
            fg_alpha=0.4,
            x=105, y=160,
            radius=25,
            thickness=5,
            start_angle=-90,
            end_angle=90
           
},
    {
            name='memperc',
            arg='',
            max=100,
            bg_colour=0xffffff,
            bg_alpha=0.2,
            fg_colour=0x33ccff,
            fg_alpha=0.8,
            x=295, y=160,
            radius=25,
            thickness=5,
            start_angle=-90,
            end_angle=90
    },
    {
            name='upspeedf',
            arg='eth1',
            max=100,
            bg_colour=0xffffff,
            bg_alpha=0.2,
            fg_colour=0xffff33,
            fg_alpha=0.3,
            x=200, y=200,
            radius=25,
            thickness=4,
            start_angle=-90,
            end_angle=180
    },
    {
            name='downspeedf',
            arg='eth1',
            max=100,
            bg_colour=0xffffff,
            bg_alpha=0.2,
            fg_colour=0xffff44,
            fg_alpha=0.3,
            x=200, y=200,
            radius=20,
            thickness=4,
            start_angle=-90,
            end_angle=180
    },
}

-- Use these settings to define the origin and extent of your clock.

clock_r=65

-- "clock_x" and "clock_y" are the coordinates of the centre of the clock, in pixels, from the top left of the Conky window.

clock_x=200
clock_y=90

show_seconds=true

require 'cairo'

function rgb_to_r_g_b(colour,alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function draw_ring(cr,t,pt)
    local w,h=conky_window.width,conky_window.height
   
    local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
    local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']

    local angle_0=sa*(2*math.pi/360)-math.pi/2
    local angle_f=ea*(2*math.pi/360)-math.pi/2
    local t_arc=t*(angle_f-angle_0)

    -- Draw background ring

    cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
    cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
    cairo_set_line_width(cr,ring_w)
    cairo_stroke(cr)
   
    -- Draw indicator ring

    cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
    cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
    cairo_stroke(cr)       
end

function draw_clock_hands(cr,xc,yc)
    local secs,mins,hours,secs_arc,mins_arc,hours_arc
    local xh,yh,xm,ym,xs,ys
   
    secs=os.date("%S")   
    mins=os.date("%M")
    hours=os.date("%I")
       
    secs_arc=(2*math.pi/60)*secs
    mins_arc=(2*math.pi/60)*mins+secs_arc/60
    hours_arc=(2*math.pi/12)*hours+mins_arc/12
       
    -- Draw hour hand
   
    xh=xc+0.7*clock_r*math.sin(hours_arc)
    yh=yc-0.7*clock_r*math.cos(hours_arc)
    cairo_move_to(cr,xc,yc)
    cairo_line_to(cr,xh,yh)
   
    cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
    cairo_set_line_width(cr,5)
    cairo_set_source_rgba(cr,0.2,0.6,1,0.4)
    cairo_stroke(cr)
   
    -- Draw minute hand
   
    xm=xc+clock_r*math.sin(mins_arc)
    ym=yc-clock_r*math.cos(mins_arc)
    cairo_move_to(cr,xc,yc)
    cairo_line_to(cr,xm,ym)
   
    cairo_set_line_width(cr,3)
    cairo_stroke(cr)
   
    -- Draw seconds hand
   
    if show_seconds then
        xs=xc+clock_r*math.sin(secs_arc)
        ys=yc-clock_r*math.cos(secs_arc)
        cairo_move_to(cr,xc,yc)
        cairo_line_to(cr,xs,ys)
   
        cairo_set_line_width(cr,1)
        cairo_stroke(cr)
    end
end

function conky_clock_rings()
    local function setup_rings(cr,pt)
        local str=''
        local value=0
       
        str=string.format('${%s %s}',pt['name'],pt['arg'])
        str=conky_parse(str)
       
        value=tonumber(str)
        pct=value/pt['max']
       
        draw_ring(cr,pct,pt)
    end
   
    -- Check that Conky has been running for at least 5s

    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 updates=conky_parse('${updates}')
    update_num=tonumber(updates)
   
    if update_num>5 then
        for i in pairs(settings_table) do
            setup_rings(cr,settings_table[i])
        end
    end
   
    draw_clock_hands(cr,clock_x,clock_y)
end


Edited it a bit, more simpler and blended into a wallpaper:Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 64 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

Powered by php B.B. © 2000, 2002, 2005, 2007 php B.B. Group
Template made by DEVPPL