conky 时钟,cpu,wireless, battery, memory合体。。哇哈哈
- Vanishing
- 帖子: 227
- 注册时间: 2009-04-16 9:58
conky 时钟,cpu,wireless, battery, memory合体。。哇哈哈
有图有真相
最里面3个环是时间(秒针,分针,时针)
第4个:wireless signal
5:battery%
6: memory%
7:cpu%
可以加filesystem.
requirement:conky 1.7.2 with Cairo and lua enabled when compiling,或者源里的conky-all(推荐,全功能,不是半残版本。。)
最里面3个环是时间(秒针,分针,时针)
第4个:wireless signal
5:battery%
6: memory%
7:cpu%
可以加filesystem.
requirement:conky 1.7.2 with Cairo and lua enabled when compiling,或者源里的conky-all(推荐,全功能,不是半残版本。。)
上次由 Vanishing 在 2009-10-26 1:49,总共编辑 3 次。
I lay down on my bed, looking at the stars, and starting to wonder............................................ .where the f*** is my roof..
-
- 帖子: 38
- 注册时间: 2008-07-25 22:04
Re: conky 时钟,cpu,wireless, battery, memory合体。。哇哈哈
怎么弄的,给发个配置看看
- Vanishing
- 帖子: 227
- 注册时间: 2009-04-16 9:58
Re: conky 时钟,cpu,wireless, battery, memory合体。。哇哈哈
wyddr 写了:怎么弄的,给发个配置看看
代码: 全选
--[[
Clock Rings by londonali1010 (2009)
modified by Vanishing
]]
settings_table = {
{
name='cpu',
arg='cpu0',
max=100,
bg_colour=0xFFFFFF,
bg_alpha=0,
fg_colour=0xFFFFFF,
fg_alpha=0.3,
x=75, y=75,
radius=63,
thickness=13,
start_angle=0,
end_angle=360
},
{
name='memperc',
arg='',
max=100,
bg_colour=0xFFFFFF,
bg_alpha=0.1,
fg_colour=0xFFFFFF,
fg_alpha=0.8,
x=75, y=75,
radius=55,
thickness=3,
start_angle=0,
end_angle=360
},
{
name='battery_percent',
arg="BAT0",
max=100,
bg_colour=0xFFFFFF,
bg_alpha=0.1,
fg_colour=0xFFFFFF,
fg_alpha=0.6,
x=75, y=75,
radius=50,
thickness=3,
start_angle=0,
end_angle=360
},
{
name='wireless_link_qual_perc',
arg='wlan0',
max=100,
bg_colour=0xFFFFFF,
bg_alpha=0.1,
fg_colour=0xFFFFFF,
fg_alpha=0.9,
x=75, y=75,
radius=40,
thickness=13,
start_angle=0,
end_angle=360
},
{
name='time',
arg='%I',
max=12,
bg_colour=0xFFFFFF,
bg_alpha=0.1,
fg_colour=0xFFFFFF,
fg_alpha=0.5,
x=75, y=75,
radius=30,
thickness=3,
start_angle=0,
end_angle=360
},
{
name='time',
arg='%M',
max=60,
bg_colour=0xFFFFFF,
bg_alpha=0.1,
fg_colour=0xFFFFFF,
fg_alpha=0.6,
x=75, y=75,
radius=24,
thickness=5,
start_angle=0,
end_angle=360
},
{
name='time',
arg='%S',
max=60,
bg_colour=0xFFFFFF,
bg_alpha=0.1,
fg_colour=0xFFFFFF,
fg_alpha=0.9,
x=75, y=75,
radius=10,
thickness=18,
start_angle=0,
end_angle=360
},
}
-- Use these settings to define the origin and extent of your clock.
clock_r=125
-- "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=195
clock_y=195
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/60
-- Draw hour hand
xh=xc+0.2*clock_r*math.sin(hours_arc)
yh=yc-0.2*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,1,1,1,0.8)
cairo_stroke(cr)
-- Draw minute hand
xm=xc+clock_r*math.sin(mins_arc)*0.4
ym=yc-clock_r*math.cos(mins_arc)*0.4
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)*0.5
ys=yc-clock_r*math.cos(secs_arc)*0.5
cairo_move_to(cr,xc,yc)
cairo_line_to(cr,xs,ys)
cairo_set_line_width(cr,1)
cairo_stroke(cr)
end
end
function conky_clock_rings()
local function setup_rings(cr,pt)
local str=''
local value=0
str=string.format('${%s %s}',pt['name'],pt['arg'])
str=conky_parse(str)
value=tonumber(str)
pct=value/pt['max']
draw_ring(cr,pct,pt)
end
-- Check that Conky has been running for at least 5s
if conky_window==nil then return end
local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)
local cr=cairo_create(cs)
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num>5 then
for i in pairs(settings_table) do
setup_rings(cr,settings_table[i])
end
end
draw_clock_hands(cr,75,75)
end
另存为到~/scripts/rings.lua
然后再conky里加载lua:(在TEXT之前)
代码: 全选
# -- Lua Load -- #
lua_load ~/scripts/rings.lua
lua_draw_hook_pre clock_rings
TEXT
I lay down on my bed, looking at the stars, and starting to wonder............................................ .where the f*** is my roof..
- princelai
- 帖子: 920
- 注册时间: 2007-01-06 21:00
- 联系:
-
- 帖子: 1
- 注册时间: 2009-11-13 22:24
Re: conky 时钟,cpu,wireless, battery, memory合体。。哇哈哈
sdgsadgfdhgsdhgsdf
- jxhow
- 帖子: 5859
- 注册时间: 2008-10-24 22:02
- 来自: 浙江
-
- 帖子: 1028
- 注册时间: 2008-11-01 21:42
- 来自: 树下板凳
- 东方不坏
- 帖子: 843
- 注册时间: 2007-04-05 3:09
- 系统: Deepin
- 来自: 身后某处
- 联系:
Re: conky 时钟,cpu,wireless, battery, memory合体。。哇哈哈
不但眼睛要好才看得清,而且显示器差了也不行。
[color=#FFFF00]东方不败[/color] 写了:
- OS:Ubuntu14.10
- CPU:Athlon II 651K
- RAM:威刚DDR3 1600 4GX2双通道
- 主板:GA-A75M-DS2
- 硬盘:西数64M版 2T
- 显卡:迅景6790
- 显示器:LG W2242TP
-
- 帖子: 45
- 注册时间: 2006-08-05 0:06
-
- 帖子: 3
- 注册时间: 2010-01-17 13:13
Re: conky 时钟,cpu,wireless, battery, memory合体。。哇哈哈
想必LZ在调试时也遇到过吧,我从Conky Hardcore!上也看到这个环的做法了,那篇文章的作者也在脚本前面的注释里说了这个错误的原因,但我看得不怎么明白。Conky: llua_do_call: function conky_clock_rings execution failed: attempt to call a nil value
还有,我是1024X768的屏幕,单核CPU,就想做一个跟你差不多的,只带有时、分、CPU使用、内存使用的环,放在右下角,怎么调试?谢谢
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
Re: conky 时钟,cpu,wireless, battery, memory合体。。哇哈哈
cairo的,就适合作环。
可conky里面带这个,是折腾。带lua就是折腾。
放桌面的时钟,那么多漂亮的,都不用。
那点阵的,换一个字体,就可以文本实现的。
可conky里面带这个,是折腾。带lua就是折腾。
放桌面的时钟,那么多漂亮的,都不用。
那点阵的,换一个字体,就可以文本实现的。
● 鸣学
- 黄美姬
- 帖子: 8428
- 注册时间: 2009-10-08 11:15
- 来自: 大城市铁岭
Re: conky 时钟,cpu,wireless, battery, memory合体。。哇哈哈
这么多环,被放环多次
我们是命运的妓女,它把我们都嫖了
N卡驱动:http://www.nvidia.cn/Download/index.aspx?lang=cn
极品飞车:http://www.geforce.cn/optimize/optimal- ... ts-450-ops
孤岛危机优化设置:http://www.geforce.cn/optimize/optimal- ... tx-450-ops
终端彩色:cp /etc/skel/.bashrc ~/
PS1="\[\e]2;\u@\H \w\a\e[32;1m\]\T$\[\e[0m\] "
http://cdimage.ubuntu.com/
http://releases.ubuntu.com/
N卡驱动:http://www.nvidia.cn/Download/index.aspx?lang=cn
极品飞车:http://www.geforce.cn/optimize/optimal- ... ts-450-ops
孤岛危机优化设置:http://www.geforce.cn/optimize/optimal- ... tx-450-ops
终端彩色:cp /etc/skel/.bashrc ~/
PS1="\[\e]2;\u@\H \w\a\e[32;1m\]\T$\[\e[0m\] "
http://cdimage.ubuntu.com/
http://releases.ubuntu.com/
- tenzu
- 论坛版主
- 帖子: 36924
- 注册时间: 2008-11-21 20:26
- Vanishing
- 帖子: 227
- 注册时间: 2009-04-16 9:58
Re: conky 时钟,cpu,wireless, battery, memory合体。。哇哈哈
不是让你躲着点么?又在这j什么?tenzu 写了:神太打击LZ了
I lay down on my bed, looking at the stars, and starting to wonder............................................ .where the f*** is my roof..
- karllv
- 帖子: 632
- 注册时间: 2008-12-04 17:23
Re: conky 时钟,cpu,wireless, battery, memory合体。。哇哈哈
lz把完整的配置贴出来吧