zoukankan      html  css  js  c++  java
  • 我的conky 配置(拆分版)

      conky 提供了丰富的配置属性变量 。在我的入门版 conkyrc 中,虽然我本想尽可能多得尝试添加不同的变量、命令函数、脚本,从而实现尽可能多的功能,可太多的花样儿难免会导致耗费过多资源、启动速度缓慢,以及在有限的屏幕空间中显示得过于拥挤。为了力求显示清楚,把原本密密麻麻的信息拆分开来放进两个 conky 窗口,应该是不错的选择。

     首先在登录后并且网络连接好之后,自动启动 conky 的命令应该有两条:

      conky -q -d

      conky -q -d -c  /路径/2ndconkyrc

     ~/.conkyrc :

    conkyrc_1
    background no
    override_utf8_locale yes
    font DejaVu Sans
    :size=9
    xftfont DejaVu Sans
    :size=9
    use_xft yes
    xftalpha 
    0.1

    update_interval 
    1.5
    total_run_times 
    0
    own_window yes
    #own_window_class Conky
    own_window_type desktop
    own_window_transparent no
    own_window_hints undecorated
    ,below,sticky,skip_taskbar,skip_pager
    double_buffer yes
    draw_shades no
    draw_outline no
    draw_borders no
    draw_graph_borders yes
    minimum_size 
    165 5
    maximum_width 
    225

    alignment middle_right
    gap_x 
    5
    gap_y 
    0
    #no_buffers yes
    cpu_avg_samples 2
    uppercase no 
    use_spacer none
    out_to_console no

    default_color moccasin
    default_shade_color black
    default_outline_color grey90

    TEXT
    ${font Yahei Mono
    :size=9}${exec ~/scripts/lunardate.py }
    ${font} ${
    exec whoami} @ $nodename${color} on $machine  ${color 22ccff} ${font OpenLogos:size=24}B 
    ${voffset 
    -36}${font}${color}Pacman: ${font Yahei Mono:size=10}${color green}${exec ~/scripts/conky-updates.pl}
    ${color}${voffset 
    -10}${stippled_hr}
    ${color}${font StyleBats
    :size=10}M${voffset -2}${font Yahei Mono:size=10} 进程:$alignr$processes个 ($running_processes 个活跃进程)  
    ${color}${font Martin Vogel
    's Symbols:size=10}h${font}${color slate grey} Highest CPU:$alignr -PID-    CPU%  
    ${color #ddaa00}${top name 1}$alignr${top pid 1}   ${top cpu 1}  
    ${color lightgrey}${top name 2}$alignr${top pid 2}   ${top cpu 2}  
    ${color lightgrey}${top name 3}$alignr${top pid 3}   ${top cpu 3}  
    ${color lightgrey}${top name 4}$alignr${top pid 4}   ${top cpu 4}  
    ${color}${font Martin Vogel
    's Symbols:size=10}j${font}${color slate grey} Highest MEM:$alignr -PID-    MEM%  
    ${color 
    #ddaa00}${top_mem name 1}$alignr${top_mem pid 1}   ${top_mem mem 1}  
    ${color lightgrey}${top_mem name 2}$alignr${top_mem pid 2}   ${top_mem mem 2}  
    ${color lightgrey}${top_mem name 
    3}$alignr${top_mem pid 3}   ${top_mem mem 3}  
    ${color lightgrey}${top_mem name 
    4}$alignr${top_mem pid 4}   ${top_mem mem 4}  
    ${voffset 
    -4}${stippled_hr}
    ${color slate grey}RAM
    :${color}   $alignr $memperc% used 
    ${color 8844ee}${membar 
    4,105$alignr${color}$mem/$memmax
    ${color slate grey}
    /: ${color} ${alignc}/dev/sda8 $alignr ${fs_free_perc /}% free 
    ${color 8844ee}${fs_bar 
    4,105 /$alignr${color}${fs_free /}/${fs_size /}
    ${color slate grey}windows
    : ${color} ${alignc}/dev/sda1 $alignr${fs_free_perc /mnt/windows}% free 
    ${color 8844ee}${fs_bar 
    4,105 /mnt/windows} $alignr${color}${fs_free /mnt/windows}/${fs_size /mnt/windows}
    ${color slate grey}cache
    : ${color} ${alignc}/dev/sda5 $alignr${fs_free_perc /mnt/cache}% free 
    ${color 8844ee}${fs_bar 
    4,105 /mnt/cache} $alignr${color}${fs_free /mnt/cache}/${fs_size /mnt/cache}
    ${color slate grey}DATA
    : ${color} ${alignc}/dev/sda6 $alignr${fs_free_perc /mnt/DATA}% free 
    ${color 8844ee}${fs_bar 
    4,105 /mnt/DATA} $alignr${color}${fs_free /mnt/DATA}/${fs_size /mnt/DATA}
    ${voffset 
    -4}${stippled_hr}
    ${color}${font PizzaDude Bullets
    :size=12}?${font} IP Address: $alignr${addr eth0}
    ${color}${font Yahei Mono
    :size=9}总计: ${color #8844ee}${font PizzaDude Bullets:size=10}M${font}  ${totalup eth0} ${alignr}${color #22ccff}${font PizzaDude Bullets:size=10}S${font}  ${totaldown eth0}   
    ${color slate grey}${font} Up: ${color #8844ee}${upspeed eth0}/s ${alignr}${color slate grey}Down: ${color #22ccff}${downspeed eth0}/s
    ${voffset -4}${color}${upspeedgraph eth0 30,100 8844ee 22ccff}$alignr${downspeedgraph eth0 30,100 8844ee 22ccff}
    ${voffset 
    -12}${color}${font Martin Vogel's Symbols:size=20}k${font}${color slate grey} ${voffset -8}E-Mail: RiverCrab@gmail.com
    ${font Yahei Mono:size=9}${color}$alignr  有 ${color #22ccff}${texeci 7200 perl ~/scripts/check_gmail.sh} ${color}封新邮件,来自: 
    ${voffset -4}${font DejaVu Sans:size=8}${execi 7200 ~/scripts/gmail.pl `~/scripts/check_gmail.sh`}


     2ndconkyrc :

    conkyrc_2
    background no
    override_utf8_locale yes
    font DejaVu Sans
    :size=9 
    xftfont DejaVu Sans
    :size=9
    use_xft yes
    xftalpha 
    0.1

    update_interval 
    1.5
    total_run_times 
    0
    own_window yes
    #own_window_class Conky
    own_window_type desktop
    own_window_transparent no
    own_window_hints undecorated
    ,below,sticky,skip_taskbar,skip_pager
    double_buffer yes
    draw_shades no
    draw_outline no
    draw_borders no
    draw_graph_borders yes
    minimum_size 
    165 5
    maximum_width 
    225

    alignment top_left
    gap_x 
    50
    gap_y 
    70
    #no_buffers yes
    cpu_avg_samples 2
    uppercase no 
    use_spacer none
    out_to_console no

    default_color moccasin
    default_shade_color black
    default_outline_color grey90

    TEXT
    ${execpi 
    10800 ~/scripts/weatherimg.sh}

    ${font Yahei Mono
    :size=10}当前天气:$alignr ${execi 10800 ~/scripts/conkytq.sh}
    ${execi 
    10800 ~/scripts/conditions.sh}
    ${voffset 
    -8}${stippled_hr}}
    ${voffset 
    -5}${color}${font Martin Vogel's Symbols:size=12}U${font}${color slate grey} UpTime:$alignr${color }$uptime  
    ${color}${font StyleBats:size=11}Q${font}${color slate grey} Kernel:$alignr${color }$kernel  
    ${font StyleBats:size=10}j${font Yahei Mono:size=9} 电池:$alignr ${font}$battery  
    ${color}${font StyleBats:size=10}A${font}${color slate grey} CPU temperature:    $alignr${color}${acpitemp}℃   
    ${color}usage: $alignc Core0: ${cpu cpu1} % $alignr Core1: ${cpu cpu2} %  
    ${color slate grey}Disk Read: ${color #8844ee}${diskio_read /dev/sda} $alignr ${color slate grey} Write: ${color #22ccff}${diskio_write /dev/sda}
    $if_mpd_playing${color}${voffset -4}${stippled_hr}
    ${voffset -4}${font Yahei Mono:size=10}$mpd_artist $alignr (${mpd_album}) 
    $mpd_title
    ${font}${execi 2 ~/scripts/mpd.awk} ${color #88aadd}${mpd_bar 4,150} ${color} $mpd_percent % 
      ${execi 1 mpc | grep 
    '#' | cut -c 10- | cut -d "(" -f1} ${font Webdings:size=12}X${font}:${mpd_vol} % 
    ${font Yahei Mono:size=10}码率: ${mpd_bitrate}kbps  随机:$mpd_random  循环:$mpd_repeat $endif


    weatherimg.sh :

    天气预报加载图标
    #!/bin/bash
    URL=http://www.g.cn/search?q=tq+火星
    weather=/tmp/pogoda.txt

    w3m 
    -dump $URL > $weather
    end=`cat -$weather | grep "当前:" | cut -f1`
    let 
    end=end+10

    head 
    -$end $weather | tail -11 | cut -" " -f1- > $weather
    # iconv -f gbk -t utf-8 $weather > $weather   # 转化为utf-8编码
    cnd=$(cat $weather | grep "当前:" | cut -4-)

    if echo "$cnd" | grep ---'多云'; then
        cond
    ='sunny_cloudy.gif'
    elif 
    echo "$cnd" | grep ---''; then
        cond
    ='sunny.gif'
    elif 
    echo "$cnd" | grep ---'晴间多云'; then
        cond
    ='mostly_sunny.gif'
    elif 
    echo "$cnd" | grep ---''; then
        cond
    ='cloudy.gif'
    elif 
    echo "$cnd" | grep ---'小雨'; then
        cond
    ='RainLight.png'
    elif 
    echo "$cnd" | grep ---'中雨'; then
        cond
    ='rain.gif'
    elif 
    echo "$cnd" | grep ---'大雨'; then
        cond
    ='heavyrain.gif'
    elif 
    echo "$cnd" | grep ---'阵雨'; then
        cond
    = 'Shower.png'
    elif 
    echo "$cnd" | grep ---'雷阵雨'; then
        cond
    = 'Thunderstorms.png'
    elif 
    echo "$cnd" | grep ---'大雪'; then
        cond
    ='SnowHeavy.png'
    elif 
    echo "$cnd" | grep ---'雨加雪'; then
        cond
    ='RainMixedSnow.png'
    elif 
    echo "$cnd" | grep ---'中雪'; then
        cond
    ='snow.gif'
    elif 
    echo "$cnd" | grep ---'小雪'; then
        cond
    = 'snowflurry.gif'
    fi
    prefstr
    ='${image ~/download/weather_images/'
    poststr
    =' -s 40x40 -p 72,6 }'
    echo $prefstr$cond$poststr

    从网上下载一些天气图标,倒数第二行的 40x40 是这些图标图像的大小。


     

     conky-updates.pl :

    check pacman update
    #! /usr/bin/perl -w
    use strict;
    # November 15, 2006
    # Daniel Vredenburg (Vredfreak)
    # This is a program that checks for package updates for Arch Linux users.


    open (MYINPUTFILE, "/home/useless/scripts/pacmanupdate.log") or die "No such file or directory: $!";

    my $i = 0;
    while(<MYINPUTFILE>)
    {
            
    if (/^(.*)\/(.*)(\..*\..*\.)/)  {
                    
    #print " \n";
                    $i++;
            }

    }
    if ($i == 0) {
            
    print "没有可更新的包。";
    else {
            
    print "$i 个包可更新。";
    }
    close(MYINPUTFILE);


    更新包信息来自下面这条命令:

    $ sudo pacman -Syup --noprogressbar > ~/scripts/pacmanupdate.log

     conditions.sh :

    天气状况
    #!/bin/bash
    weather=/tmp/pogoda.txt
    tq
    =$(sed -'4,4p' $weather)
    week1
    =$(sed -'6,6p' $weather)
    tq1
    =$(sed -'7,7p' $weather)
    temp1
    =$(sed -'8,8p' $weather)
    week2
    =$(sed -'9,9p' $weather)
    tq2
    =$(sed -'10,10p' $weather)
    temp2
    =$(sed -'11,11p' $weather)
    echo '今日:'$tq    
    echo $week1''$tq1 ' ' $temp1
    echo $week2''$tq2 ' ' $temp2


     conkytq.sh :

    #!/bin/bash
    weather=/tmp/pogoda.txt
    wind
    =$(sed -'2,2p' $weather)
    temp
    =$(sed -'5,5p' $weather)
    echo $wind ' ' $temp


     其它几个脚本未做改变,同入门版的一样。

     下面是效果图:

                        

  • 相关阅读:
    java并发ThreadLocal
    PermGen space 与 Java heap space
    java vm内存设置
    linux下ssh使用和配置
    ubuntu进入命令登录界面
    7-21 求前缀表达式的值
    7-20 表达式转换
    7-19 求链式线性表的倒数第K项
    7-18 银行业务队列简单模拟
    7-17 汉诺塔的非递归实现
  • 原文地址:https://www.cnblogs.com/shankun/p/my_conkyrc_2nd_edition.html
Copyright © 2011-2022 走看看