Odpowiedz 
 
Ocena wątku:
  • 5 Głosów - 2.6 Średnio
  • 1
  • 2
  • 3
  • 4
  • 5
Conky - configi
Autor Wiadomość
didisoft Offline
Użytkownik

Liczba postów: 2
Dołączył: 04-01-2009
Reputacja: 2
Post: #31
RE: Conky - configi
[Obrazek: conkyw.th.jpg]

.conkyrc (pogoda)
Kod:
# -- Ustawienia Conky -- #
# -- conky by didisoft -- #
background yes
cpu_avg_samples 2
pad_percents 2            # to co nizej, miejsc po przecinku
short_units yes            # krotka wersja podawania wielkosci dyskow np. 612.21M/3.80G
stippled_borders 3
total_run_times 0
update_interval 1.0
use_spacer right
net_avg_samples 2
no_buffers yes
imlib_cache_size 0

# -- Ustawienia tekstu -- #
uppercase no
override_utf8_locale yes
use_xft yes
text_buffer_size 8000
xftalpha 0.75
xftfont GE Inspira:bold:size=8

# -- Specyfikacja okien -- #
own_window yes
own_window_colour 000000    # Black
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_type override     ## normal lub override
own_window_title conky

# -- Ustawienia grafiki -- #
double_buffer yes
draw_borders no
draw_graph_borders no
draw_outline no
draw_shades no

# -- Ustawienia koloru -- #
color0 4c4c4c            # prawie czarny
color1 c74811            # pomaranczowy
color2 e60000            # czerwony
color3 a82553            # rozowy f71f84
color4 282421            # ciemny
color5 b3b3b3            # jasny
color6 a7a7a7            # szary
color7 090202            # ciemny
color8 eff3e2            # ciemny braz
color9 000000            # czarny
default_color 141414        # jasny bfbfbf
default_outline_color 000000     # Black
default_shade_color 000000    # Black

# Layout
alignment top_right
gap_x 1
gap_y 16
max_specials 1024
max_user_text 10000
maximum_width 220
minimum_size 10 0
border_margin 1
border_width 1

TEXT
${color7}${voffset -12}${execpi 1800 conkyForecast --location=PLXX0030 --template=/home/didisoft/.conky/conkyForecast.template}

conkyForecast.template
Kod:
${voffset 5}${font GE Inspira:bold:size=6}${goto 55}[--datatype=DW --startday=1 --shortweekday]${goto 95}[--datatype=DW --startday=2 --shortweekday]${goto 136}[--datatype=DW --startday=3 --shortweekday]${goto 175}[--datatype=DW --startday=4 --shortweekday]
${voffset -3}${font GE Inspira:bold:size=8}[--datatype=HT --hideunits --centeredwidth=4]${font GE Inspira:bold:size=7}${goto 55}[--datatype=HT --startday=1 --hideunits --centeredwidth=4]${goto 95}[--datatype=HT --startday=2 --hideunits --centeredwidth=4]${goto 136}[--datatype=HT --startday=3 --hideunits --centeredwidth=4]${goto 175}[--datatype=HT --startday=4 --hideunits --centeredwidth=4]
${voffset -17}${font ConkyWeather:size=12}${goto 20}[--datatype=WF]${font ConkyWeather:size=10}${goto 69}[--datatype=WF --startday=1]${goto 112}[--datatype=WF --startday=2]${goto 149}[--datatype=WF --startday=3]${goto 188}[--datatype=WF --startday=4]

.conkyrc2 (info o systemie)
Kod:
# -- Ustawienia Conky -- #
# -- conky by didisoft -- #
background yes
cpu_avg_samples 2
pad_percents 2            # to co nizej, miejsc po przecinku
short_units yes            # krotka wersja podawania wielkosci dyskow np. 612.21M/3.80G
stippled_borders 3
total_run_times 0
update_interval 1.0
use_spacer right
net_avg_samples 2
no_buffers yes
uppercase no
imlib_cache_size 0

# -- Ustawienia tekstu -- #
uppercase no
override_utf8_locale yes
use_xft yes
text_buffer_size 8000
xftalpha 0.75
xftfont GE Inspira:bold:italic:size=7

# -- Specyfikacja okien -- #
own_window yes
own_window_colour 000000    # Black
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_type override     ## normal
own_window_title conky2

# -- Ustawienia grafiki -- #
double_buffer yes
draw_borders no
draw_graph_borders no
draw_outline no
draw_shades no

# -- Ustawienia koloru -- #
color0 1c1c1c            # prawie czarny
color1 000000            # czarny
color2 7e5973            # braz 64574e
color3 a82553            # rozowy f71f84
color4 282421            # ciemny
color5 b3b3b3            # jasny
color6 a7a7a7            # szary
color7 090202            # ciemny
color8 7b6541            # ciemny braz
color9 000000            # czarny
default_color bfbfbf        # ciemny 141414
default_outline_color 000000     # Black
default_shade_color 000000    # Black

# Layout
alignment top_right
gap_x 1
gap_y 100
max_specials 1024
max_user_text 10000
maximum_width 120
minimum_size 110 3000
border_margin 1
border_width 1

# -- Load Lua -- #
lua_load ~/.conky/rings.lua
lua_draw_hook_pre ring_stats

TEXT
${color7}${font Purisa:bold:size=8}${voffset 13}${goto 72} CPU${font}
${color7}${voffset 10}${font Droid Sans:italic::size=5}${goto 57}${freq_g (1)} / ${freq_g (1)} GHz
${color7}${offset 25}${goto 57}${exec sensors  |  grep "temp2"  |  cut --bytes=15-21} / ${exec sensors  |  grep "temp3"  |  cut --bytes=15-21}
${color7}${font Purisa:bold:size=8}${voffset 27}${goto 72} RAM${font}
${color7}${voffset 13}${font Droid Sans:italic::size=6}${goto 65}${memperc}%
${color7}${font Purisa:bold:size=8}${voffset 30}${goto 72} HDD${font}
${color7}${voffset 8}${font Droid Sans:italic::size=5}${goto 55}${fs_used /} / ${fs_size /}
${color7}${offset 15}${font Droid Sans:italic::size=5}${goto 55}${fs_used /home} / ${fs_size /home}
${color7}${font Purisa:bold:size=8}${voffset 26}${goto 72} BAT${font}
${color7}${voffset 13}${font Droid Sans:italic::size=6}${goto 57}${battery_time}
${color7}${font Purisa:bold:size=8}${voffset 32}${goto 72} NET${font}
${color7}${voffset 9}${font Droid Sans:italic::size=6}${goto 53} DL: ${downspeed eth3}b/s
${color7}${offset 10}${font Droid Sans:italic::size=6}${goto 53} UP: ${upspeed eth3}b/s
${color7}${voffset 30}${font}${goto 45}${addr eth3}
${color7}${offset 10}${font}${goto 45}${execi 60 ~/.conky/ip.sh}
${font}${color7}${voffset 5}${goto 30} Month DL: ${execi 300 vnstat -m  |  grep "`date +"'%y"`"  |  tail -1  |  awk '{print $3 $4}'}${font}
${font}${color7}${offset 15}${goto 30} Month UP: ${execi 300 vnstat -m  |  grep "`date +"'%y"`"  |  tail -1  |  awk '{print $6 $7}'}${font}

${color7}${font Purisa:bold:size=9}${voffset 10}${goto 40}GMAIL: ${execi 60 ~/.conky/gmail.sh}

rings.lua (pół okrągłe wykresy)
Kod:
--[[
Ring Meters by londonali1010 (2009)

This script draws percentage meters as rings. It is fully customisable; all options are described in the 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/rings-v1.2.lua
    lua_draw_hook_pre ring_stats
    
Changelog:
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)

Szare kolory
bg_colour=0x525276,
bg_alpha=0.1,
fg_colour=0x4c4c4c

]]

settings_table = {
    {
        name='cpu',
        arg='cpu1',
        max=100,
        bg_colour=0xe013a7b,
        bg_alpha=0.1,
        fg_colour=0xe013a7b,
        fg_alpha=0.50,
        x=65, y=50,
        radius=30,
        thickness=4,
        start_angle=200,
        end_angle=380
    },
    {
        name='cpu',
        arg='cpu2',
        max=100,
        bg_colour=0xe013a7b,
        bg_alpha=0.1,
        fg_colour=0xe013a7b,
        fg_alpha=0.50,
        x=65, y=50,
        radius=23,
        thickness=4,
        start_angle=200,
        end_angle=380
    },
{
    name='memperc',
    arg='',
    max=100,
    bg_colour=0xe013a7b,
    bg_alpha=0.1,
    fg_colour=0xe013a7b,
    fg_alpha=0.50,
    x=65, y=120,
    radius=25,
    thickness=4,
    start_angle=200,
    end_angle=380
    },
{
    name='fs_used_perc',
    arg='/',
    max=100,
    bg_colour=0xe013a7b,
    bg_alpha=0.1,
    fg_colour=0xe013a7b,
    fg_alpha=0.50,
    x=65, y=190,
    radius=23,
    thickness=4,
    start_angle=200,
    end_angle=380
    },
{
    name='fs_used_perc',
    arg='/home',
    max=100,
    bg_colour=0xe013a7b,
    bg_alpha=0.1,
    fg_colour=0xe013a7b,
    fg_alpha=0.50,
    x=65, y=190,
    radius=30,
    thickness=4,
    start_angle=200,
    end_angle=380
    },
{
    name='battery_percent',
    arg='BAT0',
    max=100,
    bg_colour=0xe013a7b,
    bg_alpha=0.1,
    fg_colour=0xe013a7b,
    fg_alpha=0.50,
    x=65, y=260,
    radius=25,
    thickness=4,
    start_angle=200,
    end_angle=380
    },
{
    name='downspeedf',
    arg='eth3',
    max=2500,
    bg_colour=0xe013a7b,
    bg_alpha=0.1,
    fg_colour=0xe013a7b,
    fg_alpha=0.50,
    x=65, y=330,
    radius=30,
    thickness=4,
    start_angle=200,
    end_angle=380
    },
{
    name='upspeedf',
    arg='eth3',
    max=250,
    bg_colour=0xe013a7b,
    bg_alpha=0.1,
    fg_colour=0xe013a7b,
    fg_alpha=0.50,
    x=65, y=330,
    radius=23,
    thickness=4,
    start_angle=200,
    end_angle=380
    },

}

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 conky_ring_stats()
    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

    if conky_window==nil then return end
    local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_wi​ndow.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
end

Wszystkie skrypty są w katalogu ~/.conky/
Do miesięcznych statystyk ściąganych i wysyłanych danych trzeba zainstalować i ustawić "vnstat".
Wykresy przy CPU pokazują procent wykorzystania procesora: zewnętrzny cpu1, wewnętrzny cpu2.
Przy HDD: zewnętrzny partycja /home, wewnętrzny partycja systemowa.
Przy NET: zewnętrzny prędkość ściągania z sieci, wewnętrzny prędkość wysyłania.
(Ten post był ostatnio modyfikowany: 06.02.2010 14:26:06 przez didisoft.)
06.02.2010 14:24:28
Znajdź wszystkie posty użytkownika Odpowiedz cytując ten post
bastek Offline
Użytkownik

Liczba postów: 18
Dołączył: 15-11-2009
Reputacja: 0
Post: #32
RE: Conky - configi
Jak już się wszyscy chwalą to i ja się pochwalę:
[Obrazek: zrzut1.th.png]
Kod:
background yes
use_xft yes
xftfont Zekton:size=9
xftalpha 0.5
update_interval 1.0
total_run_times 0
double_buffer yes
no_buffers yes
own_window yes
own_window_transparent yes
own_window_type normal
own_window_hints undecorate,sticky,skip_taskbar,skip_pager
minimum_size 500 5
maximum_width 270
default_color white
alignment top_right
draw_shades no
gap_x 12
gap_y 30
uppercase no
override_utf8_locale yes

#${color white}$stippled_hr
TEXT
${color #9b181e}$hr${color slate grey}
${font Zekton:style=Bold:pixelsize=42}${alignc}${time %H:%M}${font}
${font Zekton:style=Bold:pixelsize=26}${alignc}${time %A}${font}
${font Zekton:style=Bold:pixelsize=26}${alignc}${time %x}${font}

${color red}System $hr${font :size=5}

${font}${color black}Ubuntu 9.10 $alignr$kernel
${color black}Czas pracy:  $alignr${uptime_short}

${color red}Procesor $hr${font :size=5}

${font}${color black}$freq_g GHz $alignr wykorzystane: $cpu%

${color black}Najwięcej:${font :size=4}

${font}${color black}${top name 1} $alignr ${top cpu 1} %
${color black}${top name 2} $alignr ${top cpu 2} %
${color black}${top name 3} $alignr ${top cpu 3} %

${color red}Temperatura $hr${font :size=5}

${font}${color black}$alignr Temp: ${hwmon temp 2}°C

${color red}Pamięć RAM $hr${font :size=5}

${font}${color black}$mem / $memmax $alignr wykorzystane: $memperc %

${color black}Najwięcej:${font :size=4}

${font}${color black}${top_mem name 1} $alignr ${top_mem mem 1} %
${color black}${top_mem name 2} $alignr ${top_mem mem 2} %
${color black}${top_mem name 3} $alignr ${top_mem mem 3} %

${color red}Swap $hr${font :size=5}

${font}${color black}$swap / $swapmax$alignr $alignr wykorzystane: $swapperc%

${color red}Dyski $hr${font :size=5}

${font}${color black}$alignr wolne / całość ${font :size=4}

${font}${color black}root: $alignr ${fs_free /} / ${fs_size /}
${color black}home: $alignr ${fs_free /home} / ${fs_size /home}

${color red}Internet $hr${font :size=5}

${font}${color black}
${color black}IP wew: $alignr${color black}${addr eth0}
${color black}Pobieranie: $alignr ${downspeedf eth0} KB/s
${color black}Wysyłanie: $alignr ${upspeedf eth0} KB/s

Biada zającowi pojmanemu przez wilka który prosząc o pomoc rzeknie „Bądź człowiekiem".
Nie ma głupich pytań są tylko głupie odpowiedzi.
05.03.2010 12:56:12
Znajdź wszystkie posty użytkownika Odpowiedz cytując ten post
Leo_ex7 Offline
Entuzjasta Open Source

Liczba postów: 44
Dołączył: 03-05-2009
Reputacja: 1
Post: #33
RE: Conky - configi
[Obrazek: conky.th.png]

main_conkyrc
Kod:
# Conky, a system monitor, based on torsmo
#
# Any original torsmo code is licensed under the BSD license
#
# All code written since the fork of torsmo is licensed under the GPL
#
# Please see COPYING for details
#
# Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
# Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# -- "DNA Conky" created by Kamillus (aka Leo_ex7) for 15,6" screen and 1366x768 resolution -- #

# -- General -- #
background yes
cpu_avg_samples 2
net_avg_samples 2
total_run_times 0
update_interval 1
no_buffers yes
short_units yes

# -- Text -- #
uppercase no
override_utf8_locale yes
use_xft yes
xftalpha 0.75

# -- Windows -- #
own_window yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes              # for KDE4, disable "shadows" in Kwin
own_window_argb_visual yes
own_window_type normal                  # normal, desktop, override
own_window_class conky-semi
own_window_title conky

# -- Graphics -- #
double_buffer yes

# -- Colors -- #
color1 000000                           # black
color2 FFFFFF                           # white

# -- Layout -- #
alignment top_right
gap_x 0
gap_y 0
minimum_size 350 758
maximum_width 350

# -- Lua Load -- #
lua_load ~/.conky/conky_widgets.lua
lua_draw_hook_pre widgets

TEXT
# CLOCK
${color2}${font :bold:size=14}${goto 153}${time %d}.${time %m}${font :size=30}${goto 45}${time %H}${offset 175}${time %M}${font :bold:size=12}${goto 161}${voffset 2}${time %Y}${font :bold:size=10}${goto 170}${voffset 20}${time %a}

# CPU & HDD
${font :size=15}${voffset 74}${offset 45}CPU${offset 180}HDD
${font :italic:size=8}${offset 5}core1${offset 50}${cpu cpu1}%${alignr 8}/home${offset 5}${fs_used /home} / ${fs_size /home}
${offset 5}core2${offset 50}${cpu cpu2}%${alignr 30}swap${offset 12}${swap} / ${swapmax}
${offset 5}temp${offset 50}${hwmon 0 temp 1}°C

# RAM & BAT
${font :size=15}${voffset 115}${offset 45}RAM${offset 180}BAT
${font :italic:size=8}${offset 5}used${offset 50}${memperc}%${alignr 24}remaining${offset 18}${battery_percent}%
${offset 5}total${offset 50}${memmax}${alignr 24}${battery_time}

# ETHERNET & WIFI
${font :size=15}${voffset 128}${offset 5}ETHERNET${offset 155}WIFI
${font :italic:size=8}${offset 5}DL:${offset 50}${downspeed eth0}${alignr 78}DL:${offset 50}${downspeed wlan0}
${offset 5}UP:${offset 50}${upspeed eth0}${alignr 78}UP:${offset 50}${upspeed wlan0}
${offset 5}IP:${offset 20}${addr eth0}${alignr 35}IP:${offset 20}${addr wlan0}

secondary_conkyrc
Kod:
# Conky, a system monitor, based on torsmo
#
# Any original torsmo code is licensed under the BSD license
#
# All code written since the fork of torsmo is licensed under the GPL
#
# Please see COPYING for details
#
# Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
# Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# -- "DNA Conky" created by Kamillus (aka Leo_ex7) for 15,6" screen and 1366x768 resolution -- #
# -- Configuration for vertical lines and Paconky (Arch Linux) -- #

# -- General -- #
background yes
total_run_times 0
update_interval 3600
no_buffers yes

# -- Text -- #
uppercase no
override_utf8_locale yes
xftfont Ubuntu
use_xft yes
xftalpha 0.75

# -- Windows -- #
own_window yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes              # for KDE4, disable "shadows" in Kwin
own_window_argb_visual yes
own_window_type normal                  # normal, desktop, override
own_window_class conky-semi
own_window_title conky

# -- Graphics -- #
double_buffer yes

# -- Colors -- #
color1 000000                           # black
color2 FFFFFF                           # white

# -- Layout -- #
alignment top_right
gap_x 0
gap_y 0
minimum_size 350 758
maximum_width 350

# -- Lua Load -- #
lua_load ~/.conky/conky_widgets_updates.lua
lua_draw_hook_pre widgets

TEXT
${color2}${font :size=10}${voffset 24}${offset 1}_________________/${alignr 3}\________________
# 1
${color1}${font :bold:size=10}${alignc}${voffset 55}${offset 2}__
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 2}_______
${color2}${font :size=10}${voffset 15}${offset 6}________________/${color1}${font :bold:size=10}${offset 22}_________${color2}${font :size=10}${offset 24}\________________
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 2}_________
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 2}_____
# 2
${color1}${font :bold:size=10}${alignc}${voffset 55}${offset 3}____
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 3}________
${color2}${font :size=10}${voffset 15}${offset 4}________________/${color1}${font :bold:size=10}${offset 25}_________${color2}${font :size=10}${offset 25}\________________
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 3}________
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 3}____
# 3
${color1}${font :bold:size=10}${alignc}${voffset 55}${offset 2}_____
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 2}________
${color2}${font :size=10}${voffset 15}${offset 4}________________/${color1}${font :bold:size=10}${offset 25}_________${color2}${font :size=10}${offset 25}\_______________
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 2}_______
${color1}${font :bold:size=10}${alignc}${voffset 15}${offset 2}__
# ARCH LOGO (requires OpenLogos font)
${color2}${font OpenLogos:size=62}${goto 146}${voffset 50}A${font}

conky_widgets.lua
Kod:
--[[
Conky Widgets by londonali1010 (2009)

This script is meant to be a "shell" to hold a suite of widgets for use in Conky.

To configure:
+ Copy the widget's code block (will be framed by --(( WIDGET NAME )) and --(( END WIDGET NAME )), with "[" instead of "(") somewhere between "require 'cairo'" and "function conky_widgets()", ensuring not to paste into another widget's code block
+ To call the widget, add the following between "cr = cairo_create(cs)" and "cairo_destroy(cr)" at the end of the script:
    NAME_OF_FUNCTION(cr, OPTIONS)
+ Replace OPTIONS with the options for your widget (should be specified in the widget's code block)

Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/conky_widgets.lua):
    lua_load ~/scripts/conky_widgets.lua
    lua_draw_hook_pre widgets
    
Changelog:
+ v1.1 -- Simplified calls to widgets by implementing a global drawing surface, and included imlib2 by default (03.11.2009)
+ v1.0 -- Original release (17.10.2009)
]]

--[[ "DNA Conky" by Kamillus (aka Leo_ex7) ]]

require 'cairo'
require 'imlib2'

--[[ RING WIDGET ]]
--[[ v1.1 by londonali1010 (2009) ]]
--[[ Options (name, arg, max, bg_colour, bg_alpha, xc, yc, radius, thickness, start_angle, end_angle):
    "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
    "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
    "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
    "bg_colour" is the colour of the base ring.
    "bg_alpha" is the alpha value of the base ring.
    "fg_colour" is the colour of the indicator part of the ring.
    "fg_alpha" is the alpha value of the indicator part of the ring.
    "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
    "radius" is the radius of the ring.
    "thickness" is the thickness of the ring, centred around the radius.
    "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
    "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger (e.g. more clockwise) than start_angle. ]]

function ring(cr, name, arg, max, bgc, bga, fgc, fga, xc, yc, r, t, sa, ea)
    local function rgb_to_r_g_b(colour, alpha)
        return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
    end
    
    local function draw_ring(pct)
        local angle_0 = sa * (2 * math.pi/360) - math.pi/2
        local angle_f = ea * (2 * math.pi/360) - math.pi/2
        local pct_arc = pct * (angle_f - angle_0)

        -- Draw background ring

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

        cairo_arc(cr, xc, yc, r, angle_0, angle_0 + pct_arc)
        cairo_set_source_rgba(cr, rgb_to_r_g_b(fgc, fga))
        cairo_stroke(cr)
    end
    
    local function setup_ring()
        local str = ''
        local value = 0
        
        str = string.format('${%s %s}', name, arg)
        str = conky_parse(str)
        
        value = tonumber(str)
        if value == nil then value = 0 end
        pct = value/max
        
        draw_ring(pct)
    end    
    
    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)
    
    if update_num > 5 then setup_ring() end
end

--[[ END RING WIDGET ]]

--[[ RING (COUNTER-CLOCKWISE) WIDGET ]]
--[[ v1.1 by londonali1010 (2009) ]]
--[[ Options (name, arg, max, bg_colour, bg_alpha, xc, yc, radius, thickness, start_angle, end_angle):
    "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
    "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
    "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
    "bg_colour" is the colour of the base ring.
    "bg_alpha" is the alpha value of the base ring.
    "fg_colour" is the colour of the indicator part of the ring.
    "fg_alpha" is the alpha value of the indicator part of the ring.
    "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
    "radius" is the radius of the ring.
    "thickness" is the thickness of the ring, centred around the radius.
    "start_angle" is the starting angle of the ring, in degrees, counter-clockwise from top. Value can be either positive or negative.
    "end_angle" is the ending angle of the ring, in degrees, counter-clockwise from top. Value can be either positive or negative, but must be larger (e.g. more counter-clockwise) than start_angle. ]]

function ring_ccw(cr, name, arg, max, bgc, bga, fgc, fga, xc, yc, r, t, sa, ea)
    local function rgb_to_r_g_b(colour, alpha)
        return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
    end
    
    local function draw_ring(pct)
        local angle_0 = sa * (2 * math.pi/360) - math.pi/2
        local angle_f = ea * (2 * math.pi/360) - math.pi/2
        local pct_arc = pct * (angle_f - angle_0)

        -- Draw background ring

        cairo_arc_negative(cr, xc, yc, r, angle_0, angle_f)
        cairo_set_source_rgba(cr, rgb_to_r_g_b(bgc, bga))
        cairo_set_line_width(cr, t)
        cairo_stroke(cr)
    
        -- Draw indicator ring

        cairo_arc_negative(cr, xc, yc, r, angle_0, angle_0 + pct_arc)
        cairo_set_source_rgba(cr, rgb_to_r_g_b(fgc, fga))
        cairo_stroke(cr)
    end
    
    local function setup_ring()
        local str = ''
        local value = 0
        
        str = string.format('${%s %s}', name, arg)
        str = conky_parse(str)
        
        value = tonumber(str)
        if value == nil then value = 0 end
        pct = value/max
        
        draw_ring(pct)
    end    
    
    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)
    
    if update_num > 5 then setup_ring() end
end

--[[ END RING (COUNTER-CLOCKWISE) WIDGET ]]

function conky_widgets()
    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)
    
    --1)-----------------------------------------------------------------------------------------------------------------------
    
    --[[ TIME (Left) ]]
    cr = cairo_create(cs) --outer
    ring(cr, 'time', '%H', 23, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 261, 0, 129, 10, 224, 270)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    cr = cairo_create(cs) --inner
    ring(cr, 'time', '%S', 59, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 261, 0, 118, 10, 224, 270)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    
    
    --[[ TIME (Right) ]]
    cr = cairo_create(cs) --outer
    ring_ccw(cr, 'time', '%M', 59, 0x000000, 0.1, 0x000000, 0.50, 105, 0, 129, 10, 141, 90)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    cr = cairo_create(cs) --inner
    ring_ccw(cr, 'time', '%S', 59, 0x000000, 0.1, 0x000000, 0.50, 105, 0, 118, 10, 141, 90)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    --2)----------------------------------------------------------------------------------------------------------------------
    
    --[[ CPU (Left) ]]
    cr = cairo_create(cs) --outer
    ring(cr, 'cpu', 'cpu1', 100, 0x000000, 0.1, 0x000000, 0.50, 261, 192, 129, 10, 224, 321)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    cr = cairo_create(cs) --inner
    ring(cr, 'cpu', 'cpu2', 100, 0x000000, 0.1, 0x000000, 0.50, 261, 192, 118, 10, 224, 321)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    
    
    --[[ HDD (Right) ]]
    cr = cairo_create(cs) --outer
    ring_ccw(cr, 'fs_used_perc', '/home', 100, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 105, 192, 129, 10, 141, 44)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    cr = cairo_create(cs) --inner
    ring_ccw(cr, 'swap', '', 100, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 105, 192, 118, 10, 141, 44)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    --3)----------------------------------------------------------------------------------------------------------------------
    
    --[[ RAM (Left) ]]
    cr = cairo_create(cs) --outer
    ring(cr, 'memperc', '', 100, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 261, 384, 129, 10, 224, 321)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    cr = cairo_create(cs) --inner
    ring(cr, 'memperc', '', 100, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 261, 384, 118, 10, 224, 321)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    
    
    --[[ BAT (Right) ]]
    cr = cairo_create(cs) --outer
    ring_ccw(cr, 'battery_percent', 'BAT0', 100, 0x000000, 0.1, 0x000000, 0.50, 105, 384, 129, 10, 141, 44)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    cr = cairo_create(cs) --inner
    ring_ccw(cr, 'battery_percent', 'BAT0', 100, 0x000000, 0.1, 0x000000, 0.50, 105, 384, 118, 10, 141, 44)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    --4)----------------------------------------------------------------------------------------------------------------------
    
    --[[ ETHERNET (Left) ]]
    cr = cairo_create(cs) --outer
    ring(cr, 'downspeedf', 'eth0', 12800, 0x000000, 0.1, 0x000000, 0.50, 261, 576, 129, 10, 224, 321) --"max" is set for Fast Ethernet (100 Mb/s)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    cr = cairo_create(cs) --inner
    ring(cr, 'upspeedf', 'eth0', 12800, 0x000000, 0.1, 0x000000, 0.50, 261, 576, 118, 10, 224, 321) --"max" is set for Fast Ethernet (100 Mb/s)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    
    
    --[[ WIFI (Right) ]]
    cr = cairo_create(cs) --outer
    ring_ccw(cr, 'downspeedf', 'wlan0', 6912, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 105, 576, 129, 10, 141, 44) --"max" is set for IEEE 802.11g (54 Mb/s)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    cr = cairo_create(cs) --inner
    ring_ccw(cr, 'upspeedf', 'wlan0', 6912, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 105, 576, 118, 10, 141, 44) --"max" is set for IEEE 802.11g (54 Mb/s)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
end

conky_widgets_updates.lua
Kod:
--[[
Conky Widgets by londonali1010 (2009)

This script is meant to be a "shell" to hold a suite of widgets for use in Conky.

To configure:
+ Copy the widget's code block (will be framed by --(( WIDGET NAME )) and --(( END WIDGET NAME )), with "[" instead of "(") somewhere between "require 'cairo'" and "function conky_widgets()", ensuring not to paste into another widget's code block
+ To call the widget, add the following between "cr = cairo_create(cs)" and "cairo_destroy(cr)" at the end of the script:
    NAME_OF_FUNCTION(cr, OPTIONS)
+ Replace OPTIONS with the options for your widget (should be specified in the widget's code block)

Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/conky_widgets.lua):
    lua_load ~/scripts/conky_widgets.lua
    lua_draw_hook_pre widgets
    
Changelog:
+ v1.1 -- Simplified calls to widgets by implementing a global drawing surface, and included imlib2 by default (03.11.2009)
+ v1.0 -- Original release (17.10.2009)
]]

--[[ "DNA Conky" by Kamillus (aka Leo_ex7) ]]
--[[ Configuration for updates meters ]]

require 'cairo'
require 'imlib2'

--[[ RING WIDGET ]]
--[[ v1.1 by londonali1010 (2009) ]]
--[[ Options (name, arg, max, bg_colour, bg_alpha, xc, yc, radius, thickness, start_angle, end_angle):
    "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
    "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
    "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
    "bg_colour" is the colour of the base ring.
    "bg_alpha" is the alpha value of the base ring.
    "fg_colour" is the colour of the indicator part of the ring.
    "fg_alpha" is the alpha value of the indicator part of the ring.
    "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
    "radius" is the radius of the ring.
    "thickness" is the thickness of the ring, centred around the radius.
    "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
    "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger (e.g. more clockwise) than start_angle. ]]

function ring(cr, name, arg, max, bgc, bga, fgc, fga, xc, yc, r, t, sa, ea)
    local function rgb_to_r_g_b(colour, alpha)
        return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
    end
    
    local function draw_ring(pct)
        local angle_0 = sa * (2 * math.pi/360) - math.pi/2
        local angle_f = ea * (2 * math.pi/360) - math.pi/2
        local pct_arc = pct * (angle_f - angle_0)

        -- Draw background ring

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

        cairo_arc(cr, xc, yc, r, angle_0, angle_0 + pct_arc)
        cairo_set_source_rgba(cr, rgb_to_r_g_b(fgc, fga))
        cairo_stroke(cr)
    end
    
    local function setup_ring()
        local str = ''
        local value = 0
        
        str = string.format('${%s %s}', name, arg)
        str = conky_parse(str)
        
        value = tonumber(str)
        if value == nil then value = 0 end
        pct = value/max
        
        draw_ring(pct)
    end    
    
    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)
    
    if update_num > 0 then setup_ring() end
end

--[[ END RING WIDGET ]]

--[[ RING (COUNTER-CLOCKWISE) WIDGET ]]
--[[ v1.1 by londonali1010 (2009) ]]
--[[ Options (name, arg, max, bg_colour, bg_alpha, xc, yc, radius, thickness, start_angle, end_angle):
    "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
    "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
    "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
    "bg_colour" is the colour of the base ring.
    "bg_alpha" is the alpha value of the base ring.
    "fg_colour" is the colour of the indicator part of the ring.
    "fg_alpha" is the alpha value of the indicator part of the ring.
    "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
    "radius" is the radius of the ring.
    "thickness" is the thickness of the ring, centred around the radius.
    "start_angle" is the starting angle of the ring, in degrees, counter-clockwise from top. Value can be either positive or negative.
    "end_angle" is the ending angle of the ring, in degrees, counter-clockwise from top. Value can be either positive or negative, but must be larger (e.g. more counter-clockwise) than start_angle. ]]

function ring_ccw(cr, name, arg, max, bgc, bga, fgc, fga, xc, yc, r, t, sa, ea)
    local function rgb_to_r_g_b(colour, alpha)
        return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
    end
    
    local function draw_ring(pct)
        local angle_0 = sa * (2 * math.pi/360) - math.pi/2
        local angle_f = ea * (2 * math.pi/360) - math.pi/2
        local pct_arc = pct * (angle_f - angle_0)

        -- Draw background ring

        cairo_arc_negative(cr, xc, yc, r, angle_0, angle_f)
        cairo_set_source_rgba(cr, rgb_to_r_g_b(bgc, bga))
        cairo_set_line_width(cr, t)
        cairo_stroke(cr)
    
        -- Draw indicator ring

        cairo_arc_negative(cr, xc, yc, r, angle_0, angle_0 + pct_arc)
        cairo_set_source_rgba(cr, rgb_to_r_g_b(fgc, fga))
        cairo_stroke(cr)
    end
    
    local function setup_ring()
        local str = ''
        local value = 0
        
        str = string.format('${%s %s}', name, arg)
        str = conky_parse(str)
        
        value = tonumber(str)
        if value == nil then value = 0 end
        pct = value/max
        
        draw_ring(pct)
    end    
    
    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)
    
    if update_num > 0 then setup_ring() end
end

--[[ END RING (COUNTER-CLOCKWISE) WIDGET ]]

function conky_widgets()
    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)
    
    --5)----------------------------------------------------------------------------------------------------------------------
    
    --[[ REPO (Left) ]]
    cr = cairo_create(cs) --outer
    ring(cr, 'exec ~/.conky/updates_rings_outer', '', 1, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 261, 768, 129, 10, 270, 321)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    cr = cairo_create(cs) --inner
    ring(cr, 'exec ~/.conky/updates_rings_inner', '', 1, 0xFFFFFF, 0.1, 0xFFFFFF, 0.50, 261, 768, 118, 10, 270, 321)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    
    
    --[[ REPO (Right) ]]
    cr = cairo_create(cs) --outer
    ring_ccw(cr, 'exec ~/.conky/updates_rings_outer', '', 1, 0x000000, 0.1, 0x000000, 0.50, 105, 768, 129, 10, 90, 44)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
    cr = cairo_create(cs) --inner
    ring_ccw(cr, 'exec ~/.conky/updates_rings_inner', '', 1, 0x000000, 0.1, 0x000000, 0.50, 105, 768, 118, 10, 90, 44)
    --function(cr, name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, x, y, radius, thickness, start_angle, end_angle)
    cairo_destroy(cr)
    
end

updates_rings_inner
Kod:
#!/usr/bin/perl
## script by Xyne
## http://bbs.archlinux.org/viewtopic.php?id=57291
use strict;
use warnings;
my $n = (`pacman -Qu | wc -l`);
if ($n == 0)
{
     print "0"
}
elsif($n == 1)
{
     print "0"
}
else
{
print "1"
}

updates_rings_outer
Kod:
#!/usr/bin/perl
## script by Xyne
## http://bbs.archlinux.org/viewtopic.php?id=57291
use strict;
use warnings;
my $n = (`pacman -Qu | wc -l`);
if ($n == 0)
{
     print "0"
}
elsif($n == 1)
{
     print "1"
}
else
{
print "1"
}

Hi! I'm a PC.......
and I'm MAC..........
AND WE ARE LINUX........................................
04.05.2011 10:56:34
Znajdź wszystkie posty użytkownika Odpowiedz cytując ten post
Odpowiedz 


Podobne wątki
Wątek: Autor Odpowiedzi: Wyświetleń: Ostatni post
Information konfiguracja conky jak na przykładzie iRafciu 14 3 881 12.10.2009 19:15:35
Ostatni post: Enlik

Skocz do:


Użytkownicy przeglądający ten wątek: 1 gości

Kontakt | Linux360.pl - forum | Wróć do góry | Wróć do forów | Wersja bez grafiki | RSS