Skip to content

Instantly share code, notes, and snippets.

@nbicocchi
Last active June 26, 2024 17:35
Show Gist options
  • Save nbicocchi/6a356e87a1543abb15e6855edf7c9826 to your computer and use it in GitHub Desktop.
Save nbicocchi/6a356e87a1543abb15e6855edf7c9826 to your computer and use it in GitHub Desktop.
Conky Configuration
--[[
#=====================================================================================
# Date : package-date
# Author : Nicola Bicocchi
# Version : package-version
# License : Distributed under the terms of GNU GPL version 2 or later
#======================================================================================
# CONKY
# For commands in conky.config section:
# http://conky.sourceforge.net/config_settings.html
#
# For commands in conky.text section:
# http://conky.sourceforge.net/variables.html
#
# A PDF with all variables is provided
#=====================================================================================
# FONTS
# To avoid copyright infringements you will have to download
# and install the fonts yourself sometimes.
#=====================================================================================
# GENERAL INFO ABOUT FONTS
# Go and look for a nice font on sites like http://www.dafont.com/
# Download and unzip - double click the font to install it (font-manager must be installed)
# No font-manager then put fonts in ~/.fonts
# Change the font name in the conky
# The name can be known with a command in the terminal: fc-list | grep "part of name"
# Change width and height of the conky according to font
# Reboot your system or fc-cache -fv in terminal
# Enjoy
#=====================================================================================
]]
conky.config = {
--Various settings
background = true, -- forked to background
cpu_avg_samples = 2, -- The number of samples to average for CPU monitoring.
diskio_avg_samples = 10, -- The number of samples to average for disk I/O monitoring.
double_buffer = true, -- Use the Xdbe extension? (eliminates flicker)
if_up_strictness = 'address', -- how strict if testing interface is up - up, link or address
net_avg_samples = 2, -- The number of samples to average for net data
no_buffers = true, -- Subtract (file system) buffers from used memory?
temperature_unit = 'celsius', -- fahrenheit or celsius
text_buffer_size = 2048, -- size of buffer for display of content of large variables - default 256
update_interval = 2, -- update interval
imlib_cache_size = 0, -- disable image cache to get a new spotify cover per song
--Placement
alignment = 'top_right', -- top_left,top_middle,top_right,bottom_left,bottom_middle,bottom_right,
-- middle_left,middle_middle,middle_right,none
--Arch Duoscreen
--gap_x = -1910,
gap_x = 15, -- pixels between right or left border
gap_y = 0, -- pixels between bottom or left border
minimum_height = 1000, -- minimum height of window
minimum_width = 500, -- minimum width of window
maximum_width = 600, -- maximum width of window
--Graphical
border_inner_margin = 10, -- margin between border and text
border_outer_margin = 10, -- margin between border and edge of window
border_width = 0, -- border width in pixels
default_bar_width = 0, -- default is 0 - full width
default_bar_height = 25, -- default is 6
default_gauge_height = 25, -- default is 25
default_gauge_width = 0, -- default is 40
default_graph_height = 80, -- default is 25
default_graph_width = 0, -- default is 0 - full width
default_shade_color = '#000000', -- default shading colour
default_outline_color = '#000000', -- default outline colour
draw_borders = false, -- draw borders around text
draw_graph_borders = true, -- draw borders around graphs
draw_shades = false, -- draw shades
draw_outline = false, -- draw outline
stippled_borders = 0, -- dashing the border
--Textual
extra_newline = false, -- extra newline at the end - for asesome's wiboxes
format_human_readable = true, -- KiB, MiB rather then number of bytes
font = 'Roboto Mono:size=15', -- font for complete conky unless in code defined
max_text_width = 0, -- 0 will make sure line does not get broken if width too smal
max_user_text = 16384, -- max text in conky default 16384
override_utf8_locale = true, -- force UTF8 requires xft
short_units = true, -- shorten units from KiB to k
top_name_width = 21, -- width for $top name value default 15
top_name_verbose = false, -- If true, top name shows the full command line of each process - Default value is false.
uppercase = false, -- uppercase or not
use_spacer = 'none', -- adds spaces around certain objects to align - default none
use_xft = true, -- xft font - anti-aliased font
xftalpha = 1, -- alpha of the xft font - between 0-1
--Windows
own_window = true, -- create your own window to draw
own_window_argb_value = 100, -- real transparency - composite manager required 0-255
own_window_argb_visual = true, -- use ARGB - composite manager required
own_window_colour = '#000000', -- set colour if own_window_transparent no
own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager', -- if own_window true - just hints - own_window_type sets it
own_window_transparent = false, -- if own_window_argb_visual is true sets background opacity 0%
own_window_title = 'system_conky', -- set the name manually - default conky "hostname"
own_window_type = 'normal', -- if own_window true options are: normal/override/dock/desktop/panel
--Colours
default_color = '#D9FFE2',
color1 = '#FF0000',
color2 = '#3E5570',
color3 = '#CCCCCC',
color4 = '#BBBBBB',
color5 = '#C0FF00',
color6 = '#FFFFFF',
--Signal Colours
color7 = '#C0FF00', --green
color8 = '#FFA726', --orange
color9 = '#F1544B', --firebrick
};
conky.text = [[
${color6}${font Roboto:size=140}${alignc}${time %H}:${time %M}${font}
${color6}${font Roboto:size=25}${alignc}${time %A} ${time %B} ${time %e}, ${time %Y}${font}
${color5}${font Roboto:style=Bold:size=17}S Y S T E M ${hr 2}${font}
${color6}Hostname:${color}${alignr}${nodename}
${color6}OS:${color}${alignr}${texeci 3600 lsb_release -d | awk '{$1=""; print $0}'}
${color6}Kernel:${color}${alignr}${kernel}
${color6}Uptime:${color}${alignr}${uptime}
${color6}Processes:${color}${alignr}${processes}
${color5}${font Roboto:style=Bold:size=17}C P U ${hr 2}${font}
${color6}CPU Frequency:${color}${alignr}${freq}MHz
${color6}CPU Temperature:${color}${alignr}${texeci 30 sensors | grep "Package id 0" | cut -d ':' -f 2 | cut -d '(' -f 1 | tr -d ' '}
${color6}CPU Usage:${color}${alignr}${cpu}%
${cpugraph cpu0}
${color6}Top Processes ${alignr}${offset -40}PID ${alignr}${offset -20}CPU% ${alignr}Mem%
${color}${top name 1} ${alignr}${offset -75}${top pid 1}${alignr}${offset -45}${top cpu 1}${alignr}${top mem 1}
${color}${top name 2} ${alignr}${offset -75}${top pid 2}${alignr}${offset -45}${top cpu 2}${alignr}${top mem 2}
${color}${top name 3} ${alignr}${offset -75}${top pid 3}${alignr}${offset -45}${top cpu 3}${alignr}${top mem 3}
${color5}${font Roboto:style=Bold:size=17}M E M O R Y ${hr 2}${font}
${color6}Swap Usage:${color}${alignr}${swap}/${swapmax}
${color6}Memory Usage:${color}${alignr}${mem}/${memmax}
${memgraph}
${color6}Top Processes ${alignr}${offset -40}PID ${alignr}${offset -20}CPU% ${alignr}Mem%
${color}${top_mem name 1} ${alignr}${offset -75}${top_mem pid 1}${alignr}${offset -45}${top_mem cpu 1}${alignr}${top_mem mem 1}
${color}${top_mem name 2} ${alignr}${offset -75}${top_mem pid 2}${alignr}${offset -45}${top_mem cpu 2}${alignr}${top_mem mem 2}
${color}${top_mem name 3} ${alignr}${offset -75}${top_mem pid 3}${alignr}${offset -45}${top_mem cpu 3}${alignr}${top_mem mem 3}
${color5}${font Roboto:style=Bold:size=17}D I S K ${hr 2}${font}
${color6}Disk Usage:${color}${alignr}${fs_used /}/${fs_size /}
${color6}IO Read / Write:${color}${alignr}${diskio_read /dev/nvme0n1p2} / ${diskio_write /dev/nvme0n1p2}
${diskiograph_read nvme0n1p2}
${diskiograph_write nvme0n1p2}
${color6}Top Processes ${alignr}${offset -40}PID ${alignr}${offset -20}CPU% ${alignr}Mem%
${color}${top_io name 1} ${alignr}${offset -75}${top_io pid 1}${alignr}${offset -45}${top_io cpu 1}${alignr}${top_io mem 1}
${color}${top_io name 2} ${alignr}${offset -75}${top_io pid 2}${alignr}${offset -45}${top_io cpu 2}${alignr}${top_io mem 2}
${color}${top_io name 3} ${alignr}${offset -75}${top_io pid 3}${alignr}${offset -45}${top_io cpu 3}${alignr}${top_io mem 3}
${color5}${font Roboto:style=Bold:size=17}N E T W O R K ${hr 2}${font}
${color6}Default Gateway:${color}${alignr}${gw_ip}
${color6}Internal IP Address:${color}${alignr}${addrs enp6s0}
${color6}External IP Address:${color}${alignr}${texeci 3600 wget -q -O- https://ipecho.net/plain}
${color6}Upload / Download Total:${color}${alignr}${totalup enp6s0} / ${totaldown enp6s0}
${color6}Upload / Download Speed:${color}${alignr}${upspeed enp6s0} / ${downspeed enp6s0}
${upspeedgraph enp6s0}
${downspeedgraph enp6s0}
]];
#!/bin/sh
# vim: ft=sh:ts=4:sw=4:et:ai:cin
conky_bin="conky"
config_file=$(dirname $0)/"conky.conf"
magic_id=$(md5sum "$config_file" | cut -c -12)
toggle_mode="N"
usage() {
echo "USAGE: $(basename $0) [-t] [-p]"
}
start_conky() {
"$conky_bin" --daemonize --quiet --config="$config_file" -- "$magic_id"
return $?
}
stop_conky() {
pkill --signal kill --full "conky.*\s-- $magic_id"
return $?
}
toggle_conky() {
if stop_conky; then
true
else
start_conky
fi
}
restart_conky() {
stop_conky
sleep 1
start_conky
}
while getopts "tp:h" opt; do
case $opt in
t) # toggle mode on
toggle_mode="Y"
;;
p) # path to conky binary
conky_bin=$(realpath -- "$OPTARG")
if [ -x "$conky_bin" ]; then
echo "Conky binary path: ${conky_bin}"
else
echo "ERROR: ${conky_bin} is not executable, path to Conky binary needed\n" >&2
usage
exit 1
fi
;;
h) # help
usage
exit 1
;;
\?)
usage
exit 1
;;
esac
done
shift "$((OPTIND - 1))"
if [ "$toggle_mode" == "Y" ]; then
toggle_conky
else
restart_conky
fi
exit 0
@wretchdub
Copy link

Nice Job man!, Gonna steal and build from here! you may want to obscure the external IP on the pictures though...

@nbicocchi
Copy link
Author

I already changed ISP :) Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment