当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 15 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : conky 时钟指针颜色怎么改?
帖子发表于 : 2010-09-16 19:13 
头像

注册: 2010-07-21 14:51
帖子: 75
送出感谢: 0 次
接收感谢: 0 次
下了个conky蛋蛋图(不知什么意思,也不知叫不叫蛋蛋),反正就是有个圆形时钟,都是蓝色的,我桌面背景也是蓝色的,想换下颜色怎么换?

TEXT
${voffset 8}${color 3399FF}${font WenQuanYi Micro Hei:size=16}${time %A}${font}${voffset -8}${alignr 50}${color FFFFFF}${font caviar dreams:size=36}${time %e}${font}
${color FFFFFF}${voffset -30}${color 3399FF}${font WenQuanYi Micro Hei:size=18}${time %b}${font}${voffset -3} ${color FFFFFF}${font caviar dreams:size=20}${time %Y}${font}${color 3399FF}${hr}
${voffset 140}${font caviar dreams:size=10}${alignr}Home${font}
${font caviar dreams:size=12}${color FFFFFF}${alignr}${acpitemp}掳C${font}
${color 3399FF}${voffset 6}${sysname}${alignr}${kernel}${machine}
Uptime:$alignr${color FFFFFF}$uptime_short


页首
 用户资料  
 
2 楼 
 文章标题 : Re: conky 时钟指针颜色怎么改?
帖子发表于 : 2010-09-16 19:14 
头像

注册: 2010-07-21 14:51
帖子: 75
送出感谢: 0 次
接收感谢: 0 次
部分设置,我以为就在这段里。


页首
 用户资料  
 
3 楼 
 文章标题 : Re: conky 时钟指针颜色怎么改?
帖子发表于 : 2010-09-16 19:16 
头像

注册: 2008-03-25 15:49
帖子: 25877
地址: 谁知道?
送出感谢: 8
接收感谢: 10
就叫蛋蛋
颜色不会。


页首
 用户资料  
 
4 楼 
 文章标题 : Re: conky 时钟指针颜色怎么改?
帖子发表于 : 2010-09-16 22:23 
头像

注册: 2010-07-21 14:51
帖子: 75
送出感谢: 0 次
接收感谢: 0 次
3399FF 和 FFFFFF 是颜色吗?


页首
 用户资料  
 
5 楼 
 文章标题 : Re: conky 时钟指针颜色怎么改?
帖子发表于 : 2010-09-16 22:32 
头像

注册: 2007-10-20 11:30
帖子: 1132
送出感谢: 1
接收感谢: 0 次
color 后面的应该是了


页首
 用户资料  
 
6 楼 
 文章标题 : Re: conky 时钟指针颜色怎么改?
帖子发表于 : 2010-09-16 22:50 
头像

注册: 2008-02-17 23:47
帖子: 22120
地址: 美丽富饶的那啥星球
送出感谢: 11
接收感谢: 84
你这是conky配置文件,时钟颜色要改lua脚本


_________________
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手


页首
 用户资料  
 
7 楼 
 文章标题 : Re: conky 时钟指针颜色怎么改?
帖子发表于 : 2010-09-16 23:19 
头像

注册: 2009-10-16 22:46
帖子: 18958
地址: finland
送出感谢: 28
接收感谢: 48
FFFFFF 貌似是颜色吧


_________________
>>>>推Ubuntu 桌面培训~~<<<<
>>>>想加入/了解gimp汉化吗,点我吧~<<<<
——————————————————————
不推荐wubi,也不推荐你给别人推荐wubi…………
随心而为的感觉真好……
强推mayhem!!
强推ensiferum


页首
 用户资料  
 
8 楼 
 文章标题 : Re: conky 时钟指针颜色怎么改?
帖子发表于 : 2010-09-17 9:33 
头像

注册: 2010-07-21 14:51
帖子: 75
送出感谢: 0 次
接收感谢: 0 次
adagio 写道:
你这是conky配置文件,时钟颜色要改lua脚本


找到了,正解,我都把她忘了 :em06


页首
 用户资料  
 
9 楼 
 文章标题 : Re: conky 时钟指针颜色怎么改?
帖子发表于 : 2010-09-17 10:08 
头像

注册: 2010-07-21 14:51
帖子: 75
送出感谢: 0 次
接收感谢: 0 次
外面几个圈圈的颜色知道哪里改了,指针在哪?


页首
 用户资料  
 
10 楼 
 文章标题 : Re: conky 时钟指针颜色怎么改?
帖子发表于 : 2010-09-17 12:30 
头像

注册: 2008-02-17 23:47
帖子: 22120
地址: 美丽富饶的那啥星球
送出感谢: 11
接收感谢: 84
这个脚本其实很简单,看看变量名称就知道起什么作用,比如这段定义了分针那个圆圈,单位是屏幕像素
代码:
  {
        name='time',    ----变量名
        arg='%M',    ----调用函数
        max=60,   ----最大步进
        bg_colour=0xffffff,    ----背景色
        bg_alpha=0.2,   ----背景透明度
        fg_colour=0x00ffb8,    ----前景色
        fg_alpha=0.6,    ----前景透明度
        x=100, y=385,    ----中点坐标
        radius=45,    ----半径
        thickness=6,    ----圆圈描边宽度
        start_angle=0,    ----起始角度
        end_angle=360    ----终止角度
    },

指针则由 function draw_ring(cr,t,pt)函数定义


这是我的conky
[lua]--[[
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',
-- "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.2,
-- "fg_colour" is the colour of the indicator part of the ring.
fg_colour=0x00a6ff,
-- "fg_alpha" is the alpha value of the indicator part of the ring.
fg_alpha=0.7,
-- "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=385,
-- "radius" is the radius of the ring.
radius=30,
-- "thickness" is the thickness of the ring, centred around the radius.
thickness=15,
-- "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',
max=60,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0x00ffb8,
fg_alpha=0.6,
x=100, y=385,
radius=45,
thickness=6,
start_angle=0,
end_angle=360
},
{
name='time',
arg='%S',
max=60,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0xfd1cff,
fg_alpha=0.8,
x=100, y=385,
radius=53,
thickness=1,
start_angle=0,
end_angle=360
},
{
name='time',
arg='%H',
max=24,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0x00ffff,
fg_alpha=0.4,
x=100, y=385,
radius=70,
thickness=4,
start_angle=5,
end_angle=180
},
{
name='time',
arg='%d',
max=30,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0x0068ff,
fg_alpha=1,
x=100, y=385,
radius=60,
thickness=4,
start_angle=-90,
end_angle=0
},
{
name='time',
arg='%m',
max=12,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0x7d7d7d,
fg_alpha=1,
x=100, y=385,
radius=80,
thickness=4,
start_angle=-68,
end_angle=-30
},
{
name='time',
arg='%u',
max=7,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0x0038ff,
fg_alpha=1,
x=100, y=385,
radius=85,
thickness=4,
start_angle=120,
end_angle=140
},
{
name='cpu',
arg='cpu0',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0xff0800,
fg_alpha=0.6,
x=35, y=463,
radius=30,
thickness=4,
start_angle=-90,
end_angle=180
},
{
name='cpu',
arg='cpu1',
max=100,
bg_colour=0xccff33,
bg_alpha=0.2,
fg_colour=0xff0800,
fg_alpha=0.6,
x=35, y=463,
radius=25,
thickness=4,
start_angle=-90,
end_angle=180
},
{
name='acpitemp',
arg='',
max=100,
bg_colour=0xccff33,
bg_alpha=0.2,
fg_colour=0xff9d00,
fg_alpha=0.6,
x=35, y=463,
radius=20,
thickness=4,
start_angle=-90,
end_angle=180
},
{
name='memperc',
arg='',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0x33ccff,
fg_alpha=0.8,
x=73, y=505,
radius=15,
thickness=5,
start_angle=-90,
end_angle=180
},
{
name='fs_used_perc',
arg='/',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0x3399cc,
fg_alpha=0.6,
x=123, y=550,
radius=40,
thickness=4,
start_angle=-90,
end_angle=180
},
{
name='fs_used_perc',
arg='/home',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0x3bff00,
fg_alpha=0.5,
x=123, y=550,
radius=35,
thickness=4,
start_angle=-90,
end_angle=180
},
{
name='fs_used_perc',
arg='/home/MNT/HT1T/H.P2P',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0xe7ff00,
fg_alpha=0.5,
x=123, y=550,
radius=30,
thickness=4,
start_angle=-90,
end_angle=180
},
{
name='upspeedf',
arg='ppp0',
max=150,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0xff9500,
fg_alpha=0.6,
x=150, y=620,
radius=20,
thickness=4,
start_angle=-90,
end_angle=180
},
{
name='downspeedf',
arg='ppp0',
max=550,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0x6dff00,
fg_alpha=0.6,
x=150, y=620,
radius=25,
thickness=4,
start_angle=-90,
end_angle=180
},
}

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

clock_r=56

-- "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=385

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.63*clock_r*math.sin(hours_arc)
yh=yc-0.63*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.8,0.8,0.9,0.6)
cairo_stroke(cr)

-- Draw minute hand

xm=xc+0.82*clock_r*math.sin(mins_arc)
ym=yc-0.82*clock_r*math.cos(mins_arc)
cairo_move_to(cr,xc,yc)
cairo_line_to(cr,xm,ym)

cairo_set_line_width(cr,3)
cairo_stroke(cr)

-- Draw seconds hand

if show_seconds then
xs=xc+clock_r*math.sin(secs_arc)
ys=yc-clock_r*math.cos(secs_arc)
cairo_move_to(cr,xc,yc)
cairo_line_to(cr,xs,ys)

cairo_set_line_width(cr,1)
cairo_stroke(cr)
end
end

function conky_clock_rings()
local function setup_rings(cr,pt)
local str=''
local value=0

str=string.format('${%s %s}',pt['name'],pt['arg'])
str=conky_parse(str)

value=tonumber(str)
pct=value/pt['max']

draw_ring(cr,pct,pt)
end

-- Check that Conky has been running for at least 5s

if conky_window==nil then return end
local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)

local cr=cairo_create(cs)

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

if update_num>5 then
for i in pairs(settings_table) do
setup_rings(cr,settings_table[i])
end
end

draw_clock_hands(cr,clock_x,clock_y)
end[/lua]
附件:
20100917-121414_241x910.jpg
20100917-121414_241x910.jpg [ 70.5 KiB | 被浏览 1108 次 ]



conky配置在这里
viewtopic.php?f=24&t=284269


_________________
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手


页首
 用户资料  
 
11 楼 
 文章标题 : Re: conky 时钟指针颜色怎么改?
帖子发表于 : 2010-09-17 13:52 
头像

注册: 2010-07-21 14:51
帖子: 75
送出感谢: 0 次
接收感谢: 0 次
谢谢,学习了。 用linux真好


页首
 用户资料  
 
12 楼 
 文章标题 : Re: conky 时钟指针颜色怎么改?
帖子发表于 : 2010-09-17 22:47 
头像

注册: 2005-08-14 19:53
帖子: 4000
送出感谢: 1
接收感谢: 2
conky开启了lua,cario后会不会增加较多cpu占用啊。我CPU不太好


页首
 用户资料  
 
13 楼 
 文章标题 : Re: conky 时钟指针颜色怎么改?
帖子发表于 : 2010-09-18 11:45 
头像

注册: 2008-02-17 23:47
帖子: 22120
地址: 美丽富饶的那啥星球
送出感谢: 11
接收感谢: 84
内存占用大概多了1M,CPU占用基本1%,我是AMD 7750双核,鸭梨不大 :em04


_________________
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手


页首
 用户资料  
 
14 楼 
 文章标题 : Re: conky 时钟指针颜色怎么改?
帖子发表于 : 2010-09-18 11:57 
头像

注册: 2008-02-17 23:47
帖子: 22120
地址: 美丽富饶的那啥星球
送出感谢: 11
接收感谢: 84
jarryson, arch源里的conky,好像不支持lua是不是?
我装了AUR里的conky-lua才行,否则那些蛋蛋一个都出不来,版本都是1.8
可是这个conky好像又不支持python脚本了,没法显示天气
有没有一个全功能的版本?告诉一下 :em02


_________________
明天就换大三八!
——8核CPU、8G内存、8T硬盘……
8卡交火,80寸大屏放8个……
IPv8的光纤要8条……

---------------------------------------------------------------------------------
[图片版]新手当自强(续)FAQ
[新手进阶]挂载、fstab、调整linux分区
[图片版]E17桌面环境配置手把手


页首
 用户资料  
 
15 楼 
 文章标题 : Re: conky 时钟指针颜色怎么改?
帖子发表于 : 2010-09-18 12:51 
头像

注册: 2005-08-14 19:53
帖子: 4000
送出感谢: 1
接收感谢: 2
源里面的是不支持lua。

conky本身就不支持python,利用的是exec来执行python脚本。你看相应语句bash里面能不能运行。。


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 15 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 2 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译