Re: Conky
Posté : lun. 23 janv. 2017 13:02
Dernier message de la page précédente :
Merci Chef !
https://forum-francophone-linuxmint.fr/
https://forum-francophone-linuxmint.fr/viewtopic.php?f=34&t=34
Dernier message de la page précédente :
Merci Chef !gunsman76 a écrit :Je vais étudier un peu et revenir si je n'y arrive pas
Code : Tout sélectionner
# Use Xft?
use_xft yes
xftfont GE Inspira:size=10
xftalpha 0.8
text_buffer_size 2048
uppercase no
# Update interval in seconds
update_interval 1
# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_transparent yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
#own_window_argb_visual yes
#own_window_argb_value 255
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
minimum_size 282
# Draw shades?
draw_shades no
default_shade_color 292421
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
#border_inner_margin 30
#border_outer_margin 0
draw_graph_borders no
# border width
border_width 0
# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right
# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 40
gap_y 140
# Open Sans Light fonts
# Droid Sans
imlib_cache_size 0
color1 323232
color2 323232
color3 000000
color4 6b6b6b
color5 6db9d5
color6 000000
color7 000000
TEXT
${image ~/.conky/conkyeos/icons/background.png -p 0,0 -s 287x600}${image ~/.conky/conkyeos/icons/box.png -p 10,208 -s 267x64}${execi 600 bash $HOME/1_accuweather/1_accuweather -f2016 -h2016}
${voffset -20}${color1}${alignc}[${time %A,}${time %H:%M:%S}]${image ~/.conky/conkyeos/icons/fav-color.png -p 1,20 -s 285x185}
${alignc 60}${font Relaway:size=30}${time %d %B %Y}$font
${image ~/1_accuweather/forecast_2016/forecast_0.png -p 20,52 -s 80x80}
${voffset 12}${color1}${font GE Inspira:size=42}${alignr 10}${execi 90 sed -n '2p' $HOME/1_accuweather/curr_cond}°${font}
${color1}${alignc}${execi 90 sed -n '4p' $HOME/1_accuweather/curr_cond}
${image ~/.conky/conkyeos/icons/wind.png -p 10,136 -s 16x16}${alignc}${color1}${execi 90 sed -n '5p' $HOME/1_accuweather/curr_cond} à ${execi 90 sed -n '6p' $HOME/1_accuweather/curr_cond}${color5}
${image ~/.conky/conkyeos/icons/humidity.png -p 10,146 -s 16x16}${color1}${alignc}${execi 90 sed -n '7p' $HOME/1_accuweather/curr_cond}
${image ~/.conky/conkyeos/icons/pressure.png -p 10,160 -s 16x16}${color1}${alignc}${execi 90 sed -n '8p' $HOME/1_accuweather/curr_cond}
${image ~/.conky/conkyeos/icons/sunrise.png -p 10,174 -s 16x16}${color1}${goto 80}De ${execi 90 sed -n '14p' $HOME/1_accuweather/curr_cond} à ${execi 90 sed -n '15p' $HOME/1_accuweather/curr_cond} durée ${execi 90 sed -n '16p' $HOME/1_accuweather/curr_cond}
${image ~/.conky/conkyeos/icons/sunset.png -p 10,188 -s 16x16}${color1} ${goto 80}De ${execi 90 sed -n '18p' $HOME/1_accuweather/curr_cond} à ${execi 90 sed -n '19p' $HOME/1_accuweather/curr_cond} durée ${execi 90 sed -n '20p' $HOME/1_accuweather/curr_cond}${voffset 4}
${color1}${voffset 4}${goto 20}${execi 90 sed -n '8p' $HOME/1_accuweather/first_days}° ${goto 120}${execi 90 sed -n '13p' $HOME/1_accuweather/first_days}° ${goto 220}${execi 90 sed -n '18p' $HOME/1_accuweather/first_days}°
${image ~/1_accuweather/forecast_2016/forecast_2.png -p 20,228 -s 35x35}
${image ~/1_accuweather/forecast_2016/forecast_3.png -p 120,228 -s 35x35}
${image ~/1_accuweather/forecast_2016/forecast_4.png -p 220,228 -s 35x35}
${voffset -4}${color4}${goto 60}${execi 90 sed -n '9p' $HOME/1_accuweather/first_days}° ${goto 160}${execi 90 sed -n '14p' $HOME/1_accuweather/first_days}°${goto 260}${execi 90 sed -n '19p' $HOME/1_accuweather/first_days}°
${goto 30}${color1}${execi 3600 echo `date --date="1 day" | awk '{print $1}' | cut -c1-3`}${goto 130}${execi 3600 echo `date --date="2 day" | awk '{print $1}' | cut -c1-3`} ${goto 230}${execi 3600 echo `date --date="3 day" | awk '{print $1}' | cut -c1-3`}
${image ~/.conky/conkyeos/icons/bg-3.png -p 1,286 -s 285x2}
${if_existing /proc/net/route wlp2s0}${image ~/.conky/conkyeos/icons/online.png -p 120,295 -s 43x18}${else}${image ~/.conky/conkyeos/icons/offline.png -p 120,295 -s 43x18}${endif}
${voffset -12}${font Droid Sans:pixelsize=9}${goto 14}${color1}Signal: ${wireless_link_qual_perc wlp2s0} %
${goto 14}${color1}Sortant:${color3} ${upspeed wlp2s0}${color1}${alignr}${goto 190}${color1}Entrant: ${color3}${downspeed wlp2s0}${color1}
${goto 14}${upspeedgraph wlp2s0 50,120 6db9d5 6db9d5}${alignr}${goto 160}${downspeedgraph wlp2s0 50,120 6db9d5 6db9d5}
${goto 14}${color1}Envoyé:${color1} ${color2}${totalup wlp2s0}${color1}${alignr}${goto 190}${color1}Reçu:${color1} ${color2}${totaldown wlp2s0}${color}1
${image ~/.conky/conkyeos/icons/bg-3.png -p 1,392 -s 285x2}
${goto 14}${color5}${font Droid Sans:pixelsize=9}CPU 1: ${color1}${alignc}${freq_g 0} ${color1}Ghz ${color2}${alignr}${goto 254}${cpu cpu0}${color1}%
${goto 14}${color5}${font Droid Sans:pixelsize=9}CPU 2: ${color1}${alignc}${freq_g 1} ${color1}Ghz ${color2}${alignr}${goto 254}${cpu cpu1}${color1}%
${goto 14}${color5}${font Droid Sans:pixelsize=9}CPU 3: ${color1}${alignc}${freq_g 2} ${color1}Ghz ${color2}${alignr}${goto 254}${cpu cpu2}${color1}%
${goto 14}${color5}${font Droid Sans:pixelsize=9}CPU 4: ${color1}${alignc}${freq_g 3} ${color1}Ghz ${color2}${alignr}${goto 254}${cpu cpu3}${color1}%
${goto 14}${color5}Températures : ${color1} CPU ${exec expr `cat /sys/class/hwmon/hwmon2/temp1_input` / 1000}°C Carte: ${hwmon 0 temp 1} °C Disque${execi 120 hddtemp -n /dev/sda} °C
${goto 14}${alignr}${goto 14}${loadgraph 50,266 6db9d5 6db9d5 -l}
${goto 14}${color5}${font Droid Sans:pixelsize=9}RAM: ${color1}${alignc 10}${mem}
${goto 14}${color5}${font Droid Sans:pixelsize=9}TOTAL: ${color1}${alignc 10}${memmax}
${image ~/.conky/conkyeos/icons/bg-3.png -p 1,532 -s 285x2}
${goto 14}${color1}${font Droid Sans:pixelsize=9}${color5}${top_mem name 1}${color1}${alignc -10}${top_mem mem_res 1}${color2}${alignr}${goto 234}${top_mem mem 1}${color1} %
${goto 14}${color1}${font Droid Sans:pixelsize=9}${color5}${top_mem name 2}${color1}${alignc -10}${top_mem mem_res 2}${color2}${alignr}${goto 234}${top_mem mem 2}${color1} %
${goto 14}${color1}${font Droid Sans:pixelsize=9}${color5}${top_mem name 3}${color1}${alignc -10}${top_mem mem_res 3}${color2}${alignr}${goto 234}${top_mem mem 3}${color1} %
${goto 14}${color1}${font Droid Sans:pixelsize=9}${color5}${top_mem name 4}${color1}${alignc -10}${top_mem mem_res 4}${color2}${alignr}${goto 234}${top_mem mem 4}${color1} %
${goto 14}${color1}${font Droid Sans:pixelsize=9}${color5}${top_mem name 5}${color1}${alignc -10}${top_mem mem_res 5}${color2}${alignr}${goto 234}${top_mem mem 5}${color1} %
Code : Tout sélectionner
alignment top_right
background yes
double_buffer yes
draw_borders no
draw_graph_borders no
draw_outline no
draw_shades no
gap_x 7
gap_y 25
maximum_width 172
minimum_size 172
no_buffers yes
own_window yes
own_window_colour 000000
own_window_hints undecorated,below,skip_taskbar,skip_pager
own_window_transparent yes
own_window_type normal
use_xft yes
xftalpha 1
xftfont sans:size=6
default_color 696969
color1 DDDDDD
color2 AAAAAA
color3 888888
color4 666666
total_run_times 0
update_interval 1
cpu_avg_samples 2
net_avg_samples 2
lua_load ~/.conky/hermes/conky.lua
lua_draw_hook_post main
TEXT
${font sans:bold:size=6}${goto 0}MACHINE $hr${font}
${goto 0}Kernel${alignr}$kernel
${goto 0}Nom${alignr}${nodename}
${goto 0}En fonction depuis${alignr}${uptime}
${goto 0}Charge${alignr}${loadavg}
${font sans:bold:size=6}${goto 0}CPU $hr${font}
${goto 0}0${goto 30}1${goto 60}2${goto 90}3${goto 120}4${goto 150}[\]
${goto 0}${cpu cpu0}${goto 30}${cpu cpu1}${goto 60}${cpu cpu2}${goto 90}${cpu cpu3}${goto 120}${cpu cpu4}${goto 150}[%]
${goto 0}${freq 0}${goto 30}${freq 1}${goto 60}${freq 2}${goto 90}${freq 3}${goto 120}${freq 4}${goto 150}[mHz]
${voffset 2}${goto 80}${cpugraph cpu0 10,95 000000 000000}
${voffset -4}${goto 80}${cpugraph cpu1 10,95 000000 000000}
${voffset -4}${goto 80}${cpugraph cpu2 10,95 000000 000000}
${voffset -4}${goto 80}${cpugraph cpu3 10,95 000000 000000}
${voffset -4}${goto 80}${cpugraph cpu4 10,95 000000 000000}
${font sans:bold:size=6}${goto 0}MEMOIRE $hr${font}
${voffset 2}${goto 80}${memgraph 10,95 000000 000000}
${goto 80}MEM${alignr}SWAP
${goto 80}${mem}${alignr}${swap}
${goto 80}${memmax}${alignr}${swapmax}
${goto 80}${memperc}%${alignr}${swapperc}%
${font sans:bold:size=6}${goto 0}TOP CPU $hr${font}
${goto 0}COMMAND${goto 80} PID${goto 115}%CPU${goto 150}%MEM
${goto 0}${top name 1}${goto 80}${top pid 1}${goto 115}${top cpu 1}${goto 150}${top mem 1}
${goto 0}${top name 2}${goto 80}${top pid 2}${goto 115}${top cpu 2}${goto 150}${top mem 2}
${goto 0}${top name 3}${goto 80}${top pid 3}${goto 115}${top cpu 3}${goto 150}${top mem 3}
${goto 0}${top name 4}${goto 80}${top pid 4}${goto 115}${top cpu 4}${goto 150}${top mem 4}
${goto 0}${top name 5}${goto 80}${top pid 5}${goto 115}${top cpu 5}${goto 150}${top mem 5}
${font sans:bold:size=6}${goto 0}TOP MEMOIRE $hr${font}
${goto 0}COMMAND${goto 80} PID${goto 115}%CPU${goto 150}%MEM
${goto 0}${top_mem name 1}${goto 80}${top_mem pid 1}${goto 115}${top_mem cpu 1}${goto 150}${top_mem mem 1}
${goto 0}${top_mem name 2}${goto 80}${top_mem pid 2}${goto 115}${top_mem cpu 2}${goto 150}${top_mem mem 2}
${goto 0}${top_mem name 3}${goto 80}${top_mem pid 3}${goto 115}${top_mem cpu 3}${goto 150}${top_mem mem 3}
${goto 0}${top_mem name 4}${goto 80}${top_mem pid 4}${goto 115}${top_mem cpu 4}${goto 150}${top_mem mem 4}
${goto 0}${top_mem name 5}${goto 80}${top_mem pid 5}${goto 115}${top_mem cpu 5}${goto 150}${top_mem mem 5}
${font sans:bold:size=6}${goto 0}DISQUES $hr${font}
${goto 0}NOM${alignc}LECTURE${alignr}ECRITURE
${goto 0}sda09${alignc}${diskio_read sda9}${alignr}${diskio_write sda9}
${goto 0}sdb10${alignc}${diskio_read sda10}${alignr}${diskio_write sda10}
${voffset 2}${goto 80}${diskiograph sda9 9,95 000000 000000}
${voffset -4}${goto 80}${diskiograph sda10 10,95 000000 000000}
${goto 0}MNT${goto 50}USED${goto 100}SIZE${alignr}%USED
${goto 0}/${goto 50}${fs_used /}${goto 100}${fs_size /}${alignr}${fs_used_perc /}
${goto 0}/home${goto 50}${fs_used /home}${goto 100}${fs_size /home}${alignr}${fs_used_perc /home}
${font sans:bold:size=6}${goto 0}MATERIEL $hr${font}
${voffset 10}${goto 80}TEMP [°C]
${goto 80}t1 = ${hwmon 0 temp 1}${alignr}SDA = ${execi 120 hddtemp -n /dev/sda}
${goto 80}Gpu = ${hwmon 0 temp 1}
${goto 80}cpu1 = ${exec expr `cat /sys/class/hwmon/hwmon2/temp1_input` / 1000}${alignr}cpu2 = ${exec expr `cat /sys/class/hwmon/hwmon2/temp2_input` / 1000}
${goto 80}cpu3 = ${exec expr `cat /sys/class/hwmon/hwmon2/temp3_input` / 1000}${alignr}cpu4 = ${exec expr `cat /sys/class/hwmon/hwmon2/temp1_input` / 1000}
${font sans:bold:size=6}${goto 0}WIFI $hr${font}
${goto 0}ESSID${alignr}${wireless_essid wlp2s0} (${wireless_link_qual_perc wlp2s0}%)
${goto 0}Mode wifi${alignr}${wireless_mode wlp2s0}
#${goto 0}Adresse MAC${alignr}${wireless_ap wlp2s0}
#${goto 0}GW/LC IPv4${alignr}${gw_ip}/${addr wlp2s0}
${voffset 2}${goto 0}Entrant: ${downspeedf wlp2s0} [Kb/s]${alignr}total ${totaldown wlp2s0}
${goto 0}${downspeedgraph wlp2s0 10,175 000000 000000}
${goto 0}Sortant: ${upspeedf wlp2s0} [Kb/s]${alignr}total ${totalup wlp2s0}
${goto 0}${upspeedgraph wlp2s0 10,175 000000 000000}
Code : Tout sélectionner
require 'cairo'
gauge = {
{
name='cpu', arg='cpu1', max_value=100,
x=40, y=145,
graph_radius=24,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0x898989, graph_fg_alpha=0.5,
hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
txt_radius=32,
txt_weight=0, txt_size=0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.3,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='cpu 1',
caption_weight=1, caption_size=7.0,
caption_fg_colour=0x898989, caption_fg_alpha=0.5,
},
{
name='cpu', arg='cpu2', max_value=100,
x=40, y=145,
graph_radius=18,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0x898989, graph_fg_alpha=0.5,
hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
txt_radius=42,
txt_weight=0, txt_size=0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.3,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='cpu 2',
caption_weight=1, caption_size=7.0,
caption_fg_colour=0x898989, caption_fg_alpha=0.5,
},
{
name='cpu', arg='cpu3', max_value=100,
x=40, y=145,
graph_radius=12,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0x898989, graph_fg_alpha=0.5,
hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
txt_radius=10,
txt_weight=0, txt_size=0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.3,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0x898989, graduation_fg_alpha=0.3,
caption='cpu 3',
caption_weight=1, caption_size=7.0,
caption_fg_colour=0x898989, caption_fg_alpha=0.5,
},
{
name='cpu', arg='cpu4', max_value=100,
x=40, y=145,
graph_radius=6,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0x898989, graph_fg_alpha=0.5,
hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
txt_radius=10,
txt_weight=0, txt_size=0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.3,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='cpu 4',
caption_weight=1, caption_size=7.0,
caption_fg_colour=0x898989, caption_fg_alpha=0.5,
},
{
name='cpu', arg='cpu0', max_value=100,
x=40, y=145,
graph_radius=30,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0x898989, graph_fg_alpha=0.5,
hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
txt_radius=40,
txt_weight=0, txt_size=8.0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.3,
graduation_radius=30,
graduation_thickness=5, graduation_mark_thickness=2,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.5,
caption='cpu',
caption_weight=1, caption_size=7.0,
caption_fg_colour=0x898989, caption_fg_alpha=0.5,
},
{
name='memperc', arg='', max_value=100,
x=40, y=235,
graph_radius=18,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0x898989, graph_fg_alpha=0.5,
hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
txt_radius=28,
txt_weight=0, txt_size=8.0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.5,
graduation_radius=18,
graduation_thickness=5, graduation_mark_thickness=2,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.5,
caption='mem',
caption_weight=1, caption_size=7.0,
caption_fg_colour=0x898989, caption_fg_alpha=0.5,
},
{
name='swapperc', arg='', max_value=100,
x=40, y=235,
graph_radius=12,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0x898989, graph_fg_alpha=0.5,
hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
txt_radius=2,
txt_weight=0, txt_size=8.0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.5,
graduation_radius=12,
graduation_thickness=5, graduation_mark_thickness=2,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.5,
caption='swap',
caption_weight=1, caption_size=7.0,
caption_fg_colour=0x898989, caption_fg_alpha=0.5,
},
{
name='fs_used_perc', arg='/', max_value=100,
x=40, y=501,
graph_radius=30,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0x898989, graph_fg_alpha=0.5,
hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
txt_radius=40,
txt_weight=0, txt_size=8.0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.5,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='/',
caption_weight=1, caption_size=7.0,
caption_fg_colour=0x898989, caption_fg_alpha=0.5,
},
{
name='fs_used_perc', arg='/home/', max_value=100,
x=40, y=501,
graph_radius=24,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0x898989, graph_fg_alpha=0.5,
hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
txt_radius=40,
txt_weight=0, txt_size=8.0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.5,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='/home',
caption_weight=1, caption_size=7.0,
caption_fg_colour=0x898989, caption_fg_alpha=0.5,
},
{
name='hwmon', arg='0 temp 1', max_value=100,
x=40, y=632,
graph_radius=24,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0x898989, graph_fg_alpha=0.5,
hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
txt_radius=40,
txt_weight=0, txt_size=8.0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.5,
graduation_radius=24,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='carte',
caption_weight=1, caption_size=7.0,
caption_fg_colour=0x898989, caption_fg_alpha=0.5,
},
{
name='execi', arg='120 hddtemp -n /dev/sda', max_value=100,
x=40, y=632,
graph_radius=18,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0x898989, graph_fg_alpha=0.5,
hand_fg_colour=0xEF5A29, hand_fg_alpha=0.0,
txt_radius=8,
txt_weight=0, txt_size=8.0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0.5,
graduation_radius=24,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='sda',
caption_weight=1, caption_size=7.0,
caption_fg_colour=0x898989, caption_fg_alpha=0.5,
},
}
function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function angle_to_position(start_angle, current_angle)
local pos = current_angle + start_angle
return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end
function draw_gauge_ring(display, data, value)
local max_value = data['max_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_start_angle = data['graph_start_angle']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
local graph_end_angle = (max_value * graph_unit_angle) % 360
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
local val = value % (max_value + 1)
local start_arc = 0
local stop_arc = 0
local i = 1
while i <= val do
start_arc = (graph_unit_angle * i) - graph_unit_thickness
stop_arc = (graph_unit_angle * i)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = start_arc
start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
stop_arc = (graph_unit_angle * val)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
cairo_stroke(display)
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = graph_end_angle / graduation_unit_angle
local i = 0
while i < nb_graduation do
cairo_set_line_width(display, graduation_thickness)
start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
local txt_radius = data['txt_radius']
local txt_weight, txt_size = data['txt_weight'], data['txt_size']
local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
cairo_set_font_size (display, txt_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
cairo_show_text (display, value)
cairo_stroke (display)
local caption = data['caption']
local caption_weight, caption_size = data['caption_weight'], data['caption_size']
local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
cairo_set_font_size (display, caption_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
cairo_move_to (display, x + tox + 5, y + toy + 1)
if graph_start_angle < 105 then
cairo_move_to (display, x + tox - 30, y + toy + 1)
end
cairo_show_text (display, caption)
cairo_stroke (display)
end
function go_gauge_rings(display)
local function load_gauge_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_gauge_ring(display, data, value)
end
for i in pairs(gauge) do
load_gauge_rings(display, gauge[i])
end
end
function conky_main()
if conky_window == nil then
return
end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local display = cairo_create(cs)
local updates = conky_parse('${updates}')
update_num = tonumber(updates)
if update_num > 5 then
go_gauge_rings(display)
end
cairo_surface_destroy(cs)
cairo_destroy(display)
end