
-------------------------------------
--  配置 conky 参数
-------------------------------------

conky.config = {

-------------------------------------
--  基本设置
-------------------------------------
--是否后台运行
background=true,
--是否输出结果到终端
out_to_console=yes,
--更新间隔
update_interval=1,
--使用双缓冲
double_buffer=true,
--是否在已用内存中减去文件系统缓冲区
no_buffers=true,
--Imlib2图像缓存大小
imlib_cache_size=100,

--是否显示阴影
draw_shades=false,
--是否显示轮廓
draw_outline=false,
--是否显示文本边框
draw_borders=false,
--是否在图片周围绘制边框
draw_graph_borders=false,
--指定图形的默认高度
--default_graph_height=150,
--指定图形的默认宽度
--default_graph_width=380,
--显示缩放图形中的最大值
--show_graph_scale=false,
--显示图表所涵盖的时间范围
--show_graph_range=false,


-------------------------------------
--  窗户规格
-------------------------------------
--屏幕右边界或左边界之间的间距
gap_x=10,
--屏幕顶部或底部边框之间的间隙
gap_y=20,
--文本区域的最高度
minimum_height=800,
--文本区域的最宽度
minimum_width=330,
--创建自有窗口
own_window=true,
--窗口类型
own_window_type="normal",
--背景透明
own_window_transparent=true,
--窗口显示的方式
own_window_hints="undecorated,below,sticky,skip_taskbar,skip_pager",
--内边框边距
border_inner_margin=0,
--外边框边距
border_outer_margin=0,
--文本对齐方式
alignment="top_right",
--是否使用ARGB值
own_window_argb_visual=true,
--Alpha值
own_window_argb_value=0,


-------------------------------------
--  文本设置
-------------------------------------
--是否使用xft字体
use_xft=true,
--字体透明度，必须是1到0之间的值。 
xftalpha=1,
--雅黑10像素字体
font="Noto Sans CJK SC :size=10",
--标准文本缓冲区的大小（默认为256字节）。
text_buffer_size=256,
--是否强制强制UTF8
override_utf8_locale=true,
--将单位缩短为单个字符
short_units=true,
--百分比精确度2位
pad_percents=2,
--top name值的宽度
top_name_width=7,

-------------------------------------
--  加载 lua
-------------------------------------
lua_load = '~/.conky/clock_rings.lua',
lua_draw_hook_pre='clock_rings',
-------------------------------------
--  定义颜色
-------------------------------------
--默认颜色和边框颜色
default_color="444444",
color1="FFFFFF",
color2="555555",
color3="555555",
color4="777777",
color5="F15D22",
color6="F15D22",
color7="F15D22",
color8="F15D22",


-------------------------------------
--  OpenWeatherMap API 密码，这里照抄了一个
-------------------------------------
template6="785c55952ba8b7c41777975b42697401",


-------------------------------------
--  OpenWeatherMap 城市代码，这里默认为洛阳
-------------------------------------
template7="1801792",


-------------------------------------
--  温度单位 (default, metric, imperial)
-------------------------------------
template8="metric",


-------------------------------------
--  本地化 (例如 "es_ES.UTF-8")
--  留空使用默认环境
-------------------------------------
template9="zh_CN.UTF-8"

}


-------------------------------------
--  配置 conky 文本
--  首先使用get_weather获取天气数据并保存在json文件中，将图片添加到相应位置，
--  使用voffset将图片定位，然后使用parse_weather脚本分析json文件获取天气数据
--  根据天气数据使用相应的图片显示天气，然后使用内置指令获取cup、内存、运行
--  时间、进程等信息，最后使用if_existing枚举网卡，显示网速，如果网络断开将
--  显示网络断开提示。你需要手动修改监控的网卡类型才能有效。如果你改变了字体，
--  你需要对图片和文字的定位进行调整。
-------------------------------------
 
conky.text = [[
\
\
\
\
\
${execi 300 ~/.conky/get_weather ${template6} ${template7} ${template8} ${template9}}\
\
\
\
\
\
${image ~/.conky/photo/bg.png -p 0,10 -s 440x150}
\
${voffset 20}${alignc}${color1}${font Noto Sans CJK SC :size=22}${time %H:%M}${font}${color}
${voffset 4}${alignc}${color1}${execi 300 LANG=${template9} LC_TIME=${template9} date +"%A, %B%-d"}${color}
\
\
\
\
\
${image ~/.conky/photo/bg.png -p 0,165 -s 440x150}
\
${voffset 20}${alignc -72}${color1}MEM${color}
${voffset -19}${alignc 72}${color1}CPU${color}
${voffset 42}${alignc -72}${color1}POW${color}
${voffset -21}${alignc 72}${color1}NET${color}
\
\
\
\
\
${image ~/.conky/photo/bg.png -p 0,320 -s 440x150}
\
${image ~/.conky/photo/pressure.png -p 150,320 -s 32x32}\
${image ~/.conky/photo/humidity.png -p 150,350 -s 32x32}\
${image ~/.conky/photo/wind-2.png -p 150,380 -s 32x32}\
${execi 300 cp -f ~/.conky/icons/$(~/.conky/parse_weather 'first' '.weather[0].id' '0').png ~/.cache/harmattan-conky/weather-1.png}${image ~/.cache/harmattan-conky/weather-1.png -p 25,335 -s 64x64}\
\
${voffset 33}${color1}${alignr 50}${font Noto Sans CJK SC :size=8}${execi 300 jq -r .main.pressure ~/.cache/harmattan-conky/weather.json | awk '{print int($1+0.5)}' # round num}hPa${font}${color}
${voffset 1}${color1}${alignr 50}${font Noto Sans CJK SC :size=8}${execi 300 jq -r .main.humidity ~/.cache/harmattan-conky/weather.json | awk '{print int($1+0.5)}' # round num}%${font}${color}
${voffset 1}${color1}${alignr 50}${font Noto Sans CJK SC :size=8}${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}${font}${color}
\
${color1}${voffset 1}${alignr 50}${font Noto Sans CJK SC :size=8}${execi 300 ~/.conky/parse_weather 'avg' '.main.temp_min' '0'}${if_match "$template8" == "metric"}°C${else}${if_match "$template8" == "imperial"}°F${else}${if_match "$template8" == "default"}K${endif}${endif}${endif}/${execi 300 ~/.conky/parse_weather 'avg' '.main.temp_max' '0'}${if_match "$template8" == "metric"}°C${else}${if_match "$template8" == "imperial"}°F${else}${if_match "$template8" == "default"}K${endif}${endif}${endif}${font}${color}
\
${voffset -35}${alignc 160}${font Noto Sans CJK SC :size=12}${color1}${execi 300 jq -r .main.temp ~/.cache/harmattan-conky/weather.json | awk '{print int($1+0.5)}' # round num}${if_match "$template8" == "metric"}°C${else}${if_match "$template8" == "imperial"} °F${else}${if_match "$template8" == "default"} K${endif}${endif}${endif}, \
${execi 300 jq -r .weather[0].description ~/.cache/harmattan-conky/weather.json | sed "s|\<.|\U&|g"}${font}${color}
${image ~/.conky/photo/bg.png -p 0,475 -s 440x300}
${voffset 4}${alignc}${color1}${alignc}${font Noto Sans CJK SC :size=8}${execi 300 ccal -u}${font}
]]
