风吹过的绿洲
deepin
2018-01-12 21:34 conky.config = {
-------------------------------------
-- Generic Settings
-------------------------------------
background=true,
update_interval=1,
double_buffer=true,
no_buffers=true,
imlib_cache_size=10,
draw_shades=false,
draw_outline=false,
draw_borders=false,
draw_graph_borders=false,
default_graph_height=26,
default_graph_width=80,
show_graph_scale=false,
show_graph_range=false,
-------------------------------------
-- Window Specifications
-------------------------------------
gap_x=200,
gap_y=240,
minimum_height=700,
minimum_width=268,
own_window=true,
own_window_class = 'Conky',
own_window_type="normal",
own_window_transparent=false,
own_window_hints="undecorated,below,sticky,skip_taskbar,skip_pager",
border_inner_margin=0,
border_outer_margin=0,
alignment="top_right",
own_window_argb_visual=true,
own_window_argb_value=0,
-------------------------------------
-- Text Settings
-------------------------------------
use_xft=true,
xftalpha=0.8,
font="Droid Sans:size=8",
text_buffer_size=256,
override_utf8_locale=true,
short_units=true,
short_units=true,
pad_percents=2,
top_name_width=7,
-------------------------------------
-- Color Scheme
-------------------------------------
default_color="FFFFFF",
color1="FFFFFF",
color2="FFFFFF",
color3="FFFFFF",
color4="FFFFFF",
color5="DCDCDC",
color6="FFFFFF",
color7="FFFFFF",
color8="FFFFFF",
-------------------------------------
-- API Key 在这个文件里获取天气,存在异步的问题,拷贝文件的时候,天气文件还没有获取到,所以加到start.sh里面去了
-------------------------------------
template6="",
-------------------------------------
-- City ID
-------------------------------------
template7="",
-------------------------------------
-- Temp Unit (default, metric, imperial)
-------------------------------------
template8="metric",
-------------------------------------
-- Locale (e.g. "es_ES.UTF-8")
-- Leave empty for default
-------------------------------------
template9=""
}
---------------------------------------------------
---------------------------------------------------
conky.text = [[
\
\
\
\
${execi 300 cp -f ~/.harmattan-assets/photos/smallest/$(jq .weather[0].id ~/.cache/harmattan-conky/weather.json).png ~/.cache/harmattan-conky/weather.png}${image ~/.cache/harmattan-conky/weather.png -p 20,91 -s 228x86}\
${image ~/.harmattan-assets/misc/Metro/God-Mode/border.png -p 20,30 -s 228x562}\
${image ~/.harmattan-assets/misc/Metro/God-Mode/border-4.png -p 20,90 -s 228x88}\
${image ~/.harmattan-assets/misc/Metro/God-Mode/border-3.png -p 20,478 -s 228x14}\
${image ~/.harmattan-assets/misc/Metro/God-Mode/separator-v.png -p 95,185 -s 1x76}\
${image ~/.harmattan-assets/misc/Metro/God-Mode/separator-v.png -p 172,185 -s 1x76}\
${image ~/.harmattan-assets/misc/Metro/God-Mode/separator-h.png -p 33,369 -s 202x1}\
${image ~/.harmattan-assets/misc/Metro/God-Mode/separator-h.png -p 33,269 -s 202x1}\
\
\
\
\
${voffset 25}${font Droid Sans Mono :size=22}${alignc}${color2}${time %H:%M}${font}${color}
${voffset 4}${font Droid Sans :size=10}${alignc}${color6}${execi 300 LANG=${template9} LC_TIME=${template9} date +"%A, %B %-d"}${font}${color}
\
\
\
\
${goto 36}${voffset 0}${font Droid Sans :size=36}${color1}${execi 300 jq -r .main.temp ~/.cache/harmattan-conky/weather.json | awk '{print int($1+0.5)}' # round num}°${font}${color}
${goto 38}${voffset 5}${font Droid Sans :size=12}${color1}${execi 300 jq -r .weather[0].description ~/.cache/harmattan-conky/weather.json | sed "s|\<.|\U&|g"}${font}${color}
${color1}${alignr 52}${voffset -85}${execi 300 jq -r .main.pressure ~/.cache/harmattan-conky/weather.json | awk '{print int($1+0.5)}' # round num} hPa
${color1}${alignr 52}${voffset 4}${execi 300 jq -r .main.humidity ~/.cache/harmattan-conky/weather.json | awk '{print int($1+0.5)}' # round num} %${color}
${color1}${alignr 52}${voffset 4}${execi 300 jq -r .wind.speed ~/.cache/harmattan-conky/weather.json | awk '{print int($1+0.5)}' # round num}${if_match "$template8" == "metric"} m/s${else}${if_match "$template8" == "default"} m/s${else}${if_match "$template8" == "imperial"} mi/h${endif}${endif}${endif}${color}
\
\
\
\
${color3}${voffset 30}${alignc 77}${execi 300 LANG=${template9} LC_TIME=${template9} date +%^a}${color}
${color3}${voffset -16}${alignc}${execi 300 LANG=${template9} LC_TIME=${template9} date -d +1day +%^a}${color}s
${color3}${voffset -16}${alignc -77}${execi 300 LANG=${template9} LC_TIME=${template9} date -d +2day +%^a}${color}
\
\
\
\
${color2}${voffset 48}${alignc 77}${execi 300 jq -r .list[0].main.temp_min ~/.cache/harmattan-conky/forecast.json | awk '{print int($1+0.5)}' # round num}°/${execi 300 jq -r .list[0].main.temp_max ~/.cache/harmattan-conky/forecast.json | awk '{print int($1+0.5)}' # round num}°${color}
${color2}${voffset -15}${alignc}${execi 300 jq -r .list[1].main.temp_min ~/.cache/harmattan-conky/forecast.json | awk '{print int($1+0.5)}' # round num}°/${execi 300 jq -r .list[1].main.temp_max ~/.cache/harmattan-conky/forecast.json | awk '{print int($1+0.5)}' # round num}°${color}
${color2}${voffset -15}${alignc -77}${execi 300 jq -r .list[2].main.temp_min ~/.cache/harmattan-conky/forecast.json | awk '{print int($1+0.5)}' # round num}°/${execi 300 jq -r .list[2].main.temp_max ~/.cache/harmattan-conky/forecast.json | awk '{print int($1+0.5)}' # round num}°${color}
\
\
\
\
${image ~/.harmattan-assets/misc/Metro/God-Mode/pressure.png -p 224,95 -s 16x16}\
${image ~/.harmattan-assets/misc/Metro/God-Mode/humidity.png -p 224,115 -s 16x16}\
${image ~/.harmattan-assets/misc/Metro/God-Mode/wind-2.png -p 224,136 -s 16x16}\
${execi 300 cp -f ~/.harmattan-assets/icons/#fff__32/$(jq .list[0].weather[0].id ~/.cache/harmattan-conky/forecast.json).png ~/.cache/harmattan-conky/weather-1.png}${image ~/.cache/harmattan-conky/weather-1.png -p 41,207 -s 32x32}\
${execi 300 cp -f ~/.harmattan-assets/icons/#fff__32/$(jq .list[1].weather[0].id ~/.cache/harmattan-conky/forecast.json).png ~/.cache/harmattan-conky/weather-2.png}${image ~/.cache/harmattan-conky/weather-2.png -p 119,207 -s 32x32}\
${execi 300 cp -f ~/.harmattan-assets/icons/#fff__32/$(jq .list[2].weather[0].id ~/.cache/harmattan-conky/forecast.json).png ~/.cache/harmattan-conky/weather-3.png}${image ~/.cache/harmattan-conky/weather-3.png -p 195,207 -s 32x32}${font}${voffset -82}
\
\
\
\
${if_existing /proc/net/route enp8s0}
${voffset 50}${goto 40}${font Droid Sans :size=8}${color5}Up: ${color2}${upspeed enp8s0}${color5}${goto 150}Down: ${color2}${downspeed enp8s0}
${voffset 10}${goto 40}${upspeedgraph enp8s0 26,80 FFFFFF FFFFFF}${goto 150}${downspeedgraph enp8s0 26,80 FFFFFF FFFFFF}
${voffset 9}${goto 40}${color5}Sent: ${color2}${totalup enp8s0}${color5}${goto 150}Received: ${color2}${totaldown enp8s0}
${else}
${if_existing /proc/net/route wlp0s20f3}
${voffset 50}${goto 40}${font Droid Sans :size=8}${color5}Up: ${color2}${upspeed wlp0s20f3}${color5}${goto 150}Down: ${color2}${downspeed wlp0s20f3}
${voffset 10}${goto 40}${upspeedgraph wlp0s20f3 26,80 FFFFFF FFFFFF}${goto 150}${downspeedgraph wlp0s20f3 26,80 FFFFFF FFFFFF}
${voffset 9}${goto 40}${color5}Sent: ${color2}${totalup wlp0s20f3}${color5}${goto 150}Received: ${color2}${totaldown wlp0s20f3}
${else}
${voffset 1}${goto 40}${color5}Network disconnected${color}
${image ~/.harmattan-assets/misc/Metro/God-Mode/offline.png -p 44,284 -s 16x16}
${endif}
${endif}
\
\
\
\
${voffset -10}${goto 40}${font Droid Sans :size=8}Cpu: ${exec sensors | grep Package | awk '{print substr($4,2,2)}'}℃${color}
${voffset 5}${goto 40}${color2}Mem:${color}
${voffset 4}${goto 40}${color2}Uptime:${color}
${voffset -55}${alignc}${color2}${cpubar 5,36}${color}
${voffset 4}${alignc}${color2}${membar 5,36}${color}
${voffset -42}${alignr 39}${color2}${cpu cpu0}%${color}
${voffset 3}${alignr 39}${color2}${memperc}%${color}s
${voffset 4}${alignr 39}${color2}${uptime_short}${color}
${voffset 8}${goto 40}${loadgraph 26,190 FFFFFF FFFFFF -l}
\
\
\
\
${voffset -7}${goto 40}${font Droid Sans :size=8}${color1}Proc${color}
${voffset -17}${alignc}${color1}Mem%${color}
${voffset -17}${alignr 39}${color1}Mem${color}
${voffset 2}${goto 40}${color2}${top_mem name 1}${color}
${voffset 2}${goto 40}${color2}${top_mem name 2}${color}
${voffset 2}${goto 40}${color2}${top_mem name 3}${color}
${voffset 2}${goto 40}${color2}${top_mem name 4}${color}
${voffset 2}${goto 40}${color2}${top_mem name 5}${color}
${voffset -92}${alignc}${color5}${top_mem mem 1}%${color}
${voffset 2}${alignc}${color5}${top_mem mem 2}%${color}
${voffset 2}${alignc}${color5}${top_mem mem 3}%${color}
${voffset 2}${alignc}${color5}${top_mem mem 4}%${color}
${voffset 2}${alignc}${color5}${top_mem mem 5}%${color}
${voffset -92}${alignr 39}${color6}${top_mem mem_res 1}${color}
${voffset 2}${alignr 39}${color6}${top_mem mem_res 2}${color}
${voffset 2}${alignr 39}${color6}${top_mem mem_res 3}${color}
${voffset 2}${alignr 39}${color6}${top_mem mem_res 4}${color}
${voffset 2}${alignr 39}${color6}${top_mem mem_res 5}${color}
]]
Reply Like 0 View the author


中文 


本帖最后由 as763190097 于 2018-1-12 13:41 编辑
之前用的conky-manager,但conky-manager的主题真的不怎么样,而且支持的conky的版本比较低。不支持1.10的配置文件。
于是乎,查到了github项目https://github.com/zagortenay333/Harmattan 这里有很多主题。
下载了主题后放到自己电脑上多多少少有些问题,自己改了一些,分享修改后的给大家。
效果图
确保电脑装了curl and jq没有的话,sudo apt-get install curl jq
使用conky-all 代替conky
sudo apt-get remove conky
sudo apt-get install conky-all
下载主题
将.harmattan-assets文件夹拷贝到用户目录~下。
配置文件.conkyrc 放在 ~目录。
内容过长,放到1楼了。
创建shell脚本文件start.sh,我的文件的是放在~/.conky/start.sh这个位置
apiKey和cityId请修改成自己的。
http://openweathermap.org/ 在这个网站注册,可以获得。
创建桌面启动文件conky.desktop
开机启动
将conky.desktop文件放到~/.config/autostart
获取API key和city id