conky (postαρετε τα conkyrc σας)

...wallpapers, screenshots, videos, χιούμορ, κλπ

Συντονιστές: Geochr, konnn

Re: conky (postαρετε τα conkyrc σας)

Δημοσίευσηαπό anapodos » 12 Απρ 2015, 19:37

Έτοιμο και το δικό μου μετά από πραγματικά πολλές ώρες στησίματος (46 σύνολο μιας και δεν είχα ιδέα και όλα γίνονταν με το χέρι).
Το τελικό αποτέλεσμα είναι η παρακάτω εικόνα
http://i.imgur.com/QpMlBuP.jpg
Συνολικά είναι 5 αρχεία conkyrc και είναι τα παρακάτω για όποιον ενδιαφέρεται

Clock:
Κώδικας: Επιλογή όλων
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Use Xft?
use_xft yes
xftfont cure:size=6

# 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,sticky,skip_taskbar,skip_pager

# Minimum size of text area
minimum_size 500 45

maximum_width 1500

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border width
border_width 0

# Default colors and also border colors
default_color 303030
#default_shade_color white
#default_outline_color black
own_window_colour 262524

# 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_y 44
gap_x 190
gap_y 44

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about?  This only affects certain objects.
#use_spacer no

color0 467f77       # Light blue

TEXT
${color0}${goto 230}${voffset 6}${font D3 Euronism:size=36}${time %I}${color red}:${color grey60}${time %M}
${color0}${goto 190}${font Liberation Mono:bold:size=10}Date: ${color grey60}${time %A  %d %b. %Y}
${color0}${goto 190}Uptime: ${color grey60}$uptime_short

${color0}${goto 190}Distro: ${color grey60}${pre_exec lsb_release -d -s} (${pre_exec lsb_release -c -s})
${color0}${goto 190}Kernel: ${color grey60}$kernel
${color0}${goto 190}Hostname: ${color grey60}$nodename

${color0}${goto 190}Updates: ${color grey60}You have ${color red}${execi 18000 aptitude search "~U" | wc -l}${color grey60} new updates!
${color0}${goto 190}Last update: ${color grey60}${execi  1800 ls -l /var/lib/apt/periodic/update-success-stamp | awk '{print $6" "$7" "$8}'}

System info:
Κώδικας: Επιλογή όλων
# Use Xft?
use_xft yes
xftfont cure:size=6

# 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,sticky,skip_taskbar,skip_pager

#Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
#minimum_size 800 200

maximum_width 800

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border width
border_width 1

# Default colors and also border colors
default_color 303030
#default_shade_color white
#default_outline_color black
own_window_colour 262524

# 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 45
gap_y 310

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about?  This only affects certain objects.
#use_spacer yes

color0 467f77       # Light blue

TEXT
#${font Liberation Mono:bold:size=10}${color0}Cpu 1:${color grey60}  ${cpu cpu1}%
${font Liberation Mono:bold:size=12}${color0}${goto 90}Hardware Information
${font Liberation Mono:bold:size=10}${color0}Motherboard: ${color red}${execi 3600 dmidecode -t 2 | grep Manufacturer | cut -c 16-19} ${execi 3600 dmidecode -t 2 |grep Product | cut -c 16-24}
${color0}CPU: ${color red}${goto 108}${execi 3600 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'| uniq | cut -c 1-30 | sed 's/(tm)//'}
${color0}GPU: ${color red}${goto 108}${execi 3600 aticonfig --lsa | head -n 1 | cut -c 14-31}
${color0}RAM: ${color red}${goto 108}$memmax
#${color grey60}${cpugraph cpu1 20,350 303030 467f77}
#${color0}Cpu 2:${color grey60}  ${cpu cpu2}%
#${color grey60}${cpugraph cpu2 20,350 303030 467f77}

${font Liberation Mono:bold:size=12}${color0}${goto 90}System Information
${font Liberation Mono:bold:size=10}${color0}Ram used:${color grey60}${goto 100} $mem ${goto 171}/ $memmax ($memeasyfree free)
${color0}Swap used:${color grey60}${goto 100} $swap ${goto 171}/ $swapmax ($swapfree free)
${color0}CPU clock:${color grey60}${goto 100} $freq_g GHz
${color0}CPU used:${color grey60}${goto 100} $cpu%

${color0}${goto 177}PID${goto 232}CPU%${goto 285}MEM
      Top Cpu${color grey60}${font Liberation Mono:bold:size=10}
${top name 1}${goto 170}${top pid 1}${goto 220}${top cpu 1}${goto 285}${top mem_res 1}
${top name 2}${goto 170}${top pid 2}${goto 220}${top cpu 2}${goto 285}${top mem_res 2}
${top name 3}${goto 170}${top pid 3}${goto 220}${top cpu 3}${goto 285}${top mem_res 3}
${top name 4}${goto 170}${top pid 4}${goto 220}${top cpu 4}${goto 285}${top mem_res 4}
${top name 5}${goto 170}${top pid 5}${goto 220}${top cpu 5}${goto 285}${top mem_res 5}
${color0}${font Liberation Mono:bold:size=10}      Top Mem${color grey60}${font Liberation Mono:bold:size=9}
${top_mem name 1}${goto 170}${top_mem pid 1}${goto 220}${top_mem cpu 1}${goto 285}${top_mem mem_res 1}
${top_mem name 2}${goto 170}${top_mem pid 2}${goto 220}${top_mem cpu 2}${goto 285}${top_mem mem_res 2}
${top_mem name 3}${goto 170}${top_mem pid 3}${goto 220}${top_mem cpu 3}${goto 285}${top_mem mem_res 3}
${top_mem name 4}${goto 170}${top_mem pid 4}${goto 220}${top_mem cpu 4}${goto 285}${top_mem mem_res 4}
${top_mem name 5}${goto 170}${top_mem pid 5}${goto 220}${top_mem cpu 5}${goto 285}${top_mem mem_res 5}

${color red}${voffset 48}${font Liberation Mono:bold:size=12}${goto 90}System Temperatures
${color0}${voffset 5}${font Liberation Mono:bold:size=10}CPU Temp: ${color grey60}${goto 90}${execi 5 sensors | grep 'CPU Temp' | awk '{print $3}' | cut -c 2-}${color0}${goto 200}GPU Temp: ${color grey60}${execi 5 aticonfig --odgt | grep Sensor | awk '{print $5}' | cut -c 1-4}°C
${color0}MB ${goto 38}Temp: ${color grey60}${goto 90}${execi 5 sensors | grep MB | awk '{print $3}' | cut -c 2-}${color0}${goto 200}sda Temp: ${color grey60}${hddtemp /dev/sda}.0°C

HDD info:
Κώδικας: Επιλογή όλων
# Use Xft?
use_xft yes
xftfont Liberation Mono:bold:size=10

# 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,sticky,skip_taskbar,skip_pager

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
minimum_size 600 5

maximum_width 400

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border width
border_width 1

# Default colors and also border colors
default_color 303030
#default_shade_color white
#default_outline_color black
own_window_colour 262524

# 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 35
gap_y 880

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about?  This only affects certain objects.
#use_spacer yes

color0 467f77       # Light blue

TEXT
#${color0}${execp conkyRhythmbox --template=~/.conky/.conkyRhythmbox.template}
${goto 75}${color0}Root:${color grey60}${goto 175}${fs_free /}${goto 250}free of ${goto 320}${fs_size /}
${goto 75}${color0}${fs_bar 5,310 /}
${goto 75}${color0}Home:${color grey60}${goto 175}${fs_free /home}${goto 250}free of ${goto 320}${fs_size /home}
${goto 75}${color0}${fs_bar 5,310 /home}
${goto 75}${color0}backup 1TB:${color grey60}${goto 175}${fs_free /media/backup1tb}${goto 250}free of ${goto 320}${fs_size //media/backup1tb}
${goto 75}${color0}${fs_bar 5,310 /media/backup1tb}
${goto 75}${color0}1TB:${color grey60}${goto 175}${fs_free /media/1TB}${goto 250}free of ${goto 320}${fs_size /media/1TB}
${goto 75}${color0}${fs_bar 5,310 /media/1TB}

Network:
Κώδικας: Επιλογή όλων
# Use Xft?
use_xft yes
xftfont Liberation Mono:bold:size=10

# 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,sticky,skip_taskbar,skip_pager

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
minimum_size 600 5

maximum_width 800

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border width
border_width 1

# Default colors and also border colors
default_color 303030
#default_shade_color white
#default_outline_color black
own_window_colour 262524

# 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 50
gap_y 70

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about?  This only affects certain objects.
#use_spacer yes

color0 467f77       # Light blue

TEXT
${color0}Internal IP: ${color grey60}${execi 1800 ifconfig | perl -nle'/dr:(\S+)/ && print $1' | head -n1}     ${color0}External IP: ${color grey60}${execi 1800 wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'}     ${color0}MAC: ${color grey60}${execi 1800 ifconfig | grep HWaddr | awk '{print $5}'

Weather:
Κώδικας: Επιλογή όλων
# Use Xft?
use_xft yes
xftfont cure:size=6

# 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 override
#own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
minimum_size 310 0
maximum_width 600

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border width
border_width 1

# Default colors and also border colors
default_color 303030
#default_shade_color white
#default_outline_color black
own_window_colour 262524

# Default colors and also border colors
default_color white
default_shade_color black
default_outline_color white

# own window options
own_window      yes
own_window_transparent   yes
own_window_type      normal
own_window_hints   undecorated,below,sticky,skip_taskbar,skip_pager

# 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 75
gap_y 43

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about?  This only affects certain objects.
#use_spacer right


color0 467f77       # Light blue
text_buffer_size 2048

# variable is given either in format $variable or in ${variable}. Latter
# allows characters right after the variable and must be used in network
# stuff because of an argument

# stuff after 'TEXT' will be formatted on screen

TEXT
${image /home/kostas/.conky/foreca_logo.png  -p 65,10 -s 120x21}
${execpi 3600 ~/weather}

${color0}${font caviar dreams:bold:size=30}Λάρισα  ${color grey60}${execi 3630 awk 'NR==405' ~/.conky/weather_today | grep -oP '.\d+'}°C
${color0}${font caviar dreams:bold:size=10}Ο καιρός είναι ${execi 3630 awk 'NR==420' ~/.conky/weather_today | sed -e 's/^[ \t]*//;s/<br \/>//;s/.$//;s/./\L&/'}
${color0}${goto 200}Υγρασία ${color grey60}${goto 315}${execi 3630 awk 'NR==426' ~/.conky/weather_today |grep -oP '\d+\.\d.'}
${color0}${goto 200}Ορατότητα ${color grey60}${goto 315}${execi 3630 awk 'NR==427' ~/.conky/weather_today |grep -oP '\d+...'}
${color0}${goto 200}Ανατολή ${color grey60}${goto 315}${execi 3630 awk 'NR==429' ~/.conky/weather_today |grep -oP '\d+...' | awk 'NR==1'}
${color0}${goto 200}Δύση ${color grey60}${goto 315}${execi 3630 awk 'NR==429' ~/.conky/weather_today |grep -oP '\d+...' | awk 'NR==2'}

Για τον καιρό τρέχει ένα script που κατεβάζει με το εργαλείο wget την σελίδα αν το θέλει κάποιος το ποστάρω.
Για το τερματικό στην επιφάνεια εργασίας το έκανα με το devilspie
1 Γνώσεις Linux: Ικανοποιητικό ┃ Προγραμματισμού: Πρώτα βήματα ┃ Αγγλικών: Πολύ καλό
2 Ubuntu 12.04 precise 3.2.0-55-generic 64bit (en_US.UTF-8, Unity ubuntu), Ubuntu 3.2.0-54-generic, Windows 7
3 AMD Athlon 64 X2 Dual Core Processor 6000+ ‖ RAM 3955 MiB ‖ ASUS INC. M2R32-MVP
4 Advanced Micro Devices, Inc. [AMD/ATI] Turks PRO [Radeon HD 6570/7570] [1002:6759] {fglrx_pci}
5 eth0: Marvell 88E8001 Gigabit Ethernet Controller [11ab:4320] (rev 13)
anapodos
dudeTUX
dudeTUX
 
Δημοσιεύσεις: 400
Εγγραφή: 04 Δεκ 2008, 02:33
Εκτύπωση

Re: conky (postαρετε τα conkyrc σας)

Δημοσίευσηαπό fog » 12 Απρ 2015, 22:13



Κατά καιρούς έχω χρησιμοποιήσει διάφορα εντυπωσιακά conky που όμως οι πληροφορίες τους κατέληγαν να κρύβονται πίσω από τις ανοιχτές εφαρμογές. Εδώ και αρκετό καιρό έχω καταλήξει σε ένα dzen based conky γραμμή, με όλες τις πληροφορίες που με ενδιαφέρουν, το οποίο -ρυθμίζοντας το margin του openbox που χρησιμοποιώ σαν window manager- είναι πάντα ορατό.
Εκτός από αυτό το πλεονέκτημα έχω ρυθμίσει να δείχνει το keyboard layout, κάτι που με βολεύει μιας και έτσι δε χρειάζεται να χρησιμοποιώ το panel, ώστε να εκμεταλλεύομαι όλη την οθόνη του laptop μου που είναι μόνο 13".
Σε αυτό με βοηθάει το custom menu στο δεξί κλικ του openbox που έχω για να μου δίνει άμεση πρόσβαση στις εφαρμογές που χρησιμοποιώ πιο συχνά, το κεντρικό μενού του συστήματος με όλα τα προγράμματα, συν ένα μενού με το desktop και όλες τις ανοιχτές εφαρμογές.

Το συγκεκριμένο conky βασίζεται στο dzen2:
Dzen is a general purpose messaging, notification and menuing program for X11.
It was designed to be fast, tiny and scriptable in any language


Για να το χρησιμοποιήσει κάποιος χρειάζεται τις παρακάτω εφαρμογές, οι οποίες βρίσκονται όλες στα repos του ubuntu:
conky, dzen2, curl (για την ενημέρωση του καιρού) και aptitude (για να ενημερώνει πόσες αναβαθμίσεις είναι διαθέσιμες).

Τα απαρραίτητα αρχεία είναι: τα εικονίδια (το χρώμα των οποίων μπορεί να είναι όποιο εμείς θέλουμε και ρυθμίζεται στο conkyrc) και βρίσκονται εδώ, το βασικό conkyrc και τα παρακάτω scripts, τα οποία πρέπει να τα κάνουμε εκτελέσιμα: το script εκκίνησης, το script του καιρού και αυτό του gmail. Η τελευταία ένδειξη είναι για μουσική και στο δικό μου setup παίρνει πληροφορίες από το exaile που χρησιμοποιώ σαν music player. Μπορεί κάποιος να το ρυθμίσει με τον αντίστοιχο κώδικα για τον δικό του player ή να αφαιρέσει το κομμάτι του κώδικα εντελώς.

Τα διάφορα συστατικά μπορούν να τοποθετηθούν όπου εμείς θέλουμε, αρκεί να ενημερώσουμε κατάλληλα, με το σωστό path, τα αρχεία που τα καλούν. Οι οδηγίες θα είναι με τις δικές μου επιλογές και θα δουλέψουν στο όποιο σύστημα μόνο με μια αλλαγή, αν αντικατασταθεί σε όλα τα αρχεία το username μου με το όνομα του home του χρήστη.

Μέσα στο bin φάκελλο που έχω στο home μου, βρίσκεται το αρχείο εκκίνησης dzenbar.sh. Μέσα στο .conky βρίσκονται ο φάκελλος dzicons με τα εικονίδια και το αρχείο conkyrc_dzen_mine (σε αυτό το αρχείο πρέπει να αντικατασταθεί το όνομα χρήστη με replace all). Στο φάκελλο .scripts βρίσκονται τα αρχεία gmail.py (εδώ πρέπει να τοποθετηθεί το username του gmail και το password, μειονέκτημα ότι αυτά βρίσκονται σε απλό αρχείο κειμένου και είναι προσβάσιμα σε όποιον άλλον μπορεί να μπαίνει στο λογαριασμό μας) και weather.sh (όπου θα αντικατασταθεί ο κωδικός πόλης μιας και τώρα είναι ρυθμισμένο να δείχνει καιρό για την Αθήνα).

Μπορούμε να ρυθμίσουμε τη θέση, το ύψος, τη γραμματοσειρά, τα χρώματα σε background, γραμματοσειράς, εικονιδιών και ενδείξεων, τα τευλευταία και ανά ένα αν θέλουμε, ώστε να ξεχωρίζει ότι μας ενδιαφέρει πιο πολύ.

Αρχεία:

dzenbar.sh: μέσα στο /home/username/bin, το κάνουμε εκτελέσιμο και είναι αυτό που προσθέτουμε στο startup για να ξεκινάει το conky με το login. Το βάζουμε με όλη τη διαδρομή /home/κλπ/bin/dzenbar.sh Η γραμματοσειρά που χρησιμοποιώ είναι η Pragmata την οποία ή την κατεβάζουμε ή την αντικαθιστούμε με κάποια που έχουμε και μας αρέσει.

Κώδικας: Επιλογή όλων
#! /bin/bash

RC="$HOME/.conky/conkyrc_dzen_mine"
FG="#bfbfbf"
BG="#292229"
ALIGN="center"
WIDTH="1366"
HEIGHT="12"
FONT="Pragmata:size=8"
XPOS="0"
YPOS="756"

conky -c $RC | dzen2 -e 'button2=;' -fg $FG -bg $BG -ta $ALIGN -h $HEIGHT -x $XPOS -y $YPOS -fn "$FONT" &

exit 0


conkyrc_dzen_mine: βρίσκεται μέσα στο φάκελλο .conky και κάνουμε αντικατάσταση τον κωδικό πόλης και το όνομα του home μας όπου υπάρχει διαδρομή αρχείων

Κώδικας: Επιλογή όλων
########################################################################
# dzen conkyrc                                                         #
########################################################################
#  Settings                                                            #
########################################################################
background yes
out_to_x no
out_to_console yes
update_interval 1.0
total_run_times 0
top_name_width 10
use_spacer none
double_buffer yes
cpu_avg_samples 2
text_buffer_size 2048
override_utf8_locale yes
if_up_strictness address

########################################################################
#  Output                                                              #
########################################################################
TEXT
${if_up wlan0}^fg(\#6F916F)^i(/home/fog/.conky/dzicons/dish.xbm) ^fg()${execi 1800 /home/fog/.scripts/weather.sh "EUR|GR|GR007|Athens"} \
^fg(\#B9AD87)^i(/home/fog/.conky/dzicons/info9.xbm) ^fg()${uptime_short} ^fg(\#70A7A9)^i(/home/fog/.conky/dzicons/info6.xbm) ^fg()${nodename} \
^fg(\#9A98A7)^i(/home/fog/.conky/dzicons/info2.xbm) ^fg()${exec uname -r | cut -c1-21} \
^fg(\#719471)^i(/home/fog/.conky/dzicons/temp6.xbm) ^fg(\#A05458)${acpitemp}°C \
^fg(\#6F916F)^i(/home/fog/.conky/dzicons/info10.xbm) ^fg()${execi 1000 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'| uniq | cut -c 19-40} \
^fg(\#B9AD87)^i(/home/fog/.conky/dzicons/cpu.xbm) ^fg()${cpu cpu0}% ${cpu cpu1}% ${cpu cpu2}% ${cpu cpu3}% \
^fg(\#70A7A9)^i(/home/fog/.conky/dzicons/mem.xbm) ^fg(\#A05458)${mem}/^fg()${memmax} \
^fg()${if_existing /sys/class/power_supply/BAT0}${if_match ${battery_percent BAT0} >=26}^fg()^i(/home/fog/.conky/dzicons/bat_full_01.xbm)${else}\
^fg(\#CC0000)^i(/home/fog/.conky/dzicons/bat_low_01.xbm)^fg()${endif} ^fg()${battery_percent BAT0}% \
${else}${endif}${if_existing /sys/class/power_supply/BAT1}${if_match ${battery_percent BAT1} >=26}^fg(\#7cfc00)^i(/home/fog/.conky/dzicons/bat_full_01.xbm)${else}\
^fg(\#CC0000)^i(/home/fog/.conky/dzicons/bat_low_01.xbm)^fg()${endif} ^fg()${battery_percent BAT1}%${else}${endif} \
^fg(\#9A98A7)^i(/home/fog/.conky/dzicons/home.xbm) ^fg()${fs_used_perc /}% \
^fg(\#719471)^i(/home/fog/.conky/dzicons/mail.xbm) ^fg(\#A05458)${execpi 120 python /home/fog/.scripts/gmail.py}^fg()${endif} \
${if_gw}^fg()${if_up eth0}^i(/home/fog/.conky/dzicons/net_wired.xbm) \
^fg(\#6F916F)^i(/home/fog/.conky/dzicons/net_up_02.xbm) ^fg()${upspeedf eth0} \
^fg(\#B9AD87)^i(/home/fog/.conky/dzicons/net_down_02.xbm) ^fg()${downspeedf eth0} \
^fg()${endif}${if_up wlan0}^fg(\#9A98A7)^i(/home/fog/.conky/dzicons/wifi_02.xbm) ^fg()${wireless_essid wlan0} ${wireless_link_qual wlan0}% \
^fg(\#6F916F)^i(/home/fog/.conky/dzicons/net_up_02.xbm) ^fg()${upspeedf wlan0} \
^fg(\#B9AD87)^i(/home/fog/.conky/dzicons/net_down_02.xbm) ^fg()${downspeedf wlan0} \
^fg()${endif}${endif} \
^fg(\#6F916F)^i(/home/fog/.conky/dzicons/pacman.xbm) ^fg()${execi 3000 aptitude search "~U" | wc -l} \
^fg(\#719471)^i(/home/fog/.conky/dzicons/alien.xbm) ^fg(\#A05458)${if_match ${execi 2 xset -q | grep -A 0 'LED' | cut -c63} == 0}us^fg()${else}gr^fg()${endif} \
^fg(\#70A7A9)^i(/home/fog/.conky/dzicons/cal.xbm) ^fg()${time %d/%m}^fg(\#9A98A7) ^i(/home/fog/.conky/dzicons/clock.xbm) ^fg()${time %H:%M} \
${if_running exaile}^fg(\#70A7A9)^i(/home/fog/.conky/dzicons/phones.xbm) ^fg()${execi 10 exaile --get-title} - ${execi 10 exaile --get-artist} ${else}^fg(\#6F916F)^i(/home/fog/.conky/dzicons/note.xbm) ^fg()Music is your only friend^fg()${endif}


weather.sh: βρίσκεται μέσα στο φάκελλο .scripts, πρεπει να είναι εκτελέσιμο και να έχει το σωστό κωδικό για την πόλη μας

Κώδικας: Επιλογή όλων
#!/bin/sh
#AccuWeather (r) RSS weather tool for conky
#
#USAGE: weather.sh <locationcode>
#

METRIC=1 #Should be 0 or 1; 0 for F, 1 for C

if [ -z $1 ]; then
    echo
    echo "USAGE: weather.sh "EUR|GR|GR007|Athens""
    echo
    exit 0;
fi

curl -s http://rss.accuweather.com/rss/liveweather_rss.asp\?metric\=${METRIC}\&locCode\=$1 \
| sed -n '/Currently:/ s/.*: \(.*\): \([-0-9]*\)\([CF]\).*/\1\ \2°\3/p'


gmail.py: βρίσκεται μέσα στο φάκελλο .scripts και πρέπει να βάλουμε το username και το password του gmail για να δουλέψει

Κώδικας: Επιλογή όλων
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import sys, imaplib

port = 993
server = 'imap.gmail.com'

username = 'blabla'
passwd = 'blabla1234'

imap_server = imaplib.IMAP4_SSL(server, port)
try:
   imap_server.login(username, passwd)
except:
   print('?? new')
   sys.exit( 1 )

typ, data = imap_server.select ('Inbox', True)
if typ == 'OK':
   total = int(data[0])
   typ, data = imap_server.search (None, 'SEEN')
   if typ == 'OK':
      seen = len(data[0].split())
      print('{}'.format(total - seen))

if typ != 'OK':
   print('?? new')

imap_server.logout()
Γνώσεις Linux: ✔✔✔✓✓ ┃ Προγραμματισμού: ✓✓✓✓✓ ┃ Αγγλικών: ✔✔✔✓✓
Ubuntu 16.04 64bit ‖ Lubuntu 16.10 64bit || 4.4.0-34-generic
Intel Core i7-6700HQ CPU @ 3.50GHzRAM 12GB ‖Toshiba Satellite P50-C
Intel Skylake Integrated Graphics ⋮ nVidia GM107M [GeForce GTX 950M]
enp4s0: Realtek RTL8111 Gigabit Ethernet Controller⋮ wlp3s0: Intel Wireless 3165
blog || github
Άβαταρ μέλους
fog
Συντονιστής
Συντονιστής
 
Δημοσιεύσεις: 655
Εγγραφή: 31 Μαρ 2015, 13:33
Τοποθεσία: /home/fog
Εκτύπωση

Re: conky (postαρετε τα conkyrc σας)

Δημοσίευσηαπό Learner » 16 Απρ 2015, 23:54

Ωραία παρουσίαση. Πλήρης από κάθε άποψη.
Πλέον έχω φύγει από "τον πυρετό του Conky" , θέλω την επιφάνεια εργασίας όσο πιο "καθαρή" γίνεται. Αν γίνεται, να μην έχει απολύτως τίποτα επάνω. Ούτε εικονίδια, ούτε conky, ούτε πανελ.. zip. Το μόνο που με ενδιαφέρει να βλέπω σε real time είναι οι θερμοκρασίες του συστήματος.
About Me
NickTux@GitHub

Spoiler: show
1. Ubuntu 18.04 LTS
2. Intel Core i3 CPU M 380 2.53GHz ‖ RAM 6GB ‖ Acer Aspire 5733
3. Intel Integrated Graphics [8086:0046] {i915}
4. wlan0: Atheros Inc. AR9485 Wireless Network Adapter [168c:0032] (rev 01)
Άβαταρ μέλους
Learner
Συντονιστής
Συντονιστής
 
Δημοσιεύσεις: 9765
Εγγραφή: 08 Νοέμ 2010, 21:24
Τοποθεσία: Αθήνα
Launchpad: nicktux
IRC: NickTux
Εκτύπωση

Re: conky (postαρετε τα conkyrc σας)

Δημοσίευσηαπό fog » 17 Απρ 2015, 00:33

Σ' ευχαριστώ.
Ο "πυρετός" επιστρέφει κατά διαστήματα αλλά περνά πάλι. :)
Καταλαβαίνω απόλυτα τι εννοείς για το desktop. Έτσι έχω συνήθως και το δικό μου με μόνη εξαίρεση τη γραμμή του conky για να βλέπω εύκολα θερμοκρασία, email, layout και ram που είναι εξάλλου και αυτά που ξεχωρίζουν με το χρώμα τους. Όλα τα υπόλοιπα βρίσκονται στο ...δεξί κλικ.

Γνώσεις Linux: ✔✔✔✓✓ ┃ Προγραμματισμού: ✓✓✓✓✓ ┃ Αγγλικών: ✔✔✔✓✓
Ubuntu 16.04 64bit ‖ Lubuntu 16.10 64bit || 4.4.0-34-generic
Intel Core i7-6700HQ CPU @ 3.50GHzRAM 12GB ‖Toshiba Satellite P50-C
Intel Skylake Integrated Graphics ⋮ nVidia GM107M [GeForce GTX 950M]
enp4s0: Realtek RTL8111 Gigabit Ethernet Controller⋮ wlp3s0: Intel Wireless 3165
blog || github
Άβαταρ μέλους
fog
Συντονιστής
Συντονιστής
 
Δημοσιεύσεις: 655
Εγγραφή: 31 Μαρ 2015, 13:33
Τοποθεσία: /home/fog
Εκτύπωση

Re: conky (postαρετε τα conkyrc σας)

Δημοσίευσηαπό taxiarchis » 18 Απρ 2015, 09:38

ασχολούμαι αρκετό καιρό με linux , μπαίνω συχνά στο forum διαβάζω , αλλά δεν προλαβαίνω να ποστάρω
μετά από καιρό ασχολίας με το conky έφτιαξα και εγώ ένα δικό μου ,
καταρχήν αρχάριος σε προγραμματισμό , απλά είναι copy paste η όλη δουλεία



όποιος θέλει να το χρησιμοποίησει , να το βελτιώσει ή να το αλλάξει εδώ είναι το conky

conkyrc
Spoiler: show
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Use Xft?
use_xft yes
xftfont Ubuntu:size=10

# 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,sticky,skip_taskbar,skip_pager

#Minimum size of text area
#minimum_size 320 45

#maximum_width 500

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border width
border_width 0

# Default colors and also border colors
default_color 303030
#default_shade_color white
#default_outline_color black
own_window_colour 262524

# Text alignment, other possible values are commented
#alignment top_middle
#alignment top_right
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_y 44
gap_x 5
gap_y 190

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about? This only affects certain objects.
#use_spacer no

color0 93e7dc # Light blue
color1 ffffff # default white
color2 ebf6f4 # light grey

own_window_argb_value 0
own_window_argb_visual no
minimum_size 0 0

# SET THE PATH TO THE SCRIPT HERE
lua_load ~/.conky/tax/bargraph.lua
lua_draw_hook_pre main_bars

lua_load ~/.conky/tax/rings-var.lua
lua_draw_hook_post main_pie


TEXT
${color0}${goto 90}${voffset 1}${font D3 Euronism:size=28}${time %I}${color red}:${color2}${time %M}
${color0}${goto 10}${font Ubuntu:size=10}Hostname :${color2}$nodename
${color0}${goto 10}Date : ${color2}${time %A %d %b. %Y}
${color0}${goto 10}Uptime : ${color2}$uptime_short
${color0}${goto 10}Distro : ${color2}${exec cat /etc/issue.net | cut -c1-19}
${color0}${goto 10}Kernel : ${color2}$kernel

${color0}${goto 10}Proc :${color2}${exec cat /proc/cpuinfo | grep "model name" | uniq | cut -c13-39}
${color0}${goto 10}Core 1:${goto 260}${color2}${cpu cpu0}%
${color0}${goto 10}Core 2:${goto 260}${color2}${cpu cpu2}%

${color0}${goto 20}MBTemp${goto 105}Temp 1${goto 190}Temp 2
${color2}${goto 23}${hwmon 0 temp 2}°C${goto 108}${hwmon 1 temp 3}°C${goto 195}${hwmon 1 temp 2}°C



${color0}${goto 40}Memory${goto 160}Fan Speed
${font Ubuntu:size=8}${color2}${goto 30}Total $memmax${goto 180}${hwmon 0 fan 1} rm
#----------------------------------------------------------------------------------------------------------------------------------------
# Network
#----------------------------------------------------------------------------------------------------------------------------------------





${font Ubuntu:size=10}${color0}IP: ${color2}${addr eth0}
${color0}Current: ${color2}${execi 10 /sbin/iwconfig eth0|grep Rate|cut -d"M" -f1|cut -b20-24} Mbits/sec
${color0}Down: ${color2}${downspeed eth0}${color2} k/s ${alignr}${font Ubuntu:size=10}${color0}Up:${color2}${upspeed eth0} k/s
${downspeedgraph eth0 30,120 000000 0ABFFF} ${alignr}${upspeedgraph eth0 30,120 000000 0ABFFF}$color
${color0}Total:${color2}${totaldown eth0} ${alignr}${font Ubuntu:size=10}${color0}Total:${color2}${totalup eth0}
#----------------------------------------------------------------------------------------------------------------------------------------
# Running processes
#----------------------------------------------------------------------------------------------------------------------------------------

${color0}${voffset 5}NAME${goto 155}PID${goto 220}CPU%${goto 270}MEM%${color2}${voffset 5}
${top name 1}${goto 150}${top pid 1}${goto 200}${top cpu 1}${goto 250}${top mem 1}
${top name 2}${goto 150}${top pid 2}${goto 200}${top cpu 2}${goto 250}${top mem 2}
${top name 3}${goto 150}${top pid 3}${goto 200}${top cpu 3}${goto 250}${top mem 3}
${top name 5}${goto 150}${top pid 5}${goto 200}${top cpu 5}${goto 250}${top mem 5}
${top name 6}${goto 150}${top pid 6}${goto 200}${top cpu 6}${goto 250}${top mem 6}


όπως και τα ring και bar lua που χρησιμοποίησα

rings-var.lua

Spoiler: show
--RINGS VARIATIONS by Wlourf 05 june 2010
--A mod of the widget : this one cut the arc into portions
--In fact, there is a loop which create the pie_table settings
--with multiple arc


--[[PIE CHART WIDGET BY WLOURF v1.2 26 may 2010

This widget draw a pie chart or a ring in a conky window.
More info on the parameters with pictures on this page :
http://u-scripts.blogspot.com/2010/04/p ... idget.html


v1.0 10/04/2010 original release
v1.1 15/05/2010 the parameters are in a table (pie_settings), only the values in pie_settings.tableV are mandatory
added an option to draw values like a ring (type_arc="l")
v1.2 26/05/2010 add inverse_l parameter (for type_arc="l")
bug fix : line_lgth problem
read_df function improved
]]

require 'cairo'


function set_settings()

-- ------------------PARAMETERS TO SET-----------------------
--[[available parameters for pie chart widget
-- table of labels and values {{label,conky_variable,conky_argument,convert to Go-Mo-Ko units (true/false) or unit},
-- this table is mandatory, others parameters are optionals
example
tableV={
{"cpu","cpu","",100,"%"},
{"mem","memperc","",100,"%"},
},
xc=50, -- x center of the pie, default = conky_window.width/2
yc=700, -- y center of the pie, default = conky_window.height/2
int_radius=30, -- internal radius in pixel, default = conky_window.width/6
radius=45, -- external radius in pixel, default = conky_window.width/4
first_angle=0, -- first angle of the pie (in degrees), default=0
last_angle=360, -- last angle of the pie (in degrees), default=360
type_arc="l", -- fill the arc in a linear way (ring) or radial way (pie), values l or r, default=l
inverse_l_arc=false, -- inverse arc for rings (true/false), default=false
proportional=false, -- display proportional sectors (true/false); default =false
gradient_effect=true, -- gradient effect (true/false), default=true
line_lgth=50, -- length for horizontal line (from radius to end of line), default=radius
line_width=0, -- width of line, default=1
line_space=10, -- vertical space between two lines, default=10 pixels
extend_line=true, -- grow up the line (true/false) if length of text> line_lgth, default=true
nb_decimals=0, -- number of decimals for numbers, default=1
show_text=true,-- display text (true/false), default=true
txt_font=font_name, -- font, default "Japan"
font_size=12, -- font size, default=12
font_color=colbg, -- font color (for gradient) or nil (for constant color), default = nil
font_alpha=0.5, -- font alpha, default=1
txt_offset=1, -- space between text and line, default=1
txt_format="&l &v", -- string for formatting text, possibles values are : default = "&l : &v"
-- &l for label
-- &o for occupied percentage
-- &f for free percentage
-- &v for value
-- &n for free value (non-occupied)
-- &m for max value
-- &p for percentage value of full graph
tablebg={ -- table of tables of colours for background {colors,alpha}
{colbg,0.5},
},
tablefg={ -- table of tables of colours for foreground {colors,alpha}
{col2,1},
},
},

]]


--in the table mod_settings, we store parameters for each circle
--they define the way the circle will be drawn on the conky window

--if some parameters are missing, this is not a problem, default values will be used

mod_settings={

{--MB temp
xc=60,
yc=270,
int_radius=10,
radius=25,
first_angle=0,
last_angle=270,
--if we use the default value, it is not necessary to call the parameter
--gradient_effect=true,
tablebg = {{0xFFFFFF,0.25}},

--theses parameters are for this mod only
nbPortions = 10,
--value to display, example
--value = tonumber(conky_parse("${cpu}")),
value = tonumber(conky_parse("${hwmon 0 temp 2}")),


--maximum value of the ring
maxValue=100,
--space between two portions, don't push too far, but it accepts negatives values
delta=3,
--color at beginning red, green, blue ,alpha
rgba0 = {0,255,0,1},
--color at the end : red, green, blue ,alpha
rgba1 = {255,0,0,1},
--fillPortion : if true, draw only full portions
fillPortion=true,},

{--CPU 1 temp
xc=145,
yc=270,
int_radius=10,
radius=25,
first_angle=0,
last_angle=270,
--if we use the default value, it is not necessary to call the parameter
--gradient_effect=true,
tablebg = {{0xFFFFFF,0.25}},

--theses parameters are for this mod only
nbPortions = 10,
--value to display, example
--value = tonumber(conky_parse("${cpu}")),
value = tonumber(conky_parse("${hwmon 1 temp 3}")),


--maximum value of the ring
maxValue=100,
--space between two portions, don't push too far, but it accepts negatives values
delta=3,
--color at beginning red, green, blue ,alpha
rgba0 = {0,255,0,1},
--color at the end : red, green, blue ,alpha
rgba1 = {255,0,0,1},
--fillPortion : if true, draw only full portions
fillPortion=true,},

{--CPU Temp 2
xc=230,
yc=270,
int_radius=10,
radius=25,
first_angle=0,
last_angle=270,
--if we use the default value, it is not necessary to call the parameter
--gradient_effect=true,
tablebg = {{0xFFFFFF,0.25}},

--theses parameters are for this mod only
nbPortions = 10,
--value to display, example
--value = tonumber(conky_parse("${cpu}")),
value = tonumber(conky_parse("${hwmon 1 temp 2}")),


--maximum value of the ring
maxValue=100,
--space between two portions, don't push too far, but it accepts negatives values
delta=3,
--color at beginning red, green, blue ,alpha
rgba0 = {0,255,0,1},
--color at the end : red, green, blue ,alpha
rgba1 = {255,0,0,1},
--fillPortion : if true, draw only full portions
fillPortion=true,},

{--fan speed
xc=230,
yc=345,
int_radius=15,
radius=30,
first_angle=0,
last_angle=270,
gradient_effect=false,
tablebg = {{0xffffff,0.75}},

--theses parameters are for this mod only
--nb of portions (>15 or effect won't be nice)
nbPortions = 25,
--value to display
value = tonumber(conky_parse("${hwmon 0 fan 1}")),

--maximum value of the ring
maxValue=2500,
--space between two portions, don't push too far, but it accepts negatives values
delta=3,
--here we have constant color for each portion: red
--color at beginning red, green, blue ,alpha
rgba0 = {255,255,0,1},
--color at the end : red, green, blue ,alpha
rgba1 = {255,0,255,1},
--fillPortion : if true, draw only full portions
fillPortion=false,},

{--memory
xc=100,
yc=345,
int_radius=15,
radius=30,
first_angle=0,
last_angle=270,
gradient_effect=false,
tablebg = {{0xffffff,0.75}},

--theses parameters are for this mod only
--nb of portions (>15 or effect won't be nice)
nbPortions = 20,
--value to display
value = tonumber(conky_parse("${memperc}")),

--maximum value of the ring
maxValue=100,
--space between two portions, don't push too far, but it accepts negatives values
delta=3,
--here we have constant color for each portion: red
--color at beginning red, green, blue ,alpha
rgba0 = {255,255,0,1},
--color at the end : red, green, blue ,alpha
rgba1 = {255,0,255,1},
--fillPortion : if true, draw only full portions
fillPortion=false,},
}

--END OF PARAMETERS HERE, at line 1101, there is a script to display text



end

function create_pie_settings(tt)
--default values, just in case
--theses one are needed to compute the portions used in the table pie_chart
if tt.first_angle==nil then tt.first_angle=0 end
if tt.last_angle==nil then tt.last_angle=0 end
if tt.xc==nil then tt.xc=conky_window.width/2 end
if tt.yc==nil then tt.yc=conky_window.height/2 end
if tt.int_radius ==nil then tt.int_radius =conky_window.width/6 end
if tt.radius ==nil then tt.radius =conky_window.width/4 end
if tt.gradient_effect==nil then tt.gradient_effect=true end
if tt.tablebg==nil then tt.tablebg={{0xFFFFFF,0.5}} end

--compute
local deltaR = (tt.rgba1[1]-tt.rgba0[1])/tt.nbPortions
local deltaG = (tt.rgba1[2]-tt.rgba0[2])/tt.nbPortions
local deltaB = (tt.rgba1[3]-tt.rgba0[3])/tt.nbPortions
local deltaA = (tt.rgba1[4]-tt.rgba0[4])/tt.nbPortions
local portion = tt.maxValue/tt.nbPortions
local anglePortion=(tt.last_angle-tt.first_angle)/tt.nbPortions


--create the pie_settings table
for i = 1,tt.nbPortions do
--compute the values for a block i
local value2=0
if tt.value== nil then tt.value=0 end
if tt.value<i*portion and tt.value>(i-1)*portion then
if tt.fillPortion then
value2=1
else
value2 = (tt.value-(i-1)*portion)/portion
end
end
if tt.value>=i*portion then value2 = 1 end

--create the table
local t={}
table.insert(pie_settings,t)
pie_settings[i].tableV={
--elements in the table
--{"label","conky variable","conky arg","max value", "unit"}
{"","",value2,1,""},
}
pie_settings[i].int_radius = tt.int_radius
pie_settings[i].radius = tt.radius
pie_settings[i].gradient_effect=tt.gradient_effect
pie_settings[i].first_angle = tt.first_angle+(i-1)*anglePortion
pie_settings[i].last_angle = tt.first_angle+i*anglePortion--1
pie_settings[i].show_text = false
local alpha=((pie_settings[i].last_angle+pie_settings[i].first_angle)/2)*math.pi/180

pie_settings[i].xc = tt.xc+tt.delta*math.sin(alpha)
pie_settings[i].yc = tt.yc-tt.delta*math.cos(alpha)
local color = string.format("0x" .. Dec2Hex(tt.rgba0[1]+deltaR*i) .. Dec2Hex(tt.rgba0[2]+deltaG*i) .. Dec2Hex(tt.rgba0[3]+deltaB*i) )
pie_settings[i].tablefg={
{color,tt.rgba0[4]+deltaA*i},
}
pie_settings[i].tablebg = tt.tablebg

end
end

function Dec2Hex(nValue)
--http://www.indigorose.com/forums/threads/10192-Convert-Hexadecimal-to-Decimal
if type(nValue) == "string" then
nValue = String.ToNumber(nValue);
end
nHexVal = string.format("%X", nValue); -- %X returns uppercase hex, %x gives lowercase letters
local prefix=""
if #nHexVal==1 then prefix="0" end
sHexVal = prefix..nHexVal.."";
return sHexVal;
end


--main function
function conky_main_pie()
if conky_window==nil then return end

pie_settings={}
set_settings()

local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)

if tonumber(conky_parse('${updates}'))>5 then
--mod here : create multiple pie_settngs tables
for m in pairs(mod_settings) do

create_pie_settings(mod_settings[m])
for i in pairs(pie_settings) do
--print ("i",i)
draw_pie(pie_settings[i])
end
--reset pie_settings
pie_settings={}
end
end

--begin of mod for text
--I am lazy today, I will draw labels with the pie chart widget but with invisible rings
pie_settings={
{
tableV={{"fan","exec sensors | grep 'CPU Fan' | cut -c13-16","",1500,"rpm"},},
tablebg={{0xFFFFFF,0}},
tablefg={{0xFF0000,1}},
radius=0,
int_radius=0,
line_width=0,
xc=150,
yc=conky_window.height-20,
line_lgth=100,
nb_decimals=0,
font_color=0xFFFF00,
},
{
tableV={{"cpu","exec sensors | grep 'Sys Temp' | cut -c15-16","",100,"°C"},},
tablebg={{0xFFFFFF,0}},
tablefg={{0xFF0000,1}},
radius=0,
int_radius=0,
line_width=0,
xc=270,
yc=conky_window.height-20,
line_lgth=100,
nb_decimals=0,
font_color=0xFFFF00,
},
{
tableV={{"mem","memperc","",100,"%"},},
tablebg={{0xFFFFFF,0}},
tablefg={{0xFF0000,1}},
radius=0,
int_radius=0,
line_width=0,
xc=390,
yc=conky_window.height-20,
line_lgth=100,
nb_decimals=0,
font_color=0xFFFF00,
},
{
tableV={{"cpu","cpu","",100,"%"},},
tablebg={{0xFFFFFF,0}},
tablefg={{0xFF0000,1}},
radius=0,
int_radius=0,
line_width=0,
xc=510,
yc=conky_window.height-20,
line_lgth=100,
nb_decimals=0,
font_color=0xFFFF00,
},
{
tableV={{"ul","upspeedf","eth1",2000,"kb/s"},
{"dl","downspeedf","eth1",100,"kb/s"},
},
tablebg={{0xFFFFFF,0}},
tablefg={{0xFF0000,1}},
radius=10,
first_angle=180,
last_angle=360,
int_radius=0,
line_width=0,
xc=630,
yc=conky_window.height-20,
line_lgth=90,
nb_decimals=0,
font_color=0xFFFF00,
},
{
--conky_parse("${fs_used /home}")
tableV={{"/home : " .. conky_parse("${fs_used /home}"),"","",1,""},
{"/ : " .. conky_parse("${fs_used /}"),"","",1,""},
},
tablebg={{0xFFFFFF,0}},
tablefg={{0xFF0000,1}},
radius=10,
first_angle=180,
last_angle=360,
int_radius=0,
line_width=0,
xc=750,
yc=conky_window.height-20,
line_lgth=90,
txt_format="&l",
font_color=0xFFFF00,
},
}
for i in pairs(pie_settings) do
--print ("i",i)
--draw_pie(pie_settings[i])
end

--draw separator
--cairo_set_line_width(cr,5)
--cairo_set_source_rgba(cr,0.5,0.5,0.5,0.5)
--cairo_move_to(cr,0,170)
--cairo_line_to(cr,conky_window.width,170)
--cairo_stroke(cr)

--end of mod for texts
cairo_destroy(cr)
end



function string:split(delimiter)
--source for the split function : http://www.wellho.net/resources/ex.php4?item=u108/split
local result = { }
local from = 1
local delim_from, delim_to = string.find( self, delimiter, from )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from )
end
table.insert( result, string.sub( self, from ) )
return result
end


function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end

function size_to_text(size,nb_dec)
local txt_v
if nb_dec<0 then nb_dec=0 end
size = tonumber(size)
if size>1024*1024*1024 then
txt_v=string.format("%."..nb_dec.."f Go",size/1024/1024/1024)
elseif size>1024*1024 then
txt_v=string.format("%."..nb_dec.."f Mo",size/1024/1024)
elseif size>1024 then
txt_v=string.format("%."..nb_dec.."f Ko",size/1024)
else
txt_v=string.format("%."..nb_dec.."f o",size)
end
return txt_v
end



function read_df(show_media,sort_table)
--read output of command df and return arrays of value for files systems
--reurn array of table {file syst, "", occupied space , total space , convert to G, M, K ...}

local f = io.popen("df")

local results={}

while true do
local line = f:read("*l")
if line == nil then break end
while string.match(line," ") do
line=string.gsub(line," "," ")
end
local arr_l=string.split(line," ")
local match = string.match(arr_l[1],"/")

if string.match(arr_l[1],"/") then
if not show_media then arr_l[6]=string.gsub(arr_l[6],"/media/","",1) end
table.insert(results,{arr_l[6],"",(arr_l[2]-arr_l[4])*1024,arr_l[2]*1024,true})
end
end

f:close()

if sort_table then
--how to sort table into table?
local flagS=true
while flagS do
for k=2, #results do
flagS=false
if tonumber(results[1][3])>tonumber(results[2][3]) then
local tmpV = results[1]
results[1] = results[2]
results[2] = tmpV
flagS=true
end
if tonumber(results[k][3])<tonumber(results[k-1][3]) then
local tmpV = results[k-1]
results[k-1] = results[k]
results[k] = tmpV
flagS=true
end
end
end
end

return results --array {file syst, occupied space , total space }
end


function draw_pie(t)
if t.tableV==nil then
print ("No input values ...")
return
else
tableV=t.tableV
end

if t.xc==nil then t.xc=conky_window.width/2 end
if t.yc==nil then t.yc=conky_window.height/2 end
if t.int_radius ==nil then t.int_radius =conky_window.width/6 end
if t.radius ==nil then t.radius =conky_window.width/4 end
if t.first_angle==nil then t.first_angle =0 end
if t.last_angle==nil then t.last_angle=360 end
if t.proportional==nil then t.proportional=false end
if t.tablebg==nil then t.tablebg={{0xFFFFFF,0.5},{0xFFFFFF,0.5}} end
if t.tablefg==nil then t.tablefg={{0xFF0000,1},{0x00FF00,1}} end
if t.gradient_effect==nil then t.gradient_effect=true end
if t.show_text==nil then t.show_text=true end
if t.line_lgth==nil then t.line_lgth=t.int_radius end
if t.line_space==nil then t.line_space=10 end
if t.line_width==nil then t.line_width=1 end
if t.extend_line==nil then t.extend_line=true end
if t.txt_font==nil then t.txt_font="Japan" end
if t.font_size==nil then t.font_size=12 end
--if t.font_color==nil then t.font_color=0xFFFFFF end
if t.font_alpha==nil then t.font_alpha = 1 end
if t.txt_offset==nil then t.txt_offset = 1 end
if t.txt_format==nil then t.txt_format = "&l : &v" end
if t.nb_decimals==nil then t.nb_decimals=1 end
if t.type_arc==nil then t.type_arc="l" end
if t.inverse_l_arc==nil then t.inverse_l_arc=false end

local function draw_sector(tablecolor,colorindex,pc,lastAngle,angle,radius,int_radius,gradient_effect,type_arc,inverse_l_arc)
--draw a portion of arc
radiuspc=(radius-int_radius)*pc+int_radius
angle0=lastAngle
val=1
if type_arc=="l" then
val=pc;radiuspc=radius
end
angle1=angle*val

if type_arc=="l" and inverse_l_arc then

cairo_save(cr)

cairo_rotate(cr,angle0+angle)

if gradient_effect then
local pat = cairo_pattern_create_radial (0,0, int_radius, 0,0,radius)
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(tablecolor[colorindex][1],0))
cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(tablecolor[colorindex][1],tablecolor[colorindex][2]))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(tablecolor[colorindex][1],0))
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
else
cairo_set_source_rgba(cr,rgb_to_r_g_b(tablecolor[colorindex][1],tablecolor[colorindex][2]))
end
cairo_move_to(cr,0,-int_radius)
cairo_line_to(cr,0,-radiuspc)
cairo_rotate(cr,-math.pi/2)

cairo_arc_negative(cr,0,0,radiuspc,0,-angle1)
cairo_rotate(cr,-math.pi/2-angle1)
cairo_line_to(cr,0,int_radius)
cairo_rotate(cr,math.pi/2)
cairo_arc(cr,0,0,int_radius,0,angle1)
cairo_close_path (cr);
cairo_fill(cr)

cairo_restore(cr)
else

cairo_save(cr)

cairo_rotate(cr,angle0)

if gradient_effect then
local pat = cairo_pattern_create_radial (0,0, int_radius, 0,0,radius)
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(tablecolor[colorindex][1],0))
cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(tablecolor[colorindex][1],tablecolor[colorindex][2]))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(tablecolor[colorindex][1],0))
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
else
cairo_set_source_rgba(cr,rgb_to_r_g_b(tablecolor[colorindex][1],tablecolor[colorindex][2]))
end
cairo_move_to(cr,0,-int_radius)
cairo_line_to(cr,0,-radiuspc)
cairo_rotate(cr,-math.pi/2)

cairo_arc(cr,0,0,radiuspc,0,angle1)
cairo_rotate(cr,angle1-math.pi/2)
cairo_line_to(cr,0,int_radius)
cairo_rotate(cr,math.pi/2)
cairo_arc_negative(cr,0,0,int_radius,0,-angle1)
cairo_close_path (cr);
cairo_fill(cr)

cairo_restore(cr)
end


end

function draw_lines(idx,nbArcs,angle,table_colors,idx_color,adjust,line_lgth,length_txt,txt_offset,radius,line_width,line_space,font_color,font_alpha)
--draw lines

local x0=radiuspc*math.sin(lastAngle+angle/2)
local y0=-radiuspc*math.cos(lastAngle+angle/2)
local x1=1.2*radius*math.sin(lastAngle+angle/2)
local y1=-1.2*radius*math.cos(lastAngle+angle/2)

local x2=line_lgth
local y2=y1
local x3,y3=nil,nil
if x0<=0 then
x2=-x2
end

if adjust then
if x0>0 and x2-x1<length_txt then x2=x1+length_txt end
if x0<=0 and x1-x2<length_txt then x2=x1-length_txt end
end

if idx>1 then
local dY = math.abs(y2-lastPt2[2])
if dY < line_space and lastPt2[1]*x1>0 then
if x0>0 then
y2 = line_space+lastPt2[2]
else
y2 = -line_space+lastPt2[2]
end
if (y2>y1 and x0>0) or (y2<y1 and x0<0 ) then
--x3 is for vertical segment if needed
x3,y3=x2,y2
x2=x1
if x3>0 then x3=x3+txt_offset end
else
Z=intercept({x0,y0},{x1,y1},{0,y2},{1,y2})
x1,y1=Z[1],Z[2]
end
end
else
--remind x2,y2 of first value
x2first,y2first = x2,y2
end

if font_color==nil then
cairo_set_source_rgba(cr,rgb_to_r_g_b(table_colors[idx_color][1],table_colors[idx_color][2]))
else
local pat = cairo_pattern_create_linear (x2,y2, x0,y0)
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(font_color,font_alpha))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(table_colors[idx_color][1],table_colors[idx_color][2]))
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
end


cairo_move_to(cr,x0,y0)
cairo_line_to(cr,x1,y1)
cairo_line_to(cr,x2,y2)
if x3~=nil then
cairo_line_to(cr,x3,y3)
x2,y2=x3,y3
end
cairo_set_line_width(cr,line_width)
cairo_stroke(cr)
--lastAngle=lastAngle+angle
return {x2,y2}
end

function intercept(p11,p12,p21,p22)
--calculate interscetion of two lines and return coordinates
a1=(p12[2]-p11[2])/(p12[1]-p11[1])

a2=(p22[2]-p21[2])/(p22[1]-p21[1])

b1=p11[2]-a1*p11[1]

b2=p21[2]-a2*p21[1]

X=(b2-b1)/(a1-a2)

Y=a1*X+b1
return {X,Y}
end

--some checks
if t.first_angle>=t.last_angle then
local tmp_angle=t.last_angle
--t.last_angle=t.first_angle
--t.first_angle=tmp_angle
print ("inversed angles")
end

if t.last_angle-t.first_angle>360 and t.first_angle>0 then
t.last_angle=360+t.first_angle
print ("reduce angles")
end

if t.last_angle+t.first_angle>360 and t.first_angle<=0 then
t.last_angle=360+t.first_angle
print ("reduce angles")
end

if t.int_radius<0 then t.int_radius =0 end
if t.int_radius>t.radius then
local tmp_radius=t.radius
t.radius=t.int_radius
t.int_radius=tmp_radius
print ("inversed angles")
end
if t.int_radius==t.radius then
t.int_radius=0
-- print ("int radius set to 0")
end
--end of checks

cairo_save(cr)
cairo_translate(cr,t.xc,t.yc)
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND)
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND)

local nbArcs=#tableV
local anglefull= (t.last_angle-t.first_angle)*math.pi/180
local fullsize = 0
for i= 1,nbArcs do
fullsize=fullsize+tableV[i][4]
end

local cb,cf,angle=0,0,anglefull/nbArcs
lastAngle=t.first_angle*math.pi/180
lastPt2={nil,nil}

for i =1, nbArcs do
if t.proportional then
angle=tableV[i][4]/fullsize*anglefull
end
--set colours
cb,cf=cb+1,cf+1
if cb>#t.tablebg then cb=1 end
if cf>#t.tablefg then cf=1 end

if tableV[i][2]~="" then
str=string.format('${%s %s}',tableV[i][2],tableV[i][3])
else
str = tableV[i][3]
end
str=conky_parse(str)
value=tonumber(str)
if value==nil then value=0 end

--draw sectors
draw_sector(t.tablebg,cb,1,lastAngle,angle,t.radius,t.int_radius,t.gradient_effect,t.type_arc,t.inverse_l_arc)
--print (t.tablefg,cf,tableV[i][2],tableV[i][3],lastAngle,angle,t.radius,t.int_radius)
--print (cf,tableV[i],tableV[i][2],tableV[i][3])
draw_sector(t.tablefg,cf,value/tableV[i][4],lastAngle,angle,t.radius,t.int_radius,t.gradient_effect,t.type_arc,t.inverse_l_arc)

if t.show_text then
--draw text
local txt_l = tableV[i][1]
local txt_opc = round(100*value/tableV[i][4],t.nb_decimals).."%%"
local txt_fpc = round(100*(tableV[i][4]-value/tableV[i][4]),t.nb_decimals).."%%"
local txt_ov,txt_fv,txt_max
if tableV[i][5]==true then
txt_ov = size_to_text(value,t.nb_decimals)
txt_fv = size_to_text(tableV[i][4]-value,t.nb_decimals)
txt_max = size_to_text(tableV[i][4],t.nb_decimals)
else
if tableV[i][5]=="%" then tableV[i][5]="%%" end
txt_ov=string.format("%."..t.nb_decimals.."f ",value)..tableV[i][5]
txt_fv=string.format("%."..t.nb_decimals.."f",tableV[i][4]-value)..tableV[i][5]
txt_max=string.format("%."..t.nb_decimals.."f",tableV[i][4])..tableV[i][5]
end
txt_pc = string.format("%."..t.nb_decimals.."f",100*tableV[i][4]/fullsize).."%%"
local txt_out = t.txt_format
txt_out = string.gsub(txt_out,"&l",txt_l) --label
txt_out = string.gsub(txt_out,"&o",txt_opc)--occ. %
txt_out = string.gsub(txt_out,"&f",txt_fpc)--free %
txt_out = string.gsub(txt_out,"&v",txt_ov) --occ. value
txt_out = string.gsub(txt_out,"&n",txt_fv) --free value
txt_out = string.gsub(txt_out,"&m",txt_max)--max
txt_out = string.gsub(txt_out,"&p",txt_pc)--percent

local te=cairo_text_extents_t:create()
cairo_set_font_size(cr,t.font_size)
cairo_select_font_face(cr, t.txt_font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
cairo_text_extents (cr,txt_out,te)

--draw lines
lastPt2=draw_lines(i,nbArcs,angle,t.tablefg,cf,t.extend_line,t.line_lgth+t.radius,
te.width + te.x_bearing,t.txt_offset,t.radius,t.line_width,t.line_space,t.font_color,t.font_alpha)

local xA=lastPt2[1]
local yA=lastPt2[2]-t.line_width-t.txt_offset
if xA>0 then xA = xA-(te.width + te.x_bearing) end
cairo_move_to(cr,xA,yA)
cairo_show_text(cr,txt_out)
end

lastAngle=lastAngle+angle
end
cairo_restore(cr)
end


--[[END OF PIE CHART WIDGET]]


και bargraph.lua
Spoiler: show
--[[ BARGRAPH WIDGET
v2.1 by wlourf (07 Jan. 2011)
this widget draws a bargraph with different effects
http://u-scripts.blogspot.com/2010/07/b ... idget.html

To call the script in a conky, use, before TEXT
lua_load /path/to/the/script/bargraph.lua
lua_draw_hook_pre main_rings
and add one line (blank or not) after TEXT


Parameters are :
3 parameters are mandatory
name - the name of the conky variable to display, for example for {$cpu cpu0}, just write name="cpu"
arg - the argument of the above variable, for example for {$cpu cpu0}, just write arg="cpu0"
arg can be a numerical value if name=""
max - the maximum value the above variable can reach, for example, for {$cpu cpu0}, just write max=100

Optional parameters:
x,y - coordinates of the starting point of the bar, default = middle of the conky window
cap - end of cap line, ossibles values are r,b,s (for round, butt, square), default="b"
http://www.cairographics.org/samples/set_line_cap/
angle - angle of rotation of the bar in degress, default = 0 (i.e. a vertical bar)
set to 90 for an horizontal bar
skew_x - skew bar around x axis, default = 0
skew_y - skew bar around y axis, default = 0
blocks - number of blocks to display for a bar (values >0) , default= 10
height - height of a block, default=10 pixels
width - width of a block, default=20 pixels
space - space between 2 blocks, default=2 pixels
angle_bar - this angle is used to draw a bar on a circular way (ok, this is no more a bar !) default=0
radius - for cicular bars, internal radius, default=0
with radius, parameter width has no more effect.

Colours below are defined into braces {colour in hexadecimal, alpha}
fg_colour - colour of a block ON, default= {0x00FF00,1}
bg_colour - colour of a block OFF, default = {0x00FF00,0.5}
alarm - threshold, values after this threshold will use alarm_colour colour , default=max
alarm_colour - colour of a block greater than alarm, default=fg_colour
smooth - (true or false), create a gradient from fg_colour to bg_colour, default=false
mid_colour - colours to add to gradient, with this syntax {position into the gradient (0 to1), colour hexa, alpha}
for example, this table {{0.25,0xff0000,1},{0.5,0x00ff00,1},{0.75,0x0000ff,1}} will add
3 colurs to gradient created by fg_colour and alarm_colour, default=no mid_colour
led_effect - add LED effects to each block, default=no led_effect
if smooth=true, led_effect is not used
possibles values : "r","a","e" for radial, parallelel, perdendicular to the bar (just try!)
led_effect has to be used with theses colours :
fg_led - middle colour of a block ON, default = fg_colour
bg_led - middle colour of a block OFF, default = bg_colour
alarm_led - middle colour of a block > ALARM, default = alarm_colour

reflection parameters, not avaimable for circular bars
reflection_alpha - add a reflection effect (values from 0 to 1) default = 0 = no reflection
other values = starting opacity
reflection_scale - scale of the reflection (default = 1 = height of text)
reflection_length - length of reflection, define where the opacity will be set to zero
calues from 0 to 1, default =1
reflection - position of reflection, relative to a vertical bar, default="b"
possibles values are : "b","t","l","r" for bottom, top, left, right
draw_me - if set to false, text is not drawn (default = true or 1)
it can be used with a conky string, if the string returns 1, the text is drawn :
example : "${if_empty ${wireless_essid wlan0}}${else}1$endif",

v1.0 (10 Feb. 2010) original release
v1.1 (13 Feb. 2010) numeric values can be passed instead conky stats with parameters name="", arg = numeric_value
v1.2 (28 Feb. 2010) just renamed the widget to bargraph
v1.3 (03 Mar. 2010) added parameters radius & angle_bar to draw the bar in a circular way
v2.0 (12 Jul. 2010) rewrite script + add reflection effects and parameters are now set into tables
v2.1 (07 Jan. 2011) Add draw_me parameter and correct memory leaks, thanks to "Creamy Goodness"

-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation version 3 (GPLv3)
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-- MA 02110-1301, USA.

]]

require 'cairo'

----------------START OF PARAMETERS ----------
function conky_main_bars()
local bars_settings={
{
name="cpu cpu0",
arg="cpu cpu0",
max=100,
angle=90,
bg_colour={0x00ffff,0.5},
fg_colour={0x00ffff,0.5},
led_effect="e",
bg_led ={0x0000ff,1},
fg_led ={0xffff00,1},
x=75,y=182,
blocks=45,
height=2,width=13,

},
{
name="cpu cpu2",
arg="cpu cpu2",
max=100,
angle=90,
bg_colour={0x00ffff,0.5},
fg_colour={0x00ffff,0.5},
led_effect="e",
bg_led ={0x0000ff,1},
fg_led ={0xffff00,1},
x=75,y=199,
blocks=45,
height=2,width=13,

},

}

-----------END OF PARAMETERS--------------



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)

cr = cairo_create(cs)
--prevent segmentation error when reading cpu state
if tonumber(conky_parse('${updates}'))>3 then
for i in pairs(bars_settings) do

draw_multi_bar_graph(bars_settings[i])

end
end
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil

end



function draw_multi_bar_graph(t)
cairo_save(cr)
--check values
if t.draw_me == true then t.draw_me = nil end
if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end
if t.name==nil and t.arg==nil then
print ("No input values ... use parameters 'name' with 'arg' or only parameter 'arg' ")
return
end
if t.max==nil then
print ("No maximum value defined, use 'max'")
return
end
if t.name==nil then t.name="" end
if t.arg==nil then t.arg="" end

--set default values
if t.x == nil then t.x = conky_window.width/2 end
if t.y == nil then t.y = conky_window.height/2 end
if t.blocks == nil then t.blocks=10 end
if t.height == nil then t.height=10 end
if t.angle == nil then t.angle=0 end
t.angle = t.angle*math.pi/180
--line cap style
if t.cap==nil then t.cap = "b" end
local cap="b"
for i,v in ipairs({"s","r","b"}) do
if v==t.cap then cap=v end
end
local delta=0
if t.cap=="r" or t.cap=="s" then delta = t.height end
if cap=="s" then cap = CAIRO_LINE_CAP_SQUARE
elseif cap=="r" then
cap = CAIRO_LINE_CAP_ROUND
elseif cap=="b" then
cap = CAIRO_LINE_CAP_BUTT
end
--end line cap style
--if t.led_effect == nil then t.led_effect="r" end
if t.width == nil then t.width=20 end
if t.space == nil then t.space=2 end
if t.radius == nil then t.radius=0 end
if t.angle_bar == nil then t.angle_bar=0 end
t.angle_bar = t.angle_bar*math.pi/360 --halt angle

--colours
if t.bg_colour == nil then t.bg_colour = {0x00FF00,0.5} end
if #t.bg_colour~=2 then t.bg_colour = {0x00FF00,0.5} end
if t.fg_colour == nil then t.fg_colour = {0x00FF00,1} end
if #t.fg_colour~=2 then t.fg_colour = {0x00FF00,1} end
if t.alarm_colour == nil then t.alarm_colour = t.fg_colour end
if #t.alarm_colour~=2 then t.alarm_colour = t.fg_colour end

if t.mid_colour ~= nil then
for i=1, #t.mid_colour do
if #t.mid_colour[i]~=3 then
print ("error in mid_color table")
t.mid_colour[i]={1,0xFFFFFF,1}
end
end
end

if t.bg_led ~= nil and #t.bg_led~=2 then t.bg_led = t.bg_colour end
if t.fg_led ~= nil and #t.fg_led~=2 then t.fg_led = t.fg_colour end
if t.alarm_led~= nil and #t.alarm_led~=2 then t.alarm_led = t.fg_led end

if t.led_effect~=nil then
if t.bg_led == nil then t.bg_led = t.bg_colour end
if t.fg_led == nil then t.fg_led = t.fg_colour end
if t.alarm_led == nil then t.alarm_led = t.fg_led end
end


if t.alarm==nil then t.alarm = t.max end --0.8*t.max end
if t.smooth == nil then t.smooth = false end

if t.skew_x == nil then
t.skew_x=0
else
t.skew_x = math.pi*t.skew_x/180
end
if t.skew_y == nil then
t.skew_y=0
else
t.skew_y = math.pi*t.skew_y/180
end

if t.reflection_alpha==nil then t.reflection_alpha=0 end
if t.reflection_length==nil then t.reflection_length=1 end
if t.reflection_scale==nil then t.reflection_scale=1 end

--end of default values


local function rgb_to_r_g_b(col_a)
return ((col_a[1] / 0x10000) % 0x100) / 255., ((col_a[1] / 0x100) % 0x100) / 255., (col_a[1] % 0x100) / 255., col_a[2]
end


--functions used to create patterns

local function create_smooth_linear_gradient(x0,y0,x1,y1)
local pat = cairo_pattern_create_linear (x0,y0,x1,y1)
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
if t.mid_colour ~=nil then
for i=1, #t.mid_colour do
cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
end
end
return pat
end

local function create_smooth_radial_gradient(x0,y0,r0,x1,y1,r1)
local pat = cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
if t.mid_colour ~=nil then
for i=1, #t.mid_colour do
cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
end
end
return pat
end

local function create_led_linear_gradient(x0,y0,x1,y1,col_alp,col_led)
local pat = cairo_pattern_create_linear (x0,y0,x1,y1) ---delta, 0,delta+ t.width,0)
cairo_pattern_add_color_stop_rgba (pat, 0.0, rgb_to_r_g_b(col_alp))
cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1.0, rgb_to_r_g_b(col_alp))
return pat
end

local function create_led_radial_gradient(x0,y0,r0,x1,y1,r1,col_alp,col_led,mode)
local pat = cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
if mode==3 then
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_alp))
cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))
else
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))
end
return pat
end






local function draw_single_bar()
--this fucntion is used for bars with a single block (blocks=1) but
--the drawing is cut in 3 blocks : value/alarm/background
--not zvzimzblr for circular bar
local function create_pattern(col_alp,col_led,bg)
local pat

if not t.smooth then
if t.led_effect=="e" then
pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
elseif t.led_effect=="a" then
pat = create_led_linear_gradient (t.width/2, 0,t.width/2,-t.height,col_alp,col_led)
elseif t.led_effect=="r" then
pat = create_led_radial_gradient (t.width/2, -t.height/2, 0, t.width/2,-t.height/2,t.height/1.5,col_alp,col_led,2)
else
pat = cairo_pattern_create_rgba (rgb_to_r_g_b(col_alp))
end
else
if bg then
pat = cairo_pattern_create_rgba (rgb_to_r_g_b(t.bg_colour))
else
pat = create_smooth_linear_gradient(t.width/2, 0, t.width/2,-t.height)
end
end
return pat
end

local y1=-t.height*pct/100
local y2,y3
if pct>(100*t.alarm/t.max) then
y1 = -t.height*t.alarm/100
y2 = -t.height*pct/100
if t.smooth then y1=y2 end
end

if t.angle_bar==0 then

--block for fg value
local pat = create_pattern(t.fg_colour,t.fg_led,false)
cairo_set_source(cr,pat)
cairo_rectangle(cr,0,0,t.width,y1)
cairo_fill(cr)
cairo_pattern_destroy(pat)

-- block for alarm value
if not t.smooth and y2 ~=nil then
pat = create_pattern(t.alarm_colour,t.alarm_led,false)
cairo_set_source(cr,pat)
cairo_rectangle(cr,0,y1,t.width,y2-y1)
cairo_fill(cr)
y3=y2
cairo_pattern_destroy(pat)
else
y2,y3=y1,y1
end
-- block for bg value
cairo_rectangle(cr,0,y2,t.width,-t.height-y3)
pat = create_pattern(t.bg_colour,t.bg_led,true)
cairo_set_source(cr,pat)
cairo_pattern_destroy(pat)
cairo_fill(cr)
end
end --end single bar






local function draw_multi_bar()
--function used for bars with 2 or more blocks
for pt = 1,t.blocks do
--set block y
local y1 = -(pt-1)*(t.height+t.space)
local light_on=false

--set colors
local col_alp = t.bg_colour
local col_led = t.bg_led
if pct>=(100/t.blocks) or pct>0 then --ligth on or not the block
if pct>=(pcb*(pt-1)) then
light_on = true
col_alp = t.fg_colour
col_led = t.fg_led
if pct>=(100*t.alarm/t.max) and (pcb*pt)>(100*t.alarm/t.max) then
col_alp = t.alarm_colour
col_led = t.alarm_led
end
end
end

--set colors
--have to try to create gradients outside the loop ?
local pat

if not t.smooth then
if t.angle_bar==0 then
if t.led_effect=="e" then
pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
elseif t.led_effect=="a" then
pat = create_led_linear_gradient (t.width/2, -t.height/2+y1,t.width/2,0+t.height/2+y1,col_alp,col_led)
elseif t.led_effect=="r" then
pat = create_led_radial_gradient (t.width/2, y1, 0, t.width/2,y1,t.width/1.5,col_alp,col_led,2)
else
pat = cairo_pattern_create_rgba (rgb_to_r_g_b(col_alp))
end
else
if t.led_effect=="a" then
pat = create_led_radial_gradient (0, 0, t.radius+(t.height+t.space)*(pt-1),
0, 0, t.radius+(t.height+t.space)*(pt),
col_alp,col_led,3)
else
pat = cairo_pattern_create_rgba (rgb_to_r_g_b(col_alp))
end

end
else

if light_on then
if t.angle_bar==0 then
pat = create_smooth_linear_gradient(t.width/2, t.height/2, t.width/2,-(t.blocks-0.5)*(t.height+t.space))
else
pat = create_smooth_radial_gradient(0, 0, (t.height+t.space), 0,0,(t.blocks+1)*(t.height+t.space),2)
end
else
pat = cairo_pattern_create_rgba (rgb_to_r_g_b(t.bg_colour))
end
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)

--draw a block
if t.angle_bar==0 then
cairo_move_to(cr,0,y1)
cairo_line_to(cr,t.width,y1)
else
cairo_arc( cr,0,0,
t.radius+(t.height+t.space)*(pt)-t.height/2,
-t.angle_bar -math.pi/2 ,
t.angle_bar -math.pi/2)
end
cairo_stroke(cr)
end
end




local function setup_bar_graph()
--function used to retrieve the value to display and to set the cairo structure
if t.blocks ~=1 then t.y=t.y-t.height/2 end

local value = 0
if t.name ~="" then
value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
--$to_bytes doesn't work when value has a decimal point,
--https://garage.maemo.org/plugins/ggit/browse.php/?p=monky;a=commitdiff;h=174c256c81a027a2ea406f5f37dc036fac0a524b;hp=d75e2db5ed3fc788fb8514121f67316ac3e5f29f
--http://sourceforge.net/tracker/index.php?func=detail&aid=3000865&group_id=143975&atid=757310
--conky bug?
--value = (conky_parse(string.format('${%s %s}', t.name, t.arg)))
--if string.match(value,"%w") then
-- value = conky_parse(string.format('${to_bytes %s}',value))
--end
else
value = tonumber(t.arg)
end

if value==nil then value =0 end

pct = 100*value/t.max
pcb = 100/t.blocks

cairo_set_line_width (cr, t.height)
cairo_set_line_cap (cr, cap)
cairo_translate(cr,t.x,t.y)
cairo_rotate(cr,t.angle)

local matrix0 = cairo_matrix_t:create()
tolua.takeownership(matrix0)
cairo_matrix_init (matrix0, 1,t.skew_y,t.skew_x,1,0,0)
cairo_transform(cr,matrix0)



--call the drawing function for blocks
if t.blocks==1 and t.angle_bar==0 then
draw_single_bar()
if t.reflection=="t" or t.reflection=="b" then cairo_translate(cr,0,-t.height) end
else
draw_multi_bar()
end

--dot for reminder
--[[
if t.blocks ~=1 then
cairo_set_source_rgba(cr,1,0,0,1)
cairo_arc(cr,0,t.height/2,3,0,2*math.pi)
cairo_fill(cr)
else
cairo_set_source_rgba(cr,1,0,0,1)
cairo_arc(cr,0,0,3,0,2*math.pi)
cairo_fill(cr)
end]]

--call the drawing function for reflection and prepare the mask used
if t.reflection_alpha>0 and t.angle_bar==0 then
local pat2
local matrix1 = cairo_matrix_t:create()
tolua.takeownership(matrix1)
if t.angle_bar==0 then
pts={-delta/2,(t.height+t.space)/2,t.width+delta,-(t.height+t.space)*(t.blocks)}
if t.reflection=="t" then
cairo_matrix_init (matrix1,1,0,0,-t.reflection_scale,0,-(t.height+t.space)*(t.blocks-0.5)*2*(t.reflection_scale+1)/2)
pat2 = cairo_pattern_create_linear (t.width/2,-(t.height+t.space)*(t.blocks),t.width/2,(t.height+t.space)/2)
elseif t.reflection=="r" then
cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,delta+2*t.width,0)
pat2 = cairo_pattern_create_linear (delta/2+t.width,0,-delta/2,0)
elseif t.reflection=="l" then
cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,-delta,0)
pat2 = cairo_pattern_create_linear (-delta/2,0,delta/2+t.width,-0)
else --bottom
cairo_matrix_init (matrix1,1,0,0,-1*t.reflection_scale,0,(t.height+t.space)*(t.reflection_scale+1)/2)
pat2 = cairo_pattern_create_linear (t.width/2,(t.height+t.space)/2,t.width/2,-(t.height+t.space)*(t.blocks))
end
end
cairo_transform(cr,matrix1)

if t.blocks==1 and t.angle_bar==0 then
draw_single_bar()
cairo_translate(cr,0,-t.height/2)
else
draw_multi_bar()
end


cairo_set_line_width(cr,0.01)
cairo_pattern_add_color_stop_rgba (pat2, 0,0,0,0,1-t.reflection_alpha)
cairo_pattern_add_color_stop_rgba (pat2, t.reflection_length,0,0,0,1)
if t.angle_bar==0 then
cairo_rectangle(cr,pts[1],pts[2],pts[3],pts[4])
end
cairo_clip_preserve(cr)
cairo_set_operator(cr,CAIRO_OPERATOR_CLEAR)
cairo_stroke(cr)
cairo_mask(cr,pat2)
cairo_pattern_destroy(pat2)
cairo_set_operator(cr,CAIRO_OPERATOR_OVER)

end --reflection
pct,pcb=nil
end --setup_bar_graph()

--start here !
setup_bar_graph()
cairo_restore(cr)
end
προσωπική ιστοσελίδαάλλη ιστοσελίδα
Γνώσεις ⇛ Linux: Αρχαριος ┃ Προγραμματισμός: Όχι ┃ Αγγλικά: Καλά
Λειτουργικό ⇛ Ubuntu 11.04 32bit σε P5N32-E SLI
Προδιαγραφές ⇛ E2200 │ 2GB │ ATI RADEON 3870 │ ----- │ ------------- │ Creative Labs CA0106 Soundblaster │ TFT 21"
taxiarchis
babeTUX
babeTUX
 
Δημοσιεύσεις: 27
Εγγραφή: 10 Αύγ 2010, 23:01
Τοποθεσία: Κρήτη
Εκτύπωση

Re: conky (postαρετε τα conkyrc σας)

Δημοσίευσηαπό fog » 18 Απρ 2015, 11:34

@ taxiarchis Πολύ ωραίο, κάποια στιγμή πρέπει να δοκιμάσω τα bars, δεν τα έχω χρησιμοποιήσει μέχρι τώρα.

Ένα παλιότερο conky που χρησιμοποιεί σχεδόν όλη την επιφάνεια εργασίας, χειμωνιάτικο, βασισμένο στα -πολύ όμορφα- lua rings και cairo clock της Alison Pitt. Οι αλλαγές στις αρχικές ρυθμίσεις είναι η προσαρμογή σε οθόνη 1366x768, η προσθήκη ενός τρίτου conky που δείχνει το τραγούδι που παίζει στο exaile και η προσθήκη 2 ακόμη rings, μιας και υπήρχε χώρος στην οθόνη μου, για τη θερμοκρασία και το σήμα του wifi.



Τα αρχεία που το αποτελούν είναι:

clock.lua:

Spoiler: show
--[[
Air Clock by Alison Pitt (2009)

This clock is designed to look like KDE 4.3's "Air" clock, but from inside Conky.

You can adjust the clock's radius and placement, as well as the size and offset of the drop shadow. You can also choose whether to display the seconds hand. This clock updates every time Conky does, so if you want to show seconds, it is recommended that you set update_interval to no more than 0.5s. If you turn off seconds, you can set the update_interval to as long as 30s. The settings are in the "Settings" section, starting at Line 21.

Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/clock.lua):
lua_load ~/scripts/clock.lua
lua_draw_hook_pre draw_clock
]]

require 'cairo'
function conky_draw_clock()
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)

-- Settings

-- What radius should the clock face (not including border) be, in pixels?

local clock_r=75

-- x and y coordinates, relative to the top left corner of Conky, in pixels

local xc=w/6
local yc=h/2

-- Extent of the shadow, in pixels

shadow_width=5

-- x and y offsets of the drop shadow, relative to the centre of the clock face, in pixels. Can be positive (downward) or negative (upward)

shadow_xoffset=0
shadow_yoffset=2

-- Do you want to show the second hand? Use this if you use a Conky update_interval > 1s. Can be true or false.

show_seconds=true

-- Grab time

local hours=os.date("%I")
local mins=os.date("%M")
local secs=os.date("%S")

secs_arc=(2*math.pi/60)*secs
mins_arc=(2*math.pi/60)*mins
hours_arc=(2*math.pi/12)*hours+mins_arc/12

-- Drop shadow

local ds_pat=cairo_pattern_create_radial(xc+shadow_xoffset,yc+shadow_yoffset,clock_r*1.25,xc+shadow_xoffset,yc+shadow_yoffset,clock_r*1.25+shadow_width)
cairo_pattern_add_color_stop_rgba(ds_pat,0,0,0,0,0.2)
cairo_pattern_add_color_stop_rgba(ds_pat,1,0,0,0,0)

cairo_move_to(cr,0,0)
cairo_line_to(cr,w,0)
cairo_line_to(cr,w,h)
cairo_line_to(cr,0,h)
cairo_new_sub_path(cr)
cairo_arc(cr,xc,yc,clock_r*1.25,0,2*math.pi)
cairo_set_source(cr,ds_pat)
cairo_set_fill_rule(cr,CAIRO_FILL_RULE_EVEN_ODD)
cairo_fill(cr)

-- Glassy border

cairo_arc(cr,xc,yc,clock_r*1.25,0,2*math.pi)
cairo_set_source_rgba(cr,0.5,0.5,0.5,0.2)
cairo_set_line_width(cr,1)
cairo_stroke(cr)

local border_pat=cairo_pattern_create_linear(xc,yc-clock_r*1.25,xc,yc+clock_r*1.25)

cairo_pattern_add_color_stop_rgba(border_pat,0,1,1,1,0.7)
cairo_pattern_add_color_stop_rgba(border_pat,0.3,1,1,1,0)
cairo_pattern_add_color_stop_rgba(border_pat,0.5,1,1,1,0)
cairo_pattern_add_color_stop_rgba(border_pat,0.7,1,1,1,0)
cairo_pattern_add_color_stop_rgba(border_pat,1,1,1,1,0.7)
cairo_set_source(cr,border_pat)
cairo_arc(cr,xc,yc,clock_r*1.125,0,2*math.pi)
cairo_close_path(cr)
cairo_set_line_width(cr,clock_r*0.25)
cairo_stroke(cr)

-- Set clock face

cairo_arc(cr,xc,yc,clock_r,0,2*math.pi)
cairo_close_path(cr)

local face_pat=cairo_pattern_create_radial(xc,yc-clock_r*0.75,0,xc,yc,clock_r)

cairo_pattern_add_color_stop_rgba(face_pat,0,1,1,1,0.5)
cairo_pattern_add_color_stop_rgba(face_pat,0.5,1,1,1,0.5)
cairo_pattern_add_color_stop_rgba(face_pat,1,0.9,0.9,0.9,0.5)
cairo_set_source(cr,face_pat)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,0.5,0.5,0.5,0.2)
cairo_set_line_width(cr, 1)
cairo_stroke (cr)

-- Draw hour hand

xh=xc+0.7*clock_r*math.sin(hours_arc)
yh=yc-0.7*clock_r*math.cos(hours_arc)
cairo_move_to(cr,xc,yc)
cairo_line_to(cr,xh,yh)

cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_line_width(cr,5)
cairo_set_source_rgba(cr,0,0,0,0.5)
cairo_stroke(cr)

-- Draw minute hand

xm=xc+0.9*clock_r*math.sin(mins_arc)
ym=yc-0.9*clock_r*math.cos(mins_arc)
cairo_move_to(cr,xc,yc)
cairo_line_to(cr,xm,ym)

cairo_set_line_width(cr,3)
cairo_stroke(cr)

-- Draw seconds hand

if show_seconds then
xs=xc+0.9*clock_r*math.sin(secs_arc)
ys=yc-0.9*clock_r*math.cos(secs_arc)
cairo_move_to(cr,xc,yc)
cairo_line_to(cr,xs,ys)

cairo_set_line_width(cr,1)
cairo_stroke(cr)
end

end


conky_widgets.lua:

Spoiler: show
--[[
Conky Widgets by londonali1010 (2009)

This script is meant to be a "shell" to hold a suite of widgets for use in Conky.

To configure:
+ Copy the widget's code block (will be framed by --(( WIDGET NAME )) and --(( END WIDGET NAME )), with "[" instead of "(") somewhere between "require 'cairo'" and "function conky_widgets()", ensuring not to paste into another widget's code block
+ To call the widget, add the following just before the last "end" of the entire script:
cr = cairo_create(cs)
NAME_OF_FUNCTION(cr, OPTIONS)
cairo_destroy(cr)
+ Replace OPTIONS with the options for your widget (should be specified in the widget's code block)

Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/conky_widgets.lua):
lua_load ~/scripts/conky_widgets.lua
lua_draw_hook_pre widgets

Changelog:
+ v1.0 -- Original release (17.10.2009)
]]

require 'cairo'

--[[ RING WIDGET ]]
--[[ Options (name, arg, max, bg_colour, bg_alpha, xc, yc, radius, thickness, start_angle, end_angle):
"name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
"arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
"max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
"bg_colour" is the colour of the base ring.
"bg_alpha" is the alpha value of the base ring.
"fg_colour" is the colour of the indicator part of the ring.
"fg_alpha" is the alpha value of the indicator part of the ring.
"x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
"radius" is the radius of the ring.
"thickness" is the thickness of the ring, centred around the radius.
"start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
"end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger (e.g. more clockwise) than start_angle. ]]

function ring(cr, name, arg, max, bgc, bga, fgc, fga, xc, yc, r, t, sa, ea)
local function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

-- left rings filled from the bottom
-- local function draw_ring(pct)
-- local angle_0=sa*(2*math.pi/360)-math.pi/2
-- local angle_f=ea*(2*math.pi/360)-math.pi/2
-- local pct_arc=pct*(angle_f-angle_0)

-- Draw background ring

-- cairo_arc(cr,xc,yc,r,angle_0,angle_f)
-- cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
-- cairo_set_line_width(cr,t)
-- cairo_stroke(cr)

-- Draw indicator ring

-- cairo_arc(cr,xc,yc,r,angle_0,angle_0+pct_arc)
-- cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
-- cairo_stroke(cr)
-- end

--left rings fillem from the top
local function draw_ring(pct)
local angle_0= sa * (math.pi / 180) - math.pi/2
local angle_f= ea * (math.pi / 180) - math.pi/2
local pct_arc= pct * (angle_f - angle_0)

-- Draw background ring

cairo_arc(cr,xc,yc,r,angle_0,angle_f)
cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
cairo_set_line_width(cr,t)
cairo_stroke(cr)

-- Draw indicator ring

if sa == 0 then
cairo_arc(cr,xc,yc,r,angle_0,angle_0+pct_arc)
else
cairo_arc_negative(cr,xc,yc,r,angle_0-math.pi,angle_0-math.pi-pct_arc)
end
cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
cairo_stroke(cr)
end

local function setup_ring()
local str = ''
local value = 0

str = string.format('${%s %s}', name, arg)
str = conky_parse(str)
if name == "wireless_bitrate" then
value = tonumber(string.sub(str,0,-6))
else
value = tonumber(str)
end -- if name == "wireless_bitrate"

if value == nil then value = 0 end
pct = value/max

draw_ring(pct)
end

local updates=conky_parse('${updates}')
update_num=tonumber(updates)

if update_num>5 then setup_ring() end
end

--[[ END RING WIDGET ]]

function conky_widgets()
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)

-- cr = cairo_create(cs)
-- air_clock(cr, 120, 120, 200) -- options: xc, yc, size
-- cairo_destroy(cr)

cr = cairo_create(cs)
ring(cr, 'cpu', 'CPU0', 100, 0xFFFFFF, 0.2, 0xFFFFFF, 0.5, 220, 100, 50, 10, 0, 180) -- options: name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, xc, yc, radius, thickness, start_angle, end_angle
cairo_destroy(cr)

cr = cairo_create(cs)
ring(cr, 'memperc', '', 100, 0xFFFFFF, 0.2, 0xFFFFFF, 0.5, 220, 200, 50, 10, 180, 360) -- options: name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, xc, yc, radius, thickness, start_angle, end_angle
cairo_destroy(cr)

cr = cairo_create(cs)
ring(cr, 'fs_used_perc', '/', 100, 0xFFFFFF, 0.2, 0xFFFFFF, 0.5, 220, 300, 50, 10, 0, 180) -- options: name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, xc, yc, radius, thickness, start_angle, end_angle
cairo_destroy(cr)

cr = cairo_create(cs)
ring(cr, 'battery_percent', 'BAT1', 100, 0xFFFFFF, 0.2, 0xFFFFFF, 0.5, 220, 400, 50, 10, 180, 360) -- options: name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, xc, yc, radius, thickness, start_angle, end_angle
cairo_destroy(cr)

cr = cairo_create(cs)
ring(cr, 'acpitemp', '', 100, 0xFFFFFF, 0.2, 0xFFFFFF, 0.5, 220, 500, 50, 10, 0, 180) -- options: name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, xc, yc, radius, thickness, start_angle, end_angle
cairo_destroy(cr)

cr = cairo_create(cs)
ring(cr, 'wireless_link_qual_perc', 'wlan0', 100, 0xFFFFFF, 0.2, 0xFFFFFF, 0.5, 220, 600, 50, 10, 180, 360) -- options: name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, xc, yc, radius, thickness, start_angle, end_angle
cairo_destroy(cr)
end


AirRings:

Spoiler: show
#Screenshot: http://irenegr.wordpress.com/2012/12/18 ... onk-woman/
# -- Conky settings -- #
background no
update_interval 1

cpu_avg_samples 2
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048
imlib_cache_size 0

# -- Window specifications -- #

own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

border_inner_margin 0
border_outer_margin 0

minimum_size 300 750
maximum_width 300

alignment tr
gap_x 5
gap_y 60

# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# -- Text settings -- #
use_xft yes
xftfont Sans:size=12
xftalpha 0.7

uppercase no

default_color gray75

# -- Lua Load -- #
lua_load ~/.conky/air_clock/conky_widgets.lua
lua_draw_hook_pre widgets

TEXT

${goto 180}${voffset 70}CPU ${cpu}%
${alignr 30}${voffset 80}MEM ${memperc}%
${goto 180}${voffset 80}HDD ${fs_used_perc /}%
${alignr 30}${voffset 80}BAT ${battery_percent BAT1}%
${goto 180}${voffset 80}TMP ${acpitemp}°C
${alignr 30}${voffset 80}SGN ${wireless_link_qual_perc wlan0}%


Clock:

Spoiler: show
background yes
update_interval 1

cpu_avg_samples 2
net_avg_samples 2
temperature_unit celsius

double_buffer yes
no_buffers yes
text_buffer_size 2048

gap_x 60 #left-right
gap_y 50
minimum_size 750 200
maximum_width 850
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
alignment tl

draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

override_utf8_locale yes
use_xft yes
xftfont Santana:size=8
xftalpha 0.8
uppercase no



lua_load ~/.conky/air_clock/clock.lua
lua_draw_hook_pre draw_clock

##############################################
# Output
##############################################
default_color grey75
TEXT


${goto 230}${voffset 32}${font Santana:size=28}${time %A, %d %B %Y}
${goto 230}${voffset -20}${hr 2}


Exaile:

Spoiler: show
alignment top_left
background no
#border_margin 5
border_width 5
default_color d7d7d7
double_buffer yes
draw_borders no
draw_graph_borders no
draw_outline no
draw_shades no
gap_x 300
gap_y 160
maximum_width 1100
minimum_size 40
no_buffers yes
override_utf8_locale yes
own_window yes
own_window_title normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_type normal ## normal /override /desktop
text_buffer_size 8000
total_run_times 0
update_interval 1
uppercase no
use_xft yes
xftalpha 0.9
xftfont Santana:size=12
default_color grey90

TEXT
${execi 10 exaile --get-title} - ${execi 10 exaile --get-artist} / ${execi 10 exaile --get-album}


Φροντίζουμε όπου υπάρχουν διαδρομές αρχείων να ανταποκρίνονται στις διαδρομές που τα έχουμε αποθηκεύσει. Για να τα ξεκινήσουμε όλα μαζί φτιάχνουμε ένα script όπως το παρακάτω και το βάζουμε στις start up εφαρμογές:

Spoiler: show
sleep 1 &&
conky -d -c /home/fog/.conky/air_clock/AirRings &
sleep 1 &&
conky -d -c /home/fog/.conky/air_clock/Clock &
sleep 2 &&
conky -d -c /home/fog/.conky/air_clock/Exaile &
Γνώσεις Linux: ✔✔✔✓✓ ┃ Προγραμματισμού: ✓✓✓✓✓ ┃ Αγγλικών: ✔✔✔✓✓
Ubuntu 16.04 64bit ‖ Lubuntu 16.10 64bit || 4.4.0-34-generic
Intel Core i7-6700HQ CPU @ 3.50GHzRAM 12GB ‖Toshiba Satellite P50-C
Intel Skylake Integrated Graphics ⋮ nVidia GM107M [GeForce GTX 950M]
enp4s0: Realtek RTL8111 Gigabit Ethernet Controller⋮ wlp3s0: Intel Wireless 3165
blog || github
Άβαταρ μέλους
fog
Συντονιστής
Συντονιστής
 
Δημοσιεύσεις: 655
Εγγραφή: 31 Μαρ 2015, 13:33
Τοποθεσία: /home/fog
Εκτύπωση

Re: conky (postαρετε τα conkyrc σας)

Δημοσίευσηαπό matthew » 19 Απρ 2015, 01:14

Learner έγραψε:θέλω την επιφάνεια εργασίας όσο πιο "καθαρή" γίνεται. Αν γίνεται, να μην έχει απολύτως τίποτα επάνω. Ούτε εικονίδια, ούτε conky. Το μόνο που με ενδιαφέρει να βλέπω σε real time είναι οι θερμοκρασίες του συστήματος.

:thumbup: & εγώ το ίδιο, γι' αυτό & δεν ασχολήθηκα με το conky. Για να βλέπω συνέχεια τις θερμοκρασίες στο πάνω πάνελ στη 14.04 εγκατέστησα το Psensor από εδώ http://www.webupd8.org/2014/06/psensor- ... splay.html 8-)
Γνώσεις Linux: Βασικές ┃ Προγραμματισμός: Όχι ┃ Αγγλικά: Καλά
Ubuntu Mate 20.04 64-bit σε Fujitsu Amilo Xi3670 & HP Compaq 6910p
Άβαταρ μέλους
matthew
saintTUX
saintTUX
 
Δημοσιεύσεις: 1319
Εγγραφή: 25 Αύγ 2008, 01:35
Εκτύπωση

Re: conky (postαρετε τα conkyrc σας)

Δημοσίευσηαπό fog » 19 Απρ 2015, 07:06

matthew έγραψε:...Για να βλέπω συνέχεια τις θερμοκρασίες στο πάνω πάνελ στη 14.04 εγκατέστησα το Psensor από εδώ http://www.webupd8.org/2014/06/psensor- ... splay.html 8-)

Tο psensor (το χρησιμοποιούσα παλιότερα) υπάρχει και στο universe repository, στην κατηγορία utilities.
Το κατάργησα όταν πέρασα τη φάση του ...μινιμαλισμού και προτιμούσα να έχω καμμιά 10αριά ενδείξεις στο 1% του load στον επεξεργαστή και στην κατανάλωση μνήμης, μέσω conky, από ότι θα είχα με ένα μόνο indicator για κάποια από αυτές στο panel.
Αυτό είναι ένα από τα πράγματα που μου αρέσουν στο linux. Μπορείς να κάνει ΟΤΙ θέλεις και να βρεις λύση σε ΟΤΙ δίνεις προτεραιότητα κάθε φορά, με μόνο περιορισμό τις γνώσεις σου. ;)
Γνώσεις Linux: ✔✔✔✓✓ ┃ Προγραμματισμού: ✓✓✓✓✓ ┃ Αγγλικών: ✔✔✔✓✓
Ubuntu 16.04 64bit ‖ Lubuntu 16.10 64bit || 4.4.0-34-generic
Intel Core i7-6700HQ CPU @ 3.50GHzRAM 12GB ‖Toshiba Satellite P50-C
Intel Skylake Integrated Graphics ⋮ nVidia GM107M [GeForce GTX 950M]
enp4s0: Realtek RTL8111 Gigabit Ethernet Controller⋮ wlp3s0: Intel Wireless 3165
blog || github
Άβαταρ μέλους
fog
Συντονιστής
Συντονιστής
 
Δημοσιεύσεις: 655
Εγγραφή: 31 Μαρ 2015, 13:33
Τοποθεσία: /home/fog
Εκτύπωση

Re: conky (postαρετε τα conkyrc σας)

Δημοσίευσηαπό fog » 08 Μάιος 2015, 21:37

Ένα "θεματικό" conky για όσους τους αρέσει το Game of Thrones. Το βρήκα εδώ (έχει το conkyrc, τη γραμματοσειρά και το wallpaper) και απλά το άλλαξα λίγο να έχει επιπλέον ενδείξεις για θερμοκρασία, email, layout και μουσική:

Γνώσεις Linux: ✔✔✔✓✓ ┃ Προγραμματισμού: ✓✓✓✓✓ ┃ Αγγλικών: ✔✔✔✓✓
Ubuntu 16.04 64bit ‖ Lubuntu 16.10 64bit || 4.4.0-34-generic
Intel Core i7-6700HQ CPU @ 3.50GHzRAM 12GB ‖Toshiba Satellite P50-C
Intel Skylake Integrated Graphics ⋮ nVidia GM107M [GeForce GTX 950M]
enp4s0: Realtek RTL8111 Gigabit Ethernet Controller⋮ wlp3s0: Intel Wireless 3165
blog || github
Άβαταρ μέλους
fog
Συντονιστής
Συντονιστής
 
Δημοσιεύσεις: 655
Εγγραφή: 31 Μαρ 2015, 13:33
Τοποθεσία: /home/fog
Εκτύπωση

Re: conky (postαρετε τα conkyrc σας)

Δημοσίευσηαπό fog » 02 Ιουν 2015, 21:50

Ένα conky clock που πέτυχα σήμερα και μου φάνηκε ενδιαφέρον (στα συν ότι χρειάστηκε να βρω και πως κάνω gif από την επιφάνεια εργασίας μου).

Θέλει αλλαγή η διαδρομή που θα λέει που είναι το δικό σας lua αρχείο και να υπάρχει τουλάχιστον μια γραμμή κενή κάτω από το TEXT πριν το σώσετε, μιας και εδώ την κόβει στο τέλος.

.conkyrc:

Spoiler: show
# -- Conky settings -- #
background no
update_interval 1

cpu_avg_samples 2
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes
short_units yes

text_buffer_size 2048
imlib_cache_size 0

use_xft yes
xftfont monospace:pixelsize=25
xftalpha .8

own_window_type window
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_colour ddeeee
default_color 000000
border_inner_margin 0
border_outer_margin 0

minimum_size 600 500
alignment tr
gap_x 50
gap_y 50

# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no


# -- Lua load -- #
lua_load /home/fog/.conky/click_clock.lua
lua_draw_hook_pre main

#at least one line (empty or not) after TEXT
TEXT


click_clock.lua:

Spoiler: show
--[[ Clock for conky
written by easysid
Thu 09 May 2013 19:20:16 IST
modified for Sector11
Mon 03 Jun 2013 22:26:55 IST

]]--

require 'cairo'

function conky_main()

clock_table = {
{
-- Draw the seconds
arg = "time %S",
xc = 300,
yc = 200,
r = 150, -- radius
divs = 60, --divisions or max value. default is 60.
font_face = "monofur",
top_font_size = 24, -- font size for display
min_font_size = 8, -- min font for trail
max_font_size = 18, -- max font fot trail
max_alpha = .6, -- max alpha for trail
trail = 40, -- size of trail. Must be less than divs
main_color = {0x33444B, 1}, --color of numbers
trail_color = {0x33444B, 1} --color of trail.
},

{
-- Draw the Minutes
arg = "time %M",
xc = 300,
yc = 200,
r = 100, -- radius
font_face = "monofur",
top_font_size = 26, -- font size for display
min_font_size = 8, -- min font for trail
max_font_size = 16, -- max font fot trail
max_alpha = .6, -- max alpha for trail
trail = 40, -- size of trail
main_color = {0x33444B, 1}, --color of numbers
trail_color = {0x33444B, 1} --color of trail
},

{
-- Draw the Hours
arg = "time %H",
xc = 300,
yc = 200,
r = 60,
divs = 12, -- divisions. default is 60
font_face = "monofur",
top_font_size = 30, -- font size for display
min_font_size = 10, -- min font for trail
max_font_size = 20, -- max font fot trail
max_alpha = .6, -- max alpha for trail
trail = 12, -- size of trail
main_color = {0x33444B, 1}, --color of numbers
trail_color = {0x33444B, 1} --color of trail
},
}
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)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>3 then
for i in ipairs(clock_table) do
draw_clock(cr, clock_table[i])
end
end
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function


function draw_clock(cr, t)

local divs = t.divs or 60
local value = tonumber(conky_parse(string.format("${%s}",t.arg)))
local first = value - t.trail
for i = first, value do
local theta = i*2*math.pi/divs -math.pi/2 -- calculate the angle
t.trail_color[2] = t.max_alpha*(i-first)/(value-first) -- map alpha value to [0, max_alpha]
local font_size = (t.max_font_size-t.min_font_size)*(i-first)/(value-first) + t.min_font_size -- map font size similar to alpha
if i == value then -- if we have the main value
out({x = t.xc + t.r*math.cos(theta), y = t.yc + t.r*math.sin(theta),
font=t.font_face, fs=t.top_font_size, text=value, color=t.main_color})
else
local k = i
if k < 0 then k = divs + i end -- adjust negatives
out({x = t.xc + t.r*math.cos(theta), y = t.yc + t.r*math.sin(theta),
font=t.font_face, fs=font_size, text=k, color=t.trail_color})
end --if
end -- end for

end -- end draw_clock

function out(t)
--[[ function to put the text
arguments:
x,y - position of the text (bottom-left) -mandatory
text - text to display

optional arguments:
font - font face
fs - font size
color - color in {hexvalue, alpha} pair
bold - boolean. default false. Bold text
italic - boolean. default false
centred - boolean. default false. Centre the text at x,y instead of starting from it.
]]--

-- checks
t.font = t.font or 'monospace'
t.fs = t.fs or 14
t.color = t.color or {0x33444B,1}
t.text = t.text or 'text'
t.centred = t.centred or false
t.bold = t.bold and CAIRO_FONT_WEIGHT_BOLD or CAIRO_FONT_WEIGHT_NORMAL
t.italic = t.italic and CAIRO_FONT_SLANT_ITALIC or CAIRO_FONT_SLANT_NORMAL

if t.centred then
local ext = cairo_text_extents_t:create()
cairo_text_extents(cr,t.text,ext)
t.x = t.x - ext.width/2
t.y = t.y + ext.height/4
end
--setup
cairo_set_source_rgba (cr, rgba_to_r_g_b_a(t.color))
cairo_select_font_face (cr, t.font, t.italic, t.bold)
cairo_set_font_size (cr, t.fs)
--print
cairo_move_to(cr,t.x,t.y)
cairo_show_text(cr,t.text)

end -- end out

function rgba_to_r_g_b_a(tcolor)
local color,alpha=tcolor[1],tcolor[2]
return ((color / 0x10000) % 0x100) / 255.,
((color / 0x100) % 0x100) / 255., (color % 0x100) / 255., alpha
end --end rgba



Εικόνα
Γνώσεις Linux: ✔✔✔✓✓ ┃ Προγραμματισμού: ✓✓✓✓✓ ┃ Αγγλικών: ✔✔✔✓✓
Ubuntu 16.04 64bit ‖ Lubuntu 16.10 64bit || 4.4.0-34-generic
Intel Core i7-6700HQ CPU @ 3.50GHzRAM 12GB ‖Toshiba Satellite P50-C
Intel Skylake Integrated Graphics ⋮ nVidia GM107M [GeForce GTX 950M]
enp4s0: Realtek RTL8111 Gigabit Ethernet Controller⋮ wlp3s0: Intel Wireless 3165
blog || github
Άβαταρ μέλους
fog
Συντονιστής
Συντονιστής
 
Δημοσιεύσεις: 655
Εγγραφή: 31 Μαρ 2015, 13:33
Τοποθεσία: /home/fog
Εκτύπωση

ΠροηγούμενηΕπόμενο

Επιστροφή στο Put the FUN back

cron