我的 conky 配置 (入门)
在我的 LXDE 环境下,每当点击“显示桌面”(最小化所有窗口)时,conky 都会消失,尝试了很多方法都无法解决。
只好取消 pcmanfm 的“管理桌面并显示文件图标”选项。这样虽然解决了上述问题,但代价是不能用桌面了。
$ sudo pacman -S feh 一个轻量级、强大的图像查看器,同时它也可以用来管理桌面壁纸,特别适合缺少这类特性的独立窗口管理器。
feh --bg-center /PATH/TO/壁纸 把这一行添加到 ~/.config/lxsession/LXDE/autostart
想要用桌面的话就把 own_window_type 改成 normal ,不要用"iconify all windows" 。
my ~/.conkyrc :
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_right
gap_x 5
gap_y 45
#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{font Yahei Mono:size=9}${exec ~/scripts/lunardate.py }
font{exec whoami} @ $nodename${color} on $machine ${font OpenLogos:size=21}B
${voffset -12}color{font Weather:size=21}${execi 3600 ~/scripts/weathers.sh}${font Yahei Mono:size=9} ${voffset -6}今日:${execi 7200 ~/scripts/conkytq.sh}
${font Yahei Mono:size=9}${execi 7200 ~/scripts/conditions.sh}
${voffset -2}color{font Martin Vogel's Symbols:size=11}Ufont{color slate grey} UpTime:alignr{color }uptime{color}fontStyleBats:size=10Q{font}colorslategreyKernel:alignrcolorkernel
fontStyleBats:size=10j{font Yahei Mono:size=9} 电池:alignr{font}battery{color}fontStyleBats:size=10A{font}colorslategreyCPUtemperature:alignrcolor{acpitemp}℃
colorusage:alignc Core0: cpucpu1alignr Core1: cpucpu2{voffset 2}color{font StyleBats:size=10}MfontYaheiMono:size=9进程:alignrprocesses个(running_processes 个活跃进程)
voffset−3{color}${font Martin Vogel's Symbols:size=10}hfont{color slate grey} Highest CPU:$alignr -PID- CPU%
${color #ddaa00}topname1alignrtoppid1{top cpu 1}
colorlightgrey{top name 2}$alignr${top pid 2} ${top cpu 2}
colorlightgrey{top name 3}$alignr${top pid 3} ${top cpu 3}
${voffset -3}color{font Martin Vogel's Symbols:size=10}jfont{color slate grey} Highest MEM:alignr−PID−MEM{color #ddaa00}topmemname1alignrtopmempid1{top_mem mem 1}
colorlightgrey{top_mem name 2}alignr{top_mem pid 2} topmemmem2{color lightgrey}topmemname3alignrtopmempid3{top_mem mem 3}
voffset−4{stippled_hr}
colorslategreyRAM:{color} mempercalignrmem/memmax
colorslategrey/:{color} fsfreeperc/alignrcolor{fs_free /}/fssize/{font DejaVu Sans:size=8}colorslategreywindows:{color} fsfreeperc/mnt/windowsalignrcolor{fs_free /mnt/windows}/fssize/mnt/windows{color slate grey}cache: color{fs_free_perc /mnt/cache}% freealignr{color}fsfree/mnt/cache/{fs_size /mnt/cache}
colorslategreyDATA:{color} fsfreeperc/mnt/DATAalignrcolor{fs_free /mnt/DATA}/fssize/mnt/DATA{fs_bar 3,102 /} fsbar3,102/mnt/windows{fs_bar 3,102 /mnt/cache} fsbar3,102/mnt/DATA{font}colorslategreyDiskRead:{color #8844ee}diskioread/dev/sdaalignr colorslategreyWrite:{color #22ccff}diskiowrite/dev/sda{color}fontPizzaDudeBullets:size=12?{font} IP Address: alignr{addr eth0}
color{font Yahei Mono:size=9}总计: fontPizzaDudeBullets:size=10M{font} totalupeth0{alignr}fontPizzaDudeBullets:size=10S{font} totaldowneth0{color slate grey}fontUp:{color #22ccff}upspeedeth0k/s{alignr}colorslategreyDown:{color #8844ee}downspeedeth0k/s{voffset -4}color{upspeedgraph eth0 30,100 000000 ffffff}alignr{downspeedgraph eth0 30,100 000000 ffffff}
voffset−12{color}${font Martin Vogel's Symbols:size=20}kfont{color slate grey} ${voffset -8}E-Mail: 河蟹@gmail.com
${font Yahei Mono:size=9}${color}$alignr 有 ${color #22ccff}texeci7200perl /scripts/checkgmail.sh{color}封新邮件,来自:
${voffset -4}${font DejaVu Sans:size=8}${execi 7200 ~/scripts/gmail.pl `~/scripts/check_gmail.sh`}
ifrunningmpd{voffset -20}stippledhr{voffset -4}${font Yahei Mono:size=9}$mpd_artist $alignr (mpdalbum){font Yahei Mono:size=9}$mpd_title
font{execi 2 ~/scripts/mpd.awk} ${color #88aadd}mpdbar4,150{color}fontmpd_percent %
$alignc font{execi 1 mpc | grep '#' | cut -c 10- | cut -d "(" -f1} ${font Webdings:size=12}X${font}:${mpd_vol} %
${font Yahei Mono:size=8}码率:font{mpd_bitrate}kbps${font Yahei Mono:size=8} 随机:$mpd_random 循环:$mpd_repeat $endif
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_right
gap_x 5
gap_y 45
#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{font Yahei Mono:size=9}${exec ~/scripts/lunardate.py }
font{exec whoami} @ $nodename${color} on $machine ${font OpenLogos:size=21}B
${voffset -12}color{font Weather:size=21}${execi 3600 ~/scripts/weathers.sh}${font Yahei Mono:size=9} ${voffset -6}今日:${execi 7200 ~/scripts/conkytq.sh}
${font Yahei Mono:size=9}${execi 7200 ~/scripts/conditions.sh}
${voffset -2}color{font Martin Vogel's Symbols:size=11}Ufont{color slate grey} UpTime:alignr{color }uptime{color}fontStyleBats:size=10Q{font}colorslategreyKernel:alignrcolorkernel
fontStyleBats:size=10j{font Yahei Mono:size=9} 电池:alignr{font}battery{color}fontStyleBats:size=10A{font}colorslategreyCPUtemperature:alignrcolor{acpitemp}℃
colorusage:alignc Core0: cpucpu1alignr Core1: cpucpu2{voffset 2}color{font StyleBats:size=10}MfontYaheiMono:size=9进程:alignrprocesses个(running_processes 个活跃进程)
voffset−3{color}${font Martin Vogel's Symbols:size=10}hfont{color slate grey} Highest CPU:$alignr -PID- CPU%
${color #ddaa00}topname1alignrtoppid1{top cpu 1}
colorlightgrey{top name 2}$alignr${top pid 2} ${top cpu 2}
colorlightgrey{top name 3}$alignr${top pid 3} ${top cpu 3}
${voffset -3}color{font Martin Vogel's Symbols:size=10}jfont{color slate grey} Highest MEM:alignr−PID−MEM{color #ddaa00}topmemname1alignrtopmempid1{top_mem mem 1}
colorlightgrey{top_mem name 2}alignr{top_mem pid 2} topmemmem2{color lightgrey}topmemname3alignrtopmempid3{top_mem mem 3}
voffset−4{stippled_hr}
colorslategreyRAM:{color} mempercalignrmem/memmax
colorslategrey/:{color} fsfreeperc/alignrcolor{fs_free /}/fssize/{font DejaVu Sans:size=8}colorslategreywindows:{color} fsfreeperc/mnt/windowsalignrcolor{fs_free /mnt/windows}/fssize/mnt/windows{color slate grey}cache: color{fs_free_perc /mnt/cache}% freealignr{color}fsfree/mnt/cache/{fs_size /mnt/cache}
colorslategreyDATA:{color} fsfreeperc/mnt/DATAalignrcolor{fs_free /mnt/DATA}/fssize/mnt/DATA{fs_bar 3,102 /} fsbar3,102/mnt/windows{fs_bar 3,102 /mnt/cache} fsbar3,102/mnt/DATA{font}colorslategreyDiskRead:{color #8844ee}diskioread/dev/sdaalignr colorslategreyWrite:{color #22ccff}diskiowrite/dev/sda{color}fontPizzaDudeBullets:size=12?{font} IP Address: alignr{addr eth0}
color{font Yahei Mono:size=9}总计: fontPizzaDudeBullets:size=10M{font} totalupeth0{alignr}fontPizzaDudeBullets:size=10S{font} totaldowneth0{color slate grey}fontUp:{color #22ccff}upspeedeth0k/s{alignr}colorslategreyDown:{color #8844ee}downspeedeth0k/s{voffset -4}color{upspeedgraph eth0 30,100 000000 ffffff}alignr{downspeedgraph eth0 30,100 000000 ffffff}
voffset−12{color}${font Martin Vogel's Symbols:size=20}kfont{color slate grey} ${voffset -8}E-Mail: 河蟹@gmail.com
${font Yahei Mono:size=9}${color}$alignr 有 ${color #22ccff}texeci7200perl /scripts/checkgmail.sh{color}封新邮件,来自:
${voffset -4}${font DejaVu Sans:size=8}${execi 7200 ~/scripts/gmail.pl `~/scripts/check_gmail.sh`}
ifrunningmpd{voffset -20}stippledhr{voffset -4}${font Yahei Mono:size=9}$mpd_artist $alignr (mpdalbum){font Yahei Mono:size=9}$mpd_title
font{execi 2 ~/scripts/mpd.awk} ${color #88aadd}mpdbar4,150{color}fontmpd_percent %
$alignc font{execi 1 mpc | grep '#' | cut -c 10- | cut -d "(" -f1} ${font Webdings:size=12}X${font}:${mpd_vol} %
${font Yahei Mono:size=8}码率:font{mpd_bitrate}kbps${font Yahei Mono:size=8} 随机:$mpd_random 循环:$mpd_repeat $endif
lunardate.py :
#!/usr/bin/python
#coding=utf-8
import locale, time, liblunar
locale.setlocale(locale.LC_ALL, "")
t=time.localtime()
l=liblunar.Date()
l.set_solar_date(t.tm_year,t.tm_mon,t.tm_mday,t.tm_hour)
format="农历:%(NIAN)年%(YUE)月%(RI)日 生肖:%(shengxiao)"
print l.strftime(format)
#coding=utf-8
import locale, time, liblunar
locale.setlocale(locale.LC_ALL, "")
t=time.localtime()
l=liblunar.Date()
l.set_solar_date(t.tm_year,t.tm_mon,t.tm_mday,t.tm_hour)
format="农历:%(NIAN)年%(YUE)月%(RI)日 生肖:%(shengxiao)"
print l.strftime(format)
liblunar 来自这里,支持python binding。AUR中也有。
weather.sh :
#!/bin/bash
URL=http://www.g.cn/search?q=tq+成都
weather=/tmp/pogoda.txt
w3m -dump $URL > $weather
end=`cat -n $weather | grep "当前:" | cut -f1`
let end=end+10
head -n $end $weather | tail -n 11 | cut -d " " -f1- > $weather
# iconv -f gbk -t utf-8 weather>weather # 转化为utf-8编码
cnd=$(cat $weather | grep "当前:" | cut -c 4-)
if echo "$cnd" | grep -E -i -q '多云'; then
echo 'c'
elif echo "$cnd" | grep -E -i -q '晴'; then
echo 'B'
elif echo "$cnd" | grep -E -i -q '阴'; then
echo 'e'
elif echo "$cnd" | grep -E -i -q '小雨|中雨'; then
echo 'g'
elif echo "$cnd" | grep -E -i -q '大雨'; then
echo 'h'
elif echo "$cnd" | grep -E -i -q '阵雨'; then
echo 'i'
elif echo "$cnd" | grep -E -i -q '中雪|大雪'; then
echo 'j'
elif echo "$cnd" | grep -E -i -q '小雪'; then
echo 'k'
fi
URL=http://www.g.cn/search?q=tq+成都
weather=/tmp/pogoda.txt
w3m -dump $URL > $weather
end=`cat -n $weather | grep "当前:" | cut -f1`
let end=end+10
head -n $end $weather | tail -n 11 | cut -d " " -f1- > $weather
# iconv -f gbk -t utf-8 weather>weather # 转化为utf-8编码
cnd=$(cat $weather | grep "当前:" | cut -c 4-)
if echo "$cnd" | grep -E -i -q '多云'; then
echo 'c'
elif echo "$cnd" | grep -E -i -q '晴'; then
echo 'B'
elif echo "$cnd" | grep -E -i -q '阴'; then
echo 'e'
elif echo "$cnd" | grep -E -i -q '小雨|中雨'; then
echo 'g'
elif echo "$cnd" | grep -E -i -q '大雨'; then
echo 'h'
elif echo "$cnd" | grep -E -i -q '阵雨'; then
echo 'i'
elif echo "$cnd" | grep -E -i -q '中雪|大雪'; then
echo 'j'
elif echo "$cnd" | grep -E -i -q '小雪'; then
echo 'k'
fi
conkytq.sh :
#!/bin/bash
weather=/tmp/pogoda.txt
tq=$(sed -n '4,4p' $weather)
wind=$(sed -n '2,2p' $weather)
temp=$(sed -n '5,5p' $weather)
echo $tq
echo ' ' $wind ' ' $temp
weather=/tmp/pogoda.txt
tq=$(sed -n '4,4p' $weather)
wind=$(sed -n '2,2p' $weather)
temp=$(sed -n '5,5p' $weather)
echo $tq
echo ' ' $wind ' ' $temp
conditions.sh :
#!/bin/bash
weather=/tmp/pogoda.txt
week1=$(sed -n '6,6p' $weather)
tq1=$(sed -n '7,7p' $weather)
temp1=$(sed -n '8,8p' $weather)
week2=$(sed -n '9,9p' $weather)
tq2=$(sed -n '10,10p' $weather)
temp2=$(sed -n '11,11p' $weather)
echo $week1 ' ' $tq1 $temp1
echo $week2 ' ' $tq2 $temp2
weather=/tmp/pogoda.txt
week1=$(sed -n '6,6p' $weather)
tq1=$(sed -n '7,7p' $weather)
temp1=$(sed -n '8,8p' $weather)
week2=$(sed -n '9,9p' $weather)
tq2=$(sed -n '10,10p' $weather)
temp2=$(sed -n '11,11p' $weather)
echo $week1 ' ' $tq1 $temp1
echo $week2 ' ' $tq2 $temp2
gmail.pl :

#!/usr/bin/perl
# Put this in ~/.gmail/ and use "crontab -e" to add something like
# "* * * * * ~/.gmail/gmail.pl > /dev/null" to run it every minute.
# ${exec ~/.gmail/gmail.pl} shows your inbox in Conky.
# Note that this was intended to be used with Gmail or any other
# ssl-enabled pop3 server.
# beginning of configuration
# pop3 host
$pop_host = "pop.gmail.com";
# pop3 username (for Gmail, I didn't have to put @gmail.com at the end)
$pop_user = "wqnmlgb";
# pop3 password
$pop_pass = "asshole";
# ssl port number (995 is what Gmail uses)
$ssl_port = "995";
# ssl protocol
$ssl_prot = "tcp";
# number of emails to show 读取命令行第一个参数
$dis_numb = $ARGV[0];
# end of configuration
use Mail::POP3Client;
use IO::Socket::SSL;
my $socket = IO::Socket::SSL->new( PeerAddr => $pop_host,
PeerPort => $ssl_port,
Proto => $ssl_prot);
my $pop = Mail::POP3Client->new();
$pop->User($pop_user);
$pop->Pass($pop_pass);
$pop->Socket($socket);
$pop->Connect();
$msg_count = $pop->Count();
for ($i = $msg_count; i >0 &&i >= $msg_count-($dis_numb-1); $i--) {
foreach ( $pop->Head( $i ) ) {
#/^(From|Subject):\s+/i and print $_, "\n";
if ($_ =~ m/^From:/) {
($from) = ($_ =~ m#^From: .*<(.*)>#);
$from = substr($from, 0, 30);
$out .= "$from\n";
}
}
#chop $out;
}
print"$out";
$pop->Close();
# Put this in ~/.gmail/ and use "crontab -e" to add something like
# "* * * * * ~/.gmail/gmail.pl > /dev/null" to run it every minute.
# ${exec ~/.gmail/gmail.pl} shows your inbox in Conky.
# Note that this was intended to be used with Gmail or any other
# ssl-enabled pop3 server.
# beginning of configuration
# pop3 host
$pop_host = "pop.gmail.com";
# pop3 username (for Gmail, I didn't have to put @gmail.com at the end)
$pop_user = "wqnmlgb";
# pop3 password
$pop_pass = "asshole";
# ssl port number (995 is what Gmail uses)
$ssl_port = "995";
# ssl protocol
$ssl_prot = "tcp";
# number of emails to show 读取命令行第一个参数
$dis_numb = $ARGV[0];
# end of configuration
use Mail::POP3Client;
use IO::Socket::SSL;
my $socket = IO::Socket::SSL->new( PeerAddr => $pop_host,
PeerPort => $ssl_port,
Proto => $ssl_prot);
my $pop = Mail::POP3Client->new();
$pop->User($pop_user);
$pop->Pass($pop_pass);
$pop->Socket($socket);
$pop->Connect();
$msg_count = $pop->Count();
for ($i = $msg_count; i >0 &&i >= $msg_count-($dis_numb-1); $i--) {
foreach ( $pop->Head( $i ) ) {
#/^(From|Subject):\s+/i and print $_, "\n";
if ($_ =~ m/^From:/) {
($from) = ($_ =~ m#^From: .*<(.*)>#);
$from = substr($from, 0, 30);
$out .= "$from\n";
}
}
#chop $out;
}
print"$out";
$pop->Close();
运行这个perl脚本之前需要 sudo cpan -i YAML Mail::POP3Client IO::Socket::SSL
check_gmail.sh :
#!/bin/bash
gmail_login="账号"
gmail_password="密码"
dane="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \
https://gmaillogin:{gmail_password}@mail.google.com/mail/feed/atom \
--no-check-certificate | grep 'fullcount' \
| sed -e 's/.*<fullcount>//;s/<\/fullcount>.*//' 2>/dev/null)"
if [ -z "$dane" ]; then
echo "Error"
else
echo "$dane"
fi
gmail_login="账号"
gmail_password="密码"
dane="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \
https://gmaillogin:{gmail_password}@mail.google.com/mail/feed/atom \
--no-check-certificate | grep 'fullcount' \
| sed -e 's/.*<fullcount>//;s/<\/fullcount>.*//' 2>/dev/null)"
if [ -z "$dane" ]; then
echo "Error"
else
echo "$dane"
fi
mpd.awk :
#!/bin/awk -f
BEGIN {
MPD_CMD = "mpc"; # mpd
MPD_CMD | getline;
MPD_CMD | getline;
mpd_state = $1;
close(MPD_CMD);
if ( mpd_state == "[playing]" )
print " ▶ ";
else
{
if ( mpd_state == "[paused]" )
print " ❚❚";
else
{
print " ■ ";
}
}
}
BEGIN {
MPD_CMD = "mpc"; # mpd
MPD_CMD | getline;
MPD_CMD | getline;
mpd_state = $1;
close(MPD_CMD);
if ( mpd_state == "[playing]" )
print " ▶ ";
else
{
if ( mpd_state == "[paused]" )
print " ❚❚";
else
{
print " ■ ";
}
}
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步