常见简洁的.conkyrc

仅供存放个人的配置文件,不要在本版发问。
回复
头像
yu19871215
帖子: 22
注册时间: 2009-04-11 15:26

常见简洁的.conkyrc

#1

帖子 yu19871215 » 2010-08-13 15:53

use_spacer right
use_xft yes
background yes
font Microsoft YaHei:size=11
xftfont Microsoft YaHei:size=11
#xftfont Sans:size=10
override_utf8_locale yes
update_interval 1.0
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 100 775
maximum_width 775
border_margin 1
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders yes
default_color white
default_shade_color 000000
default_outline_color 000000
alignment top_right
gap_x 10
gap_y 20
cpu_avg_samples 2
uppercase no # set to yes if you want all text to be in uppercase
# Lua Load #

lua_load ~/.lua/scripts/clock_rings.lua

lua_draw_hook_pre clock_rings
TEXT
${color white} ${font Microsoft YaHei:size=12}日期时间${font} ${color}${font Microsoft YaHei:size=10}$font $color
${font Microsoft YaHei:size=17}${time %H:%M:%S}${font Microsoft YaHei:size=11}${alignr}${time %Y年%b%d日星期%a}${color}${font}

${font 文泉驿等宽微米黑:size=10}${color white}${alignc}日 一 二 三 四 五 六${font}

${color}${font 文泉驿等宽微米黑:size=10}${execpi 300 export LC_TIME=C; DJS=`date +%_d`; cal | sed '1d' | sed '/./!d' | sed 's/$/ /' | fold -w 21 | sed -n '/^.\{21\}/p' | sed 's/^/${alignc} /' | sed /" $DJS "/s/" $DJS "/" "'${color #6F97EF}'"$DJS"'${color}'" "/}${font}

${color white} ${font Microsoft YaHei:size=12}系统信息${font Microsoft YaHei:size=11}$font $color

登录用户名: ${color white}$alignr$nodename${color}
内核: ${color white}$alignr$sysname $kernel${color}
本次运行时间: ${color white}$alignr$uptime${color}
${color white}处理器温度:$color $acpitemp°C(T)
$color${font Microsoft YaHei:size=10}处理器使用率@${freq}MHz: ${cpu cpu1}% ${alignr}${cpubar cpu1 10,70}
$color ${top name 1} $alignr ${top cpu 1}%
$color ${top name 2} $alignr ${top cpu 2}%
$color ${top name 3} $alignr ${top cpu 3}%
$color ${top name 4} $alignr ${top cpu 4}%
$color ${top name 5} $alignr ${top cpu 5}%
内存 ${alignr}$mem / $memmax ($memperc%)
${membar 10}
交换空间 ${alignr}$swap / $swapmax ($swapperc%)
${swapbar 10}
${color white}Home: ${color}${alignr}${fs_free /home} / ${fs_size /home}
${color white}${fs_bar 10 /home}
${color white}资料文件: ${color}${alignr}${fs_free /media/资料文件} / ${fs_size /media/资料文件}
${color white}${fs_bar 10 /media/资料文件}
${color white}网络下载:${color} ${downspeed eth0} k/s ${alignr}${color white}网络上传:${color} ${upspeed eth0} k/s
下载总量 ${totaldown eth0} ${alignr}上传总量 ${totalup eth0}
${downspeedgraph eth0 20,110} ${alignr}${upspeedgraph eth0 20,110}
${color white}倒计时${color}
${color white}${font Microsoft YaHei:style=normal:pixelsize=13}${alignc}元旦${exec echo $((($(date --date=2011-01-01 +%s)-$(date +%s))/86400))}天

# Lua Load #

--[[

Clock Rings by londonali1010 (2009) Edited by jpope



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)

v1.1p -- Jpope edit (05.10.2009)

]]



settings_table = {

{

-- Edit this table to customise your rings.

-- You can create more rings simply by adding more elements to settings_table.

-- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.

name='time',

-- "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 ''.

arg='%I.%M',

-- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.

max=12,

-- "bg_colour" is the colour of the base ring.

bg_colour=0xffffff,

-- "bg_alpha" is the alpha value of the base ring.

bg_alpha=0.1,

-- "fg_colour" is the colour of the indicator part of the ring.

fg_colour=0x3399cc,

-- "fg_alpha" is the alpha value of the indicator part of the ring.

fg_alpha=0.2,

-- "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.

x=100, y=150,

-- "radius" is the radius of the ring.

radius=50,

-- "thickness" is the thickness of the ring, centred around the radius.

thickness=5,

-- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.

start_angle=0,

-- "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 than start_angle.

end_angle=360

},

{

name='time',

arg='%M.%S',

max=60,

bg_colour=0xffffff,

bg_alpha=0.1,

fg_colour=0x3399cc,

fg_alpha=0.4,

x=100, y=150,

radius=56,

thickness=5,

start_angle=0,

end_angle=360

},

{

name='time',

arg='%S',

max=60,

bg_colour=0xffffff,

bg_alpha=0.1,

fg_colour=0x3399cc,

fg_alpha=0.6,

x=100, y=150,

radius=62,

thickness=5,

start_angle=0,

end_angle=360

},

{

name='time',

arg='%d',

max=31,

bg_colour=0xffffff,

bg_alpha=0.1,

fg_colour=0x3399cc,

fg_alpha=0.8,

x=100, y=150,

radius=70,

thickness=5,

start_angle=0,

end_angle=270

},

{

name='time',

arg='%m',

max=12,

bg_colour=0xffffff,

bg_alpha=0.1,

fg_colour=0x3399cc,

fg_alpha=1,

x=100, y=150,

radius=76,

thickness=5,

start_angle=0,

end_angle=270

},

}



-- 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=100

clock_y=150



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)

end

end



draw_clock_hands(cr,clock_x,clock_y)

end
附件
桌面截图
桌面截图
上次由 yu19871215 在 2010-08-31 22:28,总共编辑 4 次。
但攻己过,毋议人非
头像
行远自迩
帖子: 403
注册时间: 2009-04-19 15:27

Re: 常见简洁的.conkyrc

#3

帖子 行远自迩 » 2010-08-13 23:31

配合使用的什么主题啊?挺漂亮的!
无从完美。
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 常见简洁的.conkyrc

#4

帖子 eexpress » 2010-08-14 0:34

宽度似乎控制得不好。可以强制的。
● 鸣学
头像
qingwu77
帖子: 162
注册时间: 2010-01-12 11:13

Re: 常见简洁的.conkyrc

#5

帖子 qingwu77 » 2010-08-21 16:13

不错,不过关机怎么自动开启呢?
Linux or Windows?
Of course,Linux!
Ubuntu or others?
Of course,ubuntu!
头像
qingwu77
帖子: 162
注册时间: 2010-01-12 11:13

Re: 常见简洁的.conkyrc

#6

帖子 qingwu77 » 2010-08-21 16:13

不错,不过关机怎么自动开启呢?
Linux or Windows?
Of course,Linux!
Ubuntu or others?
Of course,ubuntu!
头像
cnmonkey
帖子: 10
注册时间: 2008-09-29 0:16

Re: 常见简洁的.conkyrc

#7

帖子 cnmonkey » 2010-08-24 5:47

:em11好看,支持支持。
回复