菜单

从conky1.9到1.10中配置文件的变化

2015年9月30日 - Linux & homelab

系统升级完后,发现conky挂了,在命令行中启动,输出错误:配置文件的语法不正确

原来,conky1.9升级到了1.10后,由于采用了新的配置文件语法,所以以前的配置文件都无法使用了

以下是官方的升级信息:

Today is Conky's 10th birthday. And with that, a new release is here. This release contains a host of bug fixes and new features. Here's a quick overview:

    Partial rewrite in C++ (from C)
    New Lua-based config system
    New CMake-based build system
    Support for newer GCC versions

注意第二行,使用了新的基于lua语法的配置文件系统

所以我们就没有办法使用以前的配置文件了吗?当然不会,我们仅需对配置文件进行简单的修改即可

无外乎就一下几点:
1.将以#开头的注释改为改为以-- 开头
2.将TEXT前的配置部分放入conky.config = { ... }中,并在每行配置的末尾加上,
3.将配置部分的yesno分别改为truefalse
4.配置部分除true、false和数字外的任何值都要用引号包裹
5.将TEXT后的显示部分放入conky.text = [[ ... ]]中,然后去除TEXT标记

还有一些配置部分的小的不同,参考我的配置文件改改就可以了。

我改好的配置文件:

-- ==============================================================================
--                                conkyrc_blue
--  Date    : 25/09/2015
--  Author  : WuSiYu
--  Version : v0.2
--  License : Distributed under the terms of GNU GPL version 2 or later
--
--  This version is a modification of conkyrc_seamod
-- ==============================================================================

conky.config = {

    -- Use double buffering (eliminates flickering)
    double_buffer = true,

    -- Subtract file system buffers from used memory
    no_buffers = true,

    background = true,
    update_interval = 1,

    cpu_avg_samples = 2,

    -- Window size and position
    minimum_width = 300,
    minimum_height = 700,
    maximum_width = 300,
    alignment = 'top_right',
    gap_x = 20,
    gap_y = 45,

    -- Makes conky window transparent
    own_window = true,
    own_window_class = 'Conky',
    own_window_argb_visual = true,
    own_window_argb_value = 127,
    own_window_transparent = false,
    own_window_type = 'normal',
    own_window_hints = 'undecorated,below,skip_taskbar,sticky,skip_pager',

    -- Default color and border settings
    default_color = 'white',
    draw_shades = false,
    draw_outline = false,
    draw_borders = false,
    draw_graph_borders = false,

    -- Use Xft (anti-aliased font and stuff)
    use_xft = true,
    font = 'Terminus:size=10',
    xftalpha = 0.8,
    uppercase = false,

    -- Defining colors,
    default_color = 'FFFFFF',
    -- Shades of Gray,
    color1 = 'DDDDDD',
    color2 = 'AAAAAA',
    color3 = '888888',
    -- Blue,
    color4 = '20B0FF',
    -- Green,
    color5 = '77B753',

    -- Loading lua script for drawning rings,
    lua_load = './rings.lua',
    lua_draw_hook_post = 'main',

    -- Header with base system info,
    own_window_argb_value = 0,
    own_window_colour = '000000'

}

conky.text = [[
${font WenQuanYi Zen Hei:size=10,weight:bold}${color4}SYSTEM ${color1}${hr 2}
${offset 5}${font WenQuanYi Zen Hei:size=10,weight:normal}${color1}$sysname $kernel${alignr}$nodename
${offset 5}${font WenQuanYi Zen Hei:size=10,weight:normal}${color1}Time: ${time %k:%M:%S}${alignr}Uptime: $uptime
${offset 5}${font WenQuanYi Zen Hei:size=10,weight:normal}${color1}Processes:$processes${alignr}$loadavg
# Showing CPU Graph
${voffset 30}
${offset 120}${cpugraph 40,180 666666 666666}${voffset -25}
${offset 75}${font WenQuanYi Zen Hei:size=10,weight:bold}${color5}CPU
# Showing TOP 5 CPU-consumers
${offset 90}${font WenQuanYi Zen Hei:size=10,weight:normal}${color4}${top name 1}${alignr}${top cpu 1}%
${offset 90}${font WenQuanYi Zen Hei:size=10,weight:normal}${color2}${top name 2}${alignr}${top cpu 2}%
${offset 90}${font WenQuanYi Zen Hei:size=10,weight:normal}${color2}${top name 3}${alignr}${top cpu 3}%
${offset 90}${font WenQuanYi Zen Hei:size=10,weight:normal}${color3}${top name 4}${alignr}${top cpu 4}%
${offset 90}${font WenQuanYi Zen Hei:size=10,weight:normal}${color3}${top name 5}${alignr}${top cpu 5}%

#Showing memory part with TOP 5
${voffset 32}
${offset 75}${font WenQuanYi Zen Hei:size=10,weight:bold}${color5}MEM
${offset 90}${font WenQuanYi Zen Hei:size=10,weight:normal}${color4}${top_mem name 1}${alignr}${top_mem mem 1}%
${offset 90}${font WenQuanYi Zen Hei:size=10,weight:normal}${color2}${top_mem name 2}${alignr}${top_mem mem 2}%
${offset 90}${font WenQuanYi Zen Hei:size=10,weight:normal}${color2}${top_mem name 3}${alignr}${top_mem mem 3}%
${offset 90}${font WenQuanYi Zen Hei:size=10,weight:normal}${color3}${top_mem name 4}${alignr}${top_mem mem 4}%
${offset 90}${font WenQuanYi Zen Hei:size=10,weight:normal}${color3}${top_mem name 4}${alignr}${top_mem mem 5}%

# Showing disk partitions: root, home and mnt/data
${voffset 35}
${offset 75}${font WenQuanYi Zen Hei:size=10,weight:bold}${color5}DISKS
${offset 120}${diskiograph 33,180 666666 666666}${voffset -30}
${voffset 20}
${offset 5}${font WenQuanYi Zen Hei:size=9,weight:bold}${color1}Free: ${font WenQuanYi Zen Hei:size=9,weight:normal}${fs_free /}${alignr}${font WenQuanYi Zen Hei:size=9,weight:bold}Used: ${font WenQuanYi Zen Hei:size=9,weight:normal}${fs_used /}
${offset 5}${font WenQuanYi Zen Hei:size=9,weight:bold}${color1}Free: ${font WenQuanYi Zen Hei:size=9,weight:normal}${fs_free /home}${alignr}${font WenQuanYi Zen Hei:size=9,weight:bold}Used: ${font WenQuanYi Zen Hei:size=9,weight:normal}${fs_used /home}
${offset 5}${font WenQuanYi Zen Hei:size=9,weight:bold}${color1}Free: ${font WenQuanYi Zen Hei:size=9,weight:normal}${fs_free /mnt/data}${alignr}${font WenQuanYi Zen Hei:size=9,weight:bold}Used: ${font WenQuanYi Zen Hei:size=9,weight:normal}${fs_used /mnt/data}

${voffset -40}

${color1}${hr 2}
]]

		
0

发表评论

电子邮件地址不会被公开。 必填项已用*标注