Random Homebrew: Sony Remote
Friends: Coding 'n Cracking - Nymphaea - PS3 Forum - darkforestgroup - daxhordes.org - Tgames - coldbird - gopsp.it - pspstation.org - prometheus - hgoel.info - MakeSmartTV - ps vita

your desktop look

Everything related to computers that doesn't go in other categories

Re: your desktop look

Postby codestation » Thu Jun 28, 2012 5:20 am

m0skit0 wrote:And I have to say that, contrary to most people, I do like GNOME3.

Wow, do you people really exist :shock:

Mine:
Spoiler
Image
Plugin list
Working on: Python (django, sqlalchemy, PyQt, etc) + Lua
Repositories: github, bitbucket, google code
Just feel the code..
opencma/vitamtp for Archlinux
User avatar
codestation
Big Beholder
 
Posts: 1277
Joined: Wed Jan 19, 2011 3:45 pm
Location: /dev/negi

Re: your desktop look

Postby m0skit0 » Thu Jun 28, 2012 10:15 am

codestation wrote:Wow, do you people really exist :shock:

LMAO :lol: Any complaints about GNOME3? I've read a lot of them and most are just wrong. People complain about stuff missing that is not. People complain about new stuff, well just don't use it. Other complaints are plain childish (like "it looks like my phone" thingy).

Also FYI I cannot stand KDE. I think we're made for each other.
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
User avatar
m0skit0
Guru
 
Posts: 4785
Joined: Mon Sep 27, 2010 6:01 pm

Re: your desktop look

Postby asgard20032 » Thu Jun 28, 2012 1:55 pm

codestation wrote:
m0skit0 wrote:And I have to say that, contrary to most people, I do like GNOME3.

Wow, do you people really exist :shock:

Mine:
Spoiler
Image


Cool, you KDE look so much like windows 7... I know that KDE is used in most Linux distribution that try to feel easy for windows user, like PC LinuxOS, but normally, it don't achieve such result. The transparency on the bottom toolbar is just... so like windows 7.
Image
asgard20032
 
Posts: 259
Joined: Thu Jan 20, 2011 1:16 pm
Location: Milky Way, Solar system, Earth, North America, Canada, Québec..... In front of my computer

Re: your desktop look

Postby asgard20032 » Thu Jun 28, 2012 2:04 pm

asgard20032 wrote:
codestation wrote:
m0skit0 wrote:And I have to say that, contrary to most people, I do like GNOME3.

Wow, do you people really exist :shock:

Mine:
Spoiler
Image


Cool, you KDE look so much like windows 7... I know that KDE is used in most Linux distribution that try to feel easy for windows user, like PC LinuxOS, but normally, it don't achieve such result. The transparency on the bottom toolbar is just... so like windows 7.


m0skit0 wrote:
codestation wrote:Wow, do you people really exist :shock:

LMAO :lol: Any complaints about GNOME3? I've read a lot of them and most are just wrong. People complain about stuff missing that is not. People complain about new stuff, well just don't use it. Other complaints are plain childish (like "it looks like my phone" thingy).

Also FYI I cannot stand KDE. I think we're made for each other.


Actually, yes people like that exist. I am maybe even one of those people. Didn't had the chance to try gnome 3, but already passed by gnome 2 and unity. I didnt liked unity, but i didn't hated it. It was OK, as long as it gave us, the user, the choice, without having to install additional software... Its so boring when we have to wait for the download to finish to get what we want. I am the type who will sometime use Unity, and sometime gnome.

So we are people that are not afraid of change. But some of people that are not affraid of change still have some limit, so no major change like completely switching desktop from gnome to KDE, like moskito.(or maybe that is just that moskito tried, but really hated it, and its not the fact that he dont like such major change, but just the fact he can endure KDE.)

But for me, it don't bother me to completely change desktop, as long as it is either KDE or gnome. I don't want to try XFCE or other desktop, that are not considered as the most used one. I mean that yes it is used, but not by the big part of of GNU/Linux user. So less support, and less elaborated. And with the resource of my system, don't need a low resource desktop.

Even if moskito hate windows, i think he liked the change from XP->7, but not the vista step.
Image
asgard20032
 
Posts: 259
Joined: Thu Jan 20, 2011 1:16 pm
Location: Milky Way, Solar system, Earth, North America, Canada, Québec..... In front of my computer

Re: your desktop look

Postby m0skit0 » Thu Jun 28, 2012 2:42 pm

asgard20032 wrote:Cool, you KDE look so much like windows 7... I know that KDE is used in most Linux distribution that try to feel easy for windows user, like PC LinuxOS, but normally, it don't achieve such result. The transparency on the bottom toolbar is just... so like windows 7.

You probably meant Windows 7 looks like KDE, since KDE has this look since the very first versions. In fact I remember when first looking at W7 saying "LMAO they copied KDE style". Here a screenshot from KDE 2:

Spoiler
Image

(Damn, this screenshot must be from RH6 or 7... ahhhh ol' memories xD) Of course it doesn't have all the new fancy effects, but machines back then couldn't handle that

asgard20032 wrote:Didn't had the chance to try gnome 3, but already passed by gnome 2 and unity.

GNOME3 is more like Unity than GNOME2, but IMHO it's better than Unity.

asgard20032 wrote: so no major change like completely switching desktop from gnome to KDE, like moskito.(or maybe that is just that moskito tried, but really hated it, and its not the fact that he dont like such major change, but just the fact he can endure KDE.)

Actually KDE and GNOME2 are pretty much the same thing. What I don't like about KDE is that "Windows-taskbar-feeling". Just feels too much like Windows :lol:

asgard20032 wrote:I don't want to try XFCE or other desktop, that are not considered as the most used one.

I personally don't like that kind of thinking. If so you shouldn't even try Linux because it's not the most used OS. One lesson in learned in life and can be applied to anything: quantity means nothing. I suggest you trying Xfce, Enlightenment, WMaker... They're worth trying, and since some have totally different concepts, you might even found some interesting. WMaker for example was already introducing modern desktop concepts (Metro, Unity, Gnome3...) like 10 years ago. I used it quite a bit, and found it pretty nice, comfortable and much faster than KDE/Gnome back then on my Pentium II.

asgard20032 wrote:Even if moskito hate windows, i think he liked the change from XP->7, but not the vista step.

"Hate" is a big word. It's not that I hate it, it just sucks per se. Doesn't need me to hate to suck :lol: And I didn't use either Vista or 7, so I actually can't tell. Anyway, why would I use Windows 7? All I know is that my laptop @ work had Windows 7, and it was close to impossible to work with it (i5 2.6 GHz, 4 GiB RAM). I asked if I could install Linux and got go-ahead. Ubuntu 12.04 with GNOME3 runs like 10 times faster. No lag, no slowdowns, nothing. Eclipse starts as a breeze. Gnome3 is very resposive: switching desktops, windows without noticing. Boots like 50 times faster than W7. Shutdown is even faster. Really, for developing, I don't want to use Windows anymore ever.
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
User avatar
m0skit0
Guru
 
Posts: 4785
Joined: Mon Sep 27, 2010 6:01 pm

Re: your desktop look

Postby FrEdDy » Fri Jun 29, 2012 9:12 pm

Keep it simple, yo.

Spoiler
Image


(image is actually cut by the forum, why don't you guys just resize?)

@codestation: how did you get conky transparency on KDE? Did you use feh?
https://github.com/freddy-156
<@n00b81> FREDDY CUTTIES
User avatar
FrEdDy
HBL Collaborator
 
Posts: 349
Joined: Mon Sep 27, 2010 7:08 pm

Re: your desktop look

Postby codestation » Fri Jun 29, 2012 9:46 pm

FrEdDy wrote:(image is actually cut by the forum, why don't you guys just resize?)

I know, just forgot to make a thumbnail, deal with it 8-)

FrEdDy wrote:@codestation: how did you get conky transparency on KDE? Did you use feh?


I have this in my conkyrc:
Code: Select all
own_window yes
own_window_type normal
own_window_argb_visual yes
own_window_argb_value 10
own_window_transparent yes

This only works if the desktop effects are enabled. Since plasma doesn't crash anymore i can leave them enabled without issues, no need for feh.
Plugin list
Working on: Python (django, sqlalchemy, PyQt, etc) + Lua
Repositories: github, bitbucket, google code
Just feel the code..
opencma/vitamtp for Archlinux
User avatar
codestation
Big Beholder
 
Posts: 1277
Joined: Wed Jan 19, 2011 3:45 pm
Location: /dev/negi

Re: your desktop look

Postby Xian Nox » Fri Jun 29, 2012 10:18 pm

@codestation: Can you post your entire conky configuration, please?
Spoiler
Disturbed0ne wrote:PS. EVERYONE should like girls. they're just so soft. :oops:
Moderator 80% corrupt. That's funny, I don't feel corrupt. In fact, I feel pretty good.
What looks like a blog of mine can be seen here.
User avatar
Xian Nox
Moderator
 
Posts: 6033
Joined: Fri Nov 05, 2010 5:27 pm
Location: /home/xian/n-field

Re: your desktop look

Postby codestation » Fri Jun 29, 2012 11:10 pm

conkyrc:

Code: Select all
background yes
use_xft yes
#xftfont Bitstream Vera Sans Mono:size=9:bold
xftfont Bitstream Vera Sans Mono:size=9
xftalpha 1.0
text_buffer_size 2048

update_interval 1
total_run_times 0

own_window_class Conky
own_window yes
#own_window_type override
own_window_type normal
own_window_argb_visual yes
own_window_argb_value 10
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_colour 262523

double_buffer yes

draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
#border_margin 5
border_width 1
minimum_size 325 490
#minimum_size 1280 120
maximum_width 1280
default_color black
default_shade_color 000000
default_outline_color 000000
alignment top_left
#gap_x 38
gap_x 20
gap_y 6
no_buffers yes
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
uppercase no
use_spacer right
default_color black
top_name_width 13
if_up_strictness address
lua_load ~/.scripts/master.lua
lua_draw_hook_pre conky_main

TEXT




It's empty :P . The magic comes from this:

Code: Select all
require 'cairo'

settings_rings = {
   {
      name="fs_used_perc",
      arg="/",
      max=100,
      xc=50,
      yc=340,
      thickness=8,
      radius=35,
      sectors=20,
      start_angle=-120,
      end_angle=120,
      background=true,
      bg_colour1={{0,0X111111,1},{0.5,0x111111,1}, {1,0x888888,1}},
       bg_colour2={{0,0X999999,1},{0.5,0x888888,1}, {1,0x111111,1}},
       fg_colour1={{0,0XFF4500,1},{0.5,0xFF4500,1}, {1,0xFFFFFF,1}},
       fg_colour2={{0,0XFFFFFF,1},{0.5,0xFFFFFF,1}, {1,0xFF4500,1}},
   },
   {
      name="fs_used_perc",
      arg="/home",
      max=100,
      xc=147,
      yc=340,
      thickness=8,
      radius=35,
      sectors=20,
      start_angle=-120,
      end_angle=120,
      background=true,
      bg_colour1={{0,0X111111,1},{0.5,0x111111,1}, {1,0x888888,1}},
       bg_colour2={{0,0X999999,1},{0.5,0x888888,1}, {1,0x111111,1}},
       fg_colour1={{0,0XFF4500,1},{0.5,0xFF4500,1}, {1,0xFFFFFF,1}},
       fg_colour2={{0,0XFFFFFF,1},{0.5,0xFFFFFF,1}, {1,0xFF4500,1}},
   },
   {
      name="fs_used_perc",
      arg="/mnt/data",
      max=100,
      xc=260,
      yc=340,
      thickness=8,
      radius=35,
      sectors=20,
      start_angle=-120,
      end_angle=120,
      background=true,
      bg_colour1={{0,0X111111,1},{0.5,0x111111,1}, {1,0x888888,1}},
       bg_colour2={{0,0X999999,1},{0.5,0x888888,1}, {1,0x111111,1}},
       fg_colour1={{0,0XFF4500,1},{0.5,0xFF4500,1}, {1,0xFFFFFF,1}},
       fg_colour2={{0,0XFFFFFF,1},{0.5,0xFFFFFF,1}, {1,0xFF4500,1}},
   },
}

offset_global = {
   offset_x=0, offset_y=0,
}

settings_rings_global = {
   max=100,
   bg_colour=0x808080,
   bg_alpha=0.2,
   fg_colour=0x2273b6,
   fg_alpha=0.8,
   radius=32,
   thickness=7,
   start_angle=-110,
   end_angle=110,
}

settings_bars_global = {
   arg='',
   max=100,
   width = 320,
   height = 16,
   borderColor = 0x888888,
   borderAlpha = 0.9,
   border_width=1.0,
   fillColor = 0x151515,
   --fillColorTo = 0x2273b6,
   fillColorTo = 0x43a6b9,
   fillAlpha = 0.9,
   bg_color=0x2273b6,
   bg_alpha=0.3,
   warn = 0xffff00,
   danger = 0xff0000,
}

settings_strings_global = {
   name=nil,
   arg='',
   font='Bitstream Vera Sans Mono',
   size=11,
   color=0,
   color=0xffffff,
   alpha=0.8,
   bold=nil,
   align='none',
   exec_delay=30,
   --local_width=300,
   local_width=300,
   trim=0,
}

settings_graphs_global = {
   arg='',
   samples=100,
   line_width=2,
   max_value=100,
   r=8,
   bg_color=0x000000,
   bg_alpha=0.5,
   padding=8,
   rules = { 30, 60, 90 },
   rule_color=0xffffff,
   rule_alpha=0.4,
   rule_width=0.5,
}

settings_graph_lines_global = {
   fg_color=0xC84545,
   bg_color=0xC84545,
   fg_alpha=0.75,
   bg_alpha=0.38,
}

settings_rectangles_global = {
   r=5,
   color=0x000000,
   alpha=0.2,
}

settings_graph_init=false

settings_blocks = {
   -- CPU Graph
   {
      --offset_x=0, offset_y=-20,
      settings_strings = {
         { name='exec', arg='nc localhost 7634 | cut -d"|" -f4',
           format='HDD Temp: %sºC', x=-15, y=78, align='right',
           exec_delay=300, last_exec=nil, delay_count=0, },

         { name='hwmon', arg='0 temp 1', format='CPU Temp.: %sºC', x=10, y=78, },

         { format='80%', size=9, alpha=0.5, x=12, y=106, },
         { format='60%', size=9, alpha=0.5, x=12, y=118, },
         { format='40%', size=9, alpha=0.5, x=12, y=132, },
         { format='20%', size=9, alpha=0.5, x=12, y=146, },
         { format='0%',  size=9,   alpha=0.5, x=12, y=158, },

         { name='freq_g', format='Freq: %sGHz', alpha=0.8, x=0, y=158, align='center', },
         { name='exec', arg='/home/code/.bin/watts',
           format='Power: %s Watts', alpha=0.8, x=0, y=105, align='center',
           exec_delay=3, last_exec=nil, delay_count=0, },
      },
      settings_graphs = {
         {
            graph_lines = {
               { name='cpu', arg='cpu0', vector={}, fg_color=0xC84545, bg_color=0xC84545, },
            },
            index=1, gx=0, gy=0, gw=0, gh=0,
            x=2, y=88, w=320, h=80, rules = { 20, 40, 60, 80, 100},
         },
      },
   },
   -- Disk Usage
   {
      --offset_x=0, offset_y=0,
      settings_strings = {
         { format='root', x=35,  y=332, },
         { format='home', x=0, y=332, align='center',  },
         { format='data', x=25, y=332, align='right', },

         { name='fs_free', arg='/',         format='%s', x=25,  y=347, },
         { name='fs_free', arg='/home',     format='%s', x=0,  y=347, align='center',  },
         { name='fs_free', arg='/mnt/data', format='%s', x=14, y=347, align='right', },
      },
      --settings_rings = {
         --{ name='fs_used_perc', arg='/',           x=40,  y=355, },
         --{ name='fs_used_perc', arg='/home',       x=115, y=355, },
         --{ name='fs_used_perc', arg='/mnt/data', x=190, y=355, },
      --},
   },
   -- Memory bars
   {
      --offset_x=0, offset_y=0,
      settings_strings = {
         { format='RAM', size=12, alpha=1, x=8, y=190 },
         { name='mem',     format='%s /',   size=12, alpha=1, x=125, y=190, align='right', },
         { name='memmax',  format='%s',     size=12, alpha=1, x=66,  y=190, align='right', },
         { name='memperc', format='(%s%%)', size=12, alpha=1, x=8,  y=190, align='right', },

         { format='SWAP', size=12, alpha=1, x=8, y=222, },
         { name='swap',     format='%s /',   size=12, alpha=1, x=125, y=222, align='right', },
         { name='swapmax',  format='%s',     size=12, alpha=1, x=66,  y=222, align='right', },
         { name='swapperc', format='(%s%%)', size=12, alpha=1, x=8,  y=222, align='right', },
      },
      settings_bars = {
         { name='memperc', x = 2, y = 178, },
         { name='swapperc',x = 2, y = 210, },
      },
   },
   -- Network info
   {
      --offset_x=0, offset_y=0,
      settings_strings = {
         { name='addr', arg='wlan0', opt_arg='eth0',
         --format='Host: %s',
            format='Host: ${if_up %s}${%s %s}${else}${%s %s}${endif}',
           x=2, y=377, },
         { name='gw_ip', format='Gateway: %s', x=-15, y=377, align='right', },
         { name='wireless_essid', arg='wlan0', opt_arg='',
         --format='ESSID: [%s]',
           format='ESSID: ${if_up %s}[${%s %s}]${else}${if_up eth0}(using eth0)${else}(offline)${endif}${endif}',
           x=2, y=392, },
         { name='wireless_link_qual_perc', arg='wlan0', opt_arg='',
         --format='Quality: %s%%',
           format='Quality: ${if_up %s}${%s %s}%%${else}${if_up eth0}(using eth0)${else}(offline)${endif}${endif}',
           x=-15, y=392, align='right', },
         { name='downspeed', arg='wlan0', opt_arg='eth0',
         --format='D: %s/s',
           format='D: ${if_up %s}${%s %s}${else}${%s %s}${endif}/s',
           x=12, y=412, },
         { name='upspeed', arg='wlan0', opt_arg='eth0',
         --format='U: %s/s',
           format='U: ${if_up %s}${%s %s}${else}${%s %s}${endif}/s',
           alpha=0.8, x=12, y=425, },
         { name='totaldown', arg='wlan0', opt_arg='eth0',
         --format='Total: %s',
           format='Total: ${if_up %s}${%s %s}${else}${%s %s}${endif}', font='Verdana',
           alpha=0.8, x=230, y=412, },
         { name='totalup', arg='wlan0', opt_arg='eth0',
         --format='Total: %s',
           format='Total: ${if_up %s}${%s %s}${else}${%s %s}${endif}', font='Verdana',
           alpha=0.8, x=230, y=425, },
      },
      settings_graphs = {
         {
            graph_lines = {
               { name='upspeedf',   arg='wlan0', opt_arg='eth0', opt_cond='if_up',
                 --vector={}, fg_color=0xc8c8c8, bg_color=0xc8c8c8, },
                 vector={}, fg_color=0xc6dd82, bg_color=0xc6dd82, },
               { name='downspeedf', arg='wlan0', opt_arg='eth0', opt_cond='if_up',
                 --vector={}, fg_color=0xa8c859, bg_color=0xa8c859, },
                 vector={}, fg_color=0x58adc1, bg_color=0x58adc1, },
            },
            index=1, gx=0, gy=0, gw=0, gh=0,
            x=2, y=398, w=320, h=80, rules = { 30, 60, 90, 120, 150 }, rule_alpha=0.4,max_value=150,
         },
      },
   },
   -- Computer info
   {
      --offset_x=0, offset_y=0,
      settings_strings = {
         { name='nodename', format='Hostname: %s', x=0, y=16, align='center', },
         { name='kernel',   format='Kernel: %s',   x=0, y=30, align='center', },
         --{ name='uptime',   format='Uptime: %s',   x=420, y=16,},-- align='center',},
         --{ name='nodename', format='Hostname: %s', x=40, y=16, align='left', },
         --{ name='kernel',   format='Kernel: %s',   x=40, y=30, align='left', },
         { name='uptime',   format='Uptime: %s',   x=0, y=46, align='center',},

         --{ name='exec', arg='date -d "`stat /var/lib/pacman/*db.tar* --format %y | sort | tail -n 1`"',
         --  format='Last s'ync: %s', x=-5, y=64, align='center',
         --  exec_delay=60, last_exec=nil, delay_count=0, },

         { name='exec', arg='date -d "`cat /usr/portage/metadata/timestamp.chk`"',
         format='Last sync: %s', x=-10, y=62, align='center',
      --   format='Last sync: %s', x=280, y=30, align='left',
         exec_delay=60, last_exec=nil, delay_count=0, },

         --{ name='exec', arg='currentmerge',
         --format='Current merge: %s', x=0, y=60, align='center',
         --exec_delay=30, last_exec=nil, delay_count=0, },

      --   { format='_____________________________________________________________________________________', x=-30,  y=31, },
      },
   },
   -- TOP Info
   {
      --offset_x=0, offset_y=0,
      settings_strings = {
         { format='Process list:   CPU%', x=4, y=246},
         { format='MEM%', x=-20, y=246, align='right', },
         { name='top',     arg='name 1', format='%s',   x=4,   y=262, },
         { name='top',     arg='cpu 1',  format='%s |', x=100, y=262, },
         { name='top_mem', arg='name 1',   format='%s',   x=156, y=262, },
         { name='top_mem', arg='mem_res 1',  format='%s',   x=-20,   y=262, align='right', trim=1 },
         { name='top',     arg='name 2', format='%s',   x=4,   y=278, },
         { name='top',     arg='cpu 2',  format='%s |', x=100, y=278, },
         { name='top_mem', arg='name 2', format='%s',   x=156, y=278, },
         { name='top_mem', arg='mem_res 2',  format='%s',   x=-20,   y=278, align='right', trim=1 },
         { name='top',     arg='name 3', format='%s',   x=4,   y=294, },
         { name='top',     arg='cpu 3',  format='%s |', x=100, y=294, },
         { name='top_mem', arg='name 3', format='%s',   x=156, y=294, },
         { name='top_mem', arg='mem_res 3', format='%s',    x=-20,   y=294, align='right', trim=1 },
      },
   },
}

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

function def(mod, orig, obj)
   return mod[obj] and mod[obj] or orig[obj]
end

function draw_ring(cr, pt, blk)
   local gl = settings_rings_global
   local w,h=conky_window.width,conky_window.height
   local xc,yc,ring_r,ring_w,sa,ea=def(pt,gl,'x')+def(blk,offset_global,'offset_x'),def(pt,gl,'y')+def(blk,offset_global,'offset_y'),def(pt,gl,'radius'),def(pt,gl,'thickness'),def(pt,gl,'start_angle'),def(pt,gl,'end_angle')
   local bgc, bga, fgc, fga=def(pt,gl,'bg_colour'), def(pt,gl,'bg_alpha'), def(pt,gl,'fg_colour'), def(pt,gl,'fg_alpha')

   local value = tonumber(conky_parse(string.format('${%s %s}',def(pt,gl,'name'),def(pt,gl,'arg'))))
   if ( value == nil ) then value = 0 end
   local pct = value / def(pt,gl,'max')

   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=pct*(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_bar(cr, pt, blk)
   local gl = settings_bars_global
   cairo_set_source_rgba (cr, rgb_to_r_g_b(def(pt,gl,'borderColor'),def(pt,gl,'borderAlpha')))
   cairo_set_line_width (cr, def(pt,gl,'border_width'))
   cairo_rectangle (cr, def(pt,gl,'x')+def(blk,offset_global,'offset_x'), def(pt,gl,'y')+def(blk,offset_global,'offset_y'), def(pt,gl,'width'), def(pt,gl,'height'))
   cairo_stroke (cr)

   cairo_set_source_rgba (cr, rgb_to_r_g_b(def(pt,gl,'bg_color'),def(pt,gl,'bg_alpha')))
   cairo_rectangle (cr, def(pt,gl,'x')+1+def(blk,offset_global,'offset_x'), def(pt,gl,'y')+1+def(blk,offset_global,'offset_y'), def(pt,gl,'width')-2, def(pt,gl,'height')-2)
    cairo_fill(cr)

   local value = tonumber(conky_parse(string.format('${%s %s}',def(pt,gl,'name'),def(pt,gl,'arg'))))
   if ( value == nil ) then value = 0 end
   local pct = value / def(pt,gl,'max')

   cairo_rectangle (cr, def(pt,gl,'x') + 1+def(blk,offset_global,'offset_x'), def(pt,gl,'y') + 1+def(blk,offset_global,'offset_y'), (def(pt,gl,'width') - 2) *pct, def(pt,gl,'height') - 2)
   local pat = cairo_pattern_create_linear (def(pt,gl,'x')+def(blk,offset_global,'offset_x') + (def(pt,gl,'width') * pct), def(pt,gl,'y')+def(blk,offset_global,'offset_y'), (def(pt,gl,'x')+def(blk,offset_global,'offset_x')) - (def(pt,gl,'width') * (pct)), def(pt,gl,'y')+def(blk,offset_global,'offset_y'))
   cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(def(pt,gl,'fillColor'), def(pt,gl,'fillAlpha')))
   if pct < .5 then
      cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(def(pt,gl,'fillColorTo'), def(pt,gl,'fillAlpha')))
   elseif pct >= .5 and pct < .8 then
      cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(def(pt,gl,'warn'), def(pt,gl,'fillAlpha')))
   elseif pct >= .8 then
      cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(def(pt,gl,'danger'), def(pt,gl,'fillAlpha')))
   end
   cairo_pattern_add_color_stop_rgba (pat, .3, rgb_to_r_g_b(def(pt,gl,'fillColorTo'), def(pt,gl,'fillAlpha')))
   cairo_set_source (cr, pat)
   cairo_fill (cr)
   cairo_pattern_destroy (pat)
end

function trim(s)
   local from = s:match"^%s*()"
   return from > #s and "" or s:match(".*%S", from)
end

function string_pixelsize_trim(cr, str)
   local extents = cairo_text_extents_t:create()
   tolua.takeownership(extents)
   cairo_text_extents(cr, str, extents)
   return extents.width
end

function string_pixelsize(cr, str)
   local extents = cairo_text_extents_t:create()
   tolua.takeownership(extents)
   cairo_text_extents(cr, str, extents)
   return extents.x_advance
end

function draw_string(cr,pt,blk)
   local gl = settings_strings_global
   if settings_strings_global.bold ~= nil then
      cairo_select_font_face(cr, def(pt,gl,'font'), CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD)
   else
      cairo_select_font_face(cr, def(pt,gl,'font'), CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
   end
   cairo_set_font_size(cr, def(pt,gl,'size'))
   if settings_strings_global.color ~= nil then
      cairo_set_source_rgba(cr, rgb_to_r_g_b(settings_strings_global.color, def(pt,gl,'alpha')))
   else
      cairo_set_source_rgba(cr, rgb_to_r_g_b(def(pt,gl,'color'), def(pt,gl,'alpha')))
   end
   local str = ''
   --if pt['type'] == 'net' then
   --   print(conky_parse(def(pt,gl,'name')))
   --end
   if def(pt,gl,'name') ~= nil then
      if def(pt,gl,'name') == 'exec' then
         if pt.delay_count == 0 then
            pt.last_exec = conky_parse(string.format(def(pt,gl,'format'), string.format('${%s %s}', def(pt,gl,'name'), def(pt,gl,'arg'))))
         end
         str = def(pt,gl,'last_exec')
         if pt.delay_count < def(pt,gl,'exec_delay') then
            pt.delay_count = pt.delay_count + 1
         else
            pt.delay_count = 0
         end
      else
         if pt['opt_arg'] == nil then
            str = conky_parse(string.format(def(pt,gl,'format'), string.format('${%s %s}', def(pt,gl,'name'), def(pt,gl,'arg'))))
         else
            if def(pt,gl,'opt_arg') ~= '' then
               str = conky_parse(string.format(def(pt,gl,'format'), def(pt,gl,'arg'), def(pt,gl,'name'), def(pt,gl,'arg'), def(pt,gl,'name'), def(pt,gl,'opt_arg')))
            else
               str = conky_parse(string.format(def(pt,gl,'format'), def(pt,gl,'arg'), def(pt,gl,'name'), def(pt,gl,'arg'), def(pt,gl,'opt_arg')))
            end
         end
      end
   else
      str = def(pt,gl,'format')
   end
   if def(pt,gl,'trim') == 1 then
      str = trim(str)
   end
   local width = gl.local_width ~= nil and gl.local_width or conky_window.width
   if def(pt,gl,'align') == 'right' then
      cairo_move_to(cr, width - ((string_pixelsize(cr, str) + def(pt,gl,'x')-def(blk,offset_global,'offset_x'))), def(pt,gl,'y')+def(blk,offset_global,'offset_y'))
   elseif def(pt,gl,'align') == 'center' then
      cairo_move_to(cr, def(blk,offset_global,'offset_x')+(width/2) - ((string_pixelsize(cr, str) + def(pt,gl,'x'))/2), def(pt,gl,'y')+def(blk,offset_global,'offset_y'))
   else
      cairo_move_to(cr, def(pt,gl,'x')+def(blk,offset_global,'offset_x'), def(pt,gl,'y')+def(blk,offset_global,'offset_y'))
   end
   cairo_show_text(cr, str)
   cairo_stroke(cr)
end

function init_graph(pt)
   local gl = settings_graphs_global
   pt.gx = def(pt,gl,'x')+def(pt,gl,'padding')
   pt.gy = def(pt,gl,'y')+def(pt,gl,'h')-def(pt,gl,'padding')
   pt.gw = def(pt,gl,'w')-2*def(pt,gl,'padding')
   pt.gh = def(pt,gl,'h')-2*def(pt,gl,'padding')
   for i in pairs(pt.graph_lines) do
      for j=1, def(pt,gl,'samples'), 1 do
         pt.graph_lines[i].vector[j] = 0
      end
   end
end

function rounded_rectangle(cr, x1, y1, x2, y2, r)
   cairo_move_to(cr, x2-r, y1)
   cairo_arc(cr, x2-r, y1+r, r, 3*math.pi/2, 2*math.pi)      -- top right
   cairo_line_to(cr, x2, y2-r)                               -- right
   cairo_arc(cr, x2-r, y2-r, r, 0, math.pi/2)                -- bottom right
   cairo_line_to(cr, x1+r, y2)                               -- bottom
   cairo_arc(cr, x1+r, y2-r, r, math.pi/2, math.pi)          -- bottom left
   cairo_line_to(cr, x1, y1+r)                               -- left
   cairo_arc(cr, x1+r, y1+r, r, math.pi, 3*math.pi/2)        -- top left
   cairo_close_path(cr)                                      -- top
end

function draw_rectangle(cr, pt, blk)
   local gl = settings_rectangles_global
   cairo_set_source_rgba(cr, rgb_to_r_g_b(def(pt,gl,'color'),def(pt,gl,'alpha')))
   local ox = def(blk,offset_global,'offset_x')
   local oy = def(blk,offset_global,'offset_y')
   rounded_rectangle(cr,def(pt,gl,'x')+ox,def(pt,gl,'y')+oy, def(pt,gl,'x')+ox+def(pt,gl,'w'),def(pt,gl,'y')+oy+def(pt,gl,'h'), def(pt,gl,'r'))
   cairo_fill(cr)
end

function draw_graph(cr,pt,update,blk)
   local gl = settings_graphs_global
   -- draw bg
   local ox = def(blk,offset_global,'offset_x')
   local oy = def(blk,offset_global,'offset_y')
   rounded_rectangle(cr, def(pt,gl,'x')+ox, def(pt,gl,'y')+oy, def(pt,gl,'x')+ox+def(pt,gl,'w'), def(pt,gl,'y')+oy+def(pt,gl,'h'), def(pt,gl,'r'))
   cairo_set_source_rgba(cr, rgb_to_r_g_b(def(pt,gl,'bg_color'), def(pt,gl,'bg_alpha')))
   cairo_fill(cr)

   -- draw rules
   cairo_set_line_width(cr,def(pt,gl,'rule_width'))
   cairo_set_source_rgba(cr, rgb_to_r_g_b(def(pt,gl,'rule_color'), def(pt,gl,'rule_alpha')))
   cairo_move_to(cr, def(pt,gl,'gx')+ox, def(pt,gl,'gy')+oy)
   cairo_rel_line_to(cr, def(pt,gl,'gw'), 0)
   cairo_stroke_preserve(cr)
   cairo_stroke(cr)

   for i=1, #def(pt,gl,'rules'), 1 do
      cairo_move_to(cr, def(pt,gl,'gx')+ox, def(pt,gl,'gy')+oy - def(pt,gl,'rules')[i]*def(pt,gl,'gh')/def(pt,gl,'max_value'))
      cairo_rel_line_to(cr, def(pt,gl,'gw'), 0)
      cairo_stroke(cr)
   end

   for i in pairs(pt.graph_lines) do
      local fotmat, value
      local gline = pt.graph_lines[i]
      local gll = settings_graph_lines_global
      local index = ((def(pt,gl,'index')) % def(pt,gl,'samples'))
      if update then
         if def(gline,gll,'opt_arg') == nil then
            format = string.format('${%s %s}',def(gline,gll,'name'), def(gline,gll,'arg'))
         else
            format = string.format('${%s %s}${%s %s}${else}${%s %s}${endif}',def(gline,gll,'opt_cond'), def(gline,gll,'arg'),
            def(gline,gll,'name'), def(gline,gll,'arg'), def(gline,gll,'name'), def(gline,gll,'opt_arg'))
         end
         value = tonumber(conky_parse(format))
         if value ~= nil and value > def(pt,gl,'max_value') then
            value = def(pt,gl,'max_value')
         end
         gline.vector[def(pt,gl,'index')] = value
         index = index +1
      end

      -- draw graphs
      cairo_set_line_width(cr, def(pt,gl,'line_width'))
      cairo_set_source_rgba(cr, rgb_to_r_g_b(def(gline,gll,'fg_color'),def(gline,gll,'fg_alpha')))
      cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND)
      local val = gline.vector[((1+index-2) % def(pt,gl,'samples'))+1]
      if val == nil then val = 0 end
      cairo_move_to(cr,def(pt,gl,'gx')+ox, def(pt,gl,'gy')+oy - val*def(pt,gl,'gh')/def(pt,gl,'max_value'))
      for i=2, def(pt,gl,'samples'), 1 do
         val = gline.vector[((i+index-2) % def(pt,gl,'samples'))+1]
         if val == nil then val = 0 end
         cairo_line_to(cr, def(pt,gl,'gx')+ox + def(pt,gl,'gw')/def(pt,gl,'samples')*i, def(pt,gl,'gy')+oy - val*def(pt,gl,'gh')/def(pt,gl,'max_value'))
      end
      cairo_stroke_preserve(cr)

      cairo_set_source_rgba(cr, rgb_to_r_g_b(def(gline,gll,'bg_color'),def(gline,gll,'bg_alpha')))
      cairo_line_to(cr, def(pt,gl,'gx')+ox+def(pt,gl,'gw'), def(pt,gl,'gy')+oy)
      cairo_line_to(cr, def(pt,gl,'gx')+ox, def(pt,gl,'gy')+oy)
      cairo_close_path(cr)
      cairo_fill(cr)
   end
   pt.index = pt.index % def(pt,gl,'samples')
   if update then
      pt.index = pt.index +1
   end
end   


function draw_ring2(cr,t)
   local function rgba_to_r_g_b_a(tcolour)
      colour,alpha=tcolour[2],tcolour[3]
      return ((colour / 0x10000) % 0x100) / 255.,
         ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
   end
         
         
   local function calc_delta(tcol1,tcol2)
      --calculate deltas P R G B A to table_colour 1

      for x = 1, #tcol1 do
         tcol1[x].dA   = 0
         tcol1[x].dP = 0
          tcol1[x].dR = 0
         tcol1[x].dG = 0
         tcol1[x].dB = 0
         if tcol2~=nil and #tcol1 == #tcol2 then
            local r1,g1,b1,a1 = rgba_to_r_g_b_a(tcol1[x])
            local r2,g2,b2,a2 = rgba_to_r_g_b_a(tcol2[x])
            tcol1[x].dP = (tcol2[x][1]-tcol1[x][1])/t.sectors
             tcol1[x].dR = (r2-r1)/t.sectors
            tcol1[x].dG = (g2-g1)/t.sectors
            tcol1[x].dB = (b2-b1)/t.sectors
            tcol1[x].dA = (a2-a1)/t.sectors      
            
         end
      end
      
      return tcol1
   end

   --check values
   local function setup(t)
      if t.name==nil and t.arg==nil then
         print ("No input values ... use parameters 'name' with 'arg' or only parameter 'arg' ")
         return
      end

      if t.max==nil then
         print ("No maximum value defined, use 'max'")
         print ("for name=" .. t.name)
         print ("with arg=" .. t.arg)
         return
      end
      if t.name==nil then t.name="" end
      if t.arg==nil then t.arg="" end

      if t.xc==nil then t.xc=conky_window.width/2 end
      if t.yc==nil then t.yc=conky_window.height/2 end
      if t.thickness ==nil then t.thickness = 10 end
      if t.radius ==nil then t.radius =conky_window.width/4 end
      if t.start_angle==nil then t.start_angle =0 end
      if t.end_angle==nil then t.end_angle=360 end
      if t.bg_colour1==nil then
         t.bg_colour1={{0,0x00ffff,0.1},{0.5,0x00FFFF,0.5},{1,0x00FFFF,0.1}}
      end
      if t.fg_colour1==nil then
         t.fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1},{1,0x00FF00,0.1}}
      end
      if t.bd_colour1==nil then
         t.bd_colour1={{0,0xFFFF00,0.5},{0.5,0xFFFF00,1},{1,0xFFFF00,0.5}}
      end
      if t.sectors==nil then t.sectors=10 end
      if t.gap_sectors==nil then t.gap_sectors=1 end
      if t.fill_sector==nil then t.fill_sector=false end
      if t.sectors==1 then t.fill_sector=false end
      if t.border_size==nil then t.border_size=0 end
      if t.cap==nil then t.cap="p" end
      --some checks
      if t.thickness>t.radius then t.thickness=t.radius*0.1 end
      t.int_radius = t.radius-t.thickness

      --check colors tables
      for i=1, #t.bg_colour1 do
         if #t.bg_colour1[i]~=3 then t.bg_colour1[i]={1,0xFFFFFF,0.5} end
      end
      for i=1, #t.fg_colour1 do
         if #t.fg_colour1[i]~=3 then t.fg_colour1[i]={1,0xFF0000,1} end
      end
      for i=1, #t.bd_colour1 do
         if #t.bd_colour1[i]~=3 then t.bd_colour1[i]={1,0xFFFF00,1} end
      end
   
      if t.bg_colour2~=nil then
         for i=1, #t.bg_colour2 do
            if #t.bg_colour2[i]~=3 then t.bg_colour2[i]={1,0xFFFFFF,0.5} end
         end
      end
      if t.fg_colour2~=nil then
         for i=1, #t.fg_colour2 do
            if #t.fg_colour2[i]~=3 then t.fg_colour2[i]={1,0xFF0000,1} end
         end
      end
      if t.bd_colour2~=nil then
         for i=1, #t.bd_colour2 do
            if #t.bd_colour2[i]~=3 then t.bd_colour2[i]={1,0xFFFF00,1} end
         end
      end    
      
      if t.start_angle>=t.end_angle then
       local tmp_angle=t.end_angle
       t.end_angle= t.start_angle
       t.start_angle = tmp_angle
       -- print ("inversed angles")
         if t.end_angle-t.start_angle>360 and t.start_angle>0 then
            t.end_angle=360+t.start_angle
            print ("reduce angles")
         end
      
         if t.end_angle+t.start_angle>360 and t.start_angle<=0 then
            t.end_angle=360+t.start_angle
            print ("reduce angles")
         end
      
         if t.int_radius<0 then t.int_radius =0 end
         if t.int_radius>t.radius then
            local tmp_radius=t.radius
            t.radius=t.int_radius
            t.int_radius=tmp_radius
            print ("inversed radius")
         end
         if t.int_radius==t.radius then
            t.int_radius=0
            print ("int radius set to 0")
         end
      end
      
      t.fg_colour1 = calc_delta(t.fg_colour1,t.fg_colour2)
      t.bg_colour1 = calc_delta(t.bg_colour1,t.bg_colour2)
      t.bd_colour1 = calc_delta(t.bd_colour1,t.bd_colour2)
   end
   
   --initialize table
   setup(t)

   --initialize cairo context

   cairo_save(cr)

   cairo_translate(cr,t.xc,t.yc)
   cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND)
   cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND)

   --get value
   local value = 0
   if t.name ~="" then
      value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
   else
      value = tonumber(t.arg)
   end
   if value==nil then value =0 end

   --initialize sectors
   --angle of a sector :
   angleA = ((t.end_angle-t.start_angle)/t.sectors)*math.pi/180
   --value of a sector :
   valueA = t.max/t.sectors
   --first angle of a sector :
   lastAngle = t.start_angle*math.pi/180


   local function draw_sector(type_arc,angle0,angle,valpc, idx)
   
      --this function draws a portion of arc
       --type of arc, angle0 = strating angle, angle= angle of sector,
       --valpc = percentage inside the sector, idx = sctor number #
       if type_arc=="bg" then       --background
          if valpc==1 then return end
          tcolor=t.bg_colour1
       elseif type_arc=="fg" then   --foreground
          if valpc==0 then return end
          tcolor=t.fg_colour1
       elseif type_arc=="bd" then   --border
          tcolor=t.bd_colour1
       end

      --angles equivalents to gap_sector
      local ext_delta=math.atan(t.gap_sectors/(2*t.radius))
      local int_delta=math.atan(t.gap_sectors/(2*t.int_radius))

      --angles of arcs
      local ext_angle=(angle-ext_delta*2)*valpc
      local int_angle=(angle-int_delta*2)*valpc

      --define colours to use for this sector
      if #tcolor==1 then
         --plain color
         local vR,vG,vB,vA = rgba_to_r_g_b_a(tcolor[1])
         cairo_set_source_rgba(cr,vR+tcolor[1].dR*idx,
                           vG+tcolor[1].dG*idx,
                           vB+tcolor[1].dB*idx,
                           vA+tcolor[1].dA*idx   )
      else
         --radient color
         local pat=cairo_pattern_create_radial(0,0,t.int_radius,0,0,t.radius)
         for i=1, #tcolor do
            local vP,vR,vG,vB,vA = tcolor[i][1], rgba_to_r_g_b_a(tcolor[i])
            cairo_pattern_add_color_stop_rgba (pat,
                           vP+tcolor[i].dP*idx,
                           vR+tcolor[i].dR*idx,
                           vG+tcolor[i].dG*idx,
                           vB+tcolor[i].dB*idx,
                           vA+tcolor[i].dA*idx   )
         end
         cairo_set_source (cr, pat)
         cairo_pattern_destroy(pat)
      end

      --start drawing
       cairo_save(cr)
      --x axis is parrallel to start of sector
      cairo_rotate(cr,angle0-math.pi/2)

      local ri,re = t.int_radius ,t.radius

      --point A
      local angle_a
   
      if t.cap == "p" then
         angle_a = int_delta
         if t.inverse_arc and type_arc ~="bg" then
            angle_a = angle-int_angle-int_delta
         end
         if not(t.inverse_arc) and type_arc =="bg" then
            angle_a = int_delta+int_angle
         end
      else --t.cap=="r"
         angle_a = ext_delta
         if t.inverse_arc and type_arc~="bg" then
            angle_a = angle-ext_angle-ext_delta
         end
         if not(t.inverse_arc) and type_arc=="bg" then
            angle_a = ext_delta+ext_angle
         end
      end
      local ax,ay = ri*math.cos(angle_a),ri*math.sin(angle_a)


      --point B
      local angle_b = ext_delta
      if t.cap == "p" then
         if t.inverse_arc and type_arc ~="bg" then
            angle_b = angle-ext_angle-ext_delta
         end
         if not(t.inverse_arc) and type_arc=="bg" then
            angle_b = ext_delta+ext_angle
         end
      else
         if t.inverse_arc and type_arc ~="bg" then
            angle_b = angle-ext_angle-ext_delta
         end
         if not(t.inverse_arc) and type_arc=="bg" then
            angle_b = ext_delta+ext_angle
         end
      end
      local bx,by = re*math.cos(angle_b),re*math.sin(angle_b)

      -- EXTERNAL ARC B --> C
      if t.inverse_arc then
         if type_arc=="bg" then
            b0,b1= ext_delta, angle-ext_delta-ext_angle
         else
            b0,b1= angle-ext_angle-ext_delta, angle-ext_delta
         end
      else
         if type_arc=="bg" then
            b0,b1= ext_delta+ext_angle, angle-ext_delta
         else
            b0,b1= ext_delta, ext_angle+ext_delta
         end
      end
      
      ---POINT D
      local angle_c
      if t.cap == "p" then
         angle_d = angle-int_delta
         if t.inverse_arc and type_arc=="bg" then
            angle_d = angle-int_delta-int_angle   
         end
         if not(t.inverse_arc) and type_arc~="bg" then
            angle_d=int_delta+int_angle
         end
      else
         angle_d = angle-ext_delta
         if t.inverse_arc and type_arc=="bg" then
            angle_d =angle-ext_delta-ext_angle
         end
         if not(t.inverse_arc) and type_arc~="bg" then
            angle_d = ext_angle+ext_delta
         end
      end
      local dx,dy = ri*math.cos(angle_d),ri*math.sin(angle_d)
      
      -- INTERNAL ARC D --> A
      if t.cap=="p" then   
         if t.inverse_arc then   
            if type_arc=="bg" then
               d0,d1= angle-int_delta-int_angle,int_delta
            else
               d0,d1= angle-int_delta, angle- int_angle-int_delta
            end
         else
            if type_arc=="bg" then
               d0,d1= angle-int_delta, int_delta+int_angle
            else
               d0,d1= int_delta+int_angle, int_delta
            end
         end
      else
         if t.inverse_arc then   
            if type_arc=="bg" then   
               d0,d1= angle-ext_delta-ext_angle,ext_delta
            else
               d0,d1= angle-ext_delta, angle- ext_angle-ext_delta
            end
         else
            if type_arc=="bg" then   
               d0,d1= angle-ext_delta,ext_delta+ext_angle
            else   
               d0,d1= ext_angle+ext_delta, ext_delta
            end
         end         
      end
         
      --draw sector
      cairo_move_to(cr,ax,ay)
      cairo_line_to(cr,bx,by)
      cairo_arc(cr,0,0,re,b0,b1)
      cairo_line_to(cr,dx,dy)
      cairo_arc_negative(cr,0,0,ri,d0,d1)
      cairo_close_path (cr)

      --stroke or fill sector
       if type_arc=="bd" then
          cairo_set_line_width(cr,t.border_size)
          cairo_stroke(cr)
       else
          cairo_fill(cr)
       end

       cairo_restore(cr)

    end
   --draw sectors
   local n0,n1,n2 = 1,t.sectors,1
   if t.inverse_arc then n0,n1,n2 = t.sectors,1,-1 end
   local index = 0
   for i = n0,n1,n2 do
      index = index +1
      local valueZ=1
      local cstA, cstB = (i-1),i
      if t.inverse_arc then cstA,cstB = (t.sectors-i), (t.sectors-i+1) end
      
      if value>valueA *cstA and value<valueA*cstB then
         if not t.fill_sector then
            valueZ = (value-valueA*cstA)/valueA
         end
      else
         if value<valueA*cstB then valueZ=0 end
      end
      
      local start_angle= lastAngle+(i-1)*angleA
      if t.foreground ~= false then
         draw_sector("fg",start_angle,angleA,valueZ, index)
      end
      if t.background ~= false then
         draw_sector("bg",start_angle,angleA,valueZ, i)
      end
      if t.border_size>0 then draw_sector("bd",start_angle,angleA,1, i) end
   end

   cairo_restore(cr)
end

function conky_main()
   -- start 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)

   update_num = tonumber(conky_parse('${updates}'))

   if settings_graph_init == false then
      for j in pairs(settings_blocks) do
         local block = settings_blocks[j]
         if block['settings_graphs'] ~= nil then
            for i in pairs(block.settings_graphs) do
               init_graph(block.settings_graphs[i])
            end
         end
      end
      settings_graph_init=true
   end

   if update_num > 3 then
      for j in pairs(settings_blocks) do
         local block = settings_blocks[j]
         if block['disabled'] == nil then
         if block['settings_rings'] then
         for i in pairs(block.settings_rings) do
            draw_ring(cr,block.settings_rings[i],block)
         end
         end
         if block['settings_bars'] then
         for i in pairs(block.settings_bars) do
            draw_bar(cr, block.settings_bars[i],block)
         end
         end
         if block['settings_graphs'] then
         for i in pairs(block.settings_graphs) do
            draw_graph(cr, block.settings_graphs[i], last_num ~= update_num,block)
         end
         end
         if block['settings_rectangles'] then
         for i in pairs(block.settings_rectangles) do
            draw_rectangle(cr, block.settings_rectangles[i],block)
         end
         end
         if block['settings_strings'] then
         for i in pairs(block.settings_strings) do
            draw_string(cr, block.settings_strings[i],block)
         end
         end
         end
      end
      for i in pairs(settings_rings) do
         draw_ring2(cr,settings_rings[i])
      end
   end
   cairo_destroy(cr)
   cr = nil
   cairo_surface_destroy(cs)
   cs = nil
   last_num = update_num
end

--function conky_cairo_cleanup()
--   cairo_surface_destroy(cs)
--   cs = nil
--end



Yes, i suck at lua, need to learn more to reduce this 1000-line monstrosity into a 300-500 line sane script.
Plugin list
Working on: Python (django, sqlalchemy, PyQt, etc) + Lua
Repositories: github, bitbucket, google code
Just feel the code..
opencma/vitamtp for Archlinux
User avatar
codestation
Big Beholder
 
Posts: 1277
Joined: Wed Jan 19, 2011 3:45 pm
Location: /dev/negi

Re: your desktop look

Postby Xian Nox » Sat Jun 30, 2012 12:07 am

okay, new screenshot:
Image
Not a thumbnail?
Image

Apparently it can't read the power and HDD temp, and data is being mysterious. This should have something to do with it:
Code: Select all
sh: /home/code/.bin/watts: No such file or directory

Also, any way to limit it to only one desktop?
Spoiler
Disturbed0ne wrote:PS. EVERYONE should like girls. they're just so soft. :oops:
Moderator 80% corrupt. That's funny, I don't feel corrupt. In fact, I feel pretty good.
What looks like a blog of mine can be seen here.
User avatar
Xian Nox
Moderator
 
Posts: 6033
Joined: Fri Nov 05, 2010 5:27 pm
Location: /home/xian/n-field

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest