This is a custom Conky configuration that displays key system metrics (CPU, RAM, Battery) using a clean, modern interface with graphical rings and icons.
- Graphical Rings: CPU, RAM, and Battery levels are each represented by a circular ring that fills up based on usage.
- Font Awesome Icons: Each metric is paired with a clean, corresponding icon from Font Awesome 6.
- Dynamic Percentages: The percentage for each metric is displayed clearly beneath the rings.
- Custom Sizing: The Conky window is configured to fit tightly around the graphical elements for a compact and clean look.
- Lua & Cairo: The rings are drawn dynamically using a custom Lua script with the Cairo 2D graphics library.
This is the main Conky configuration file. It controls the window size, position, fonts, colors, and the layout of all the text and icons.
-- Conky, a system monitor https://github.com/brndnmtthws/conky
--
-- This configuration file is Lua code. You can write code in here, and it will
-- execute when Conky loads. You can use it to generate your own advanced
-- configurations.
--
-- Try this (remove the `--`):
--
-- print("Loading Conky config")
--
-- For more on Lua, see:
-- https://www.lua.org/pil/contents.html
--
-- Conky Lua API: https://conky.cc/lua
-- Configuration settings: https://conky.cc/config_settings
conky.config = {
alignment = 'top_right',
background = true,
border_width = 1,
cpu_avg_samples = 2,
default_color = 'white',
default_outline_color = 'white',
default_shade_color = 'white',
double_buffer = true,
draw_borders = false,
draw_graph_borders = true,
draw_outline = false,
draw_shades = false,
extra_newline = false,
font = '/usr/share/fonts/truetype/Font_Awesome_6_Free-Solid-900.otf:size=10',
gap_x = 7,
gap_y = 39,
minimum_height = 84,
minimum_width = 245,
maximum_width = 235,
net_avg_samples = 2,
no_buffers = true,
out_to_console = false,
out_to_ncurses = false,
out_to_stderr = false,
out_to_x = true,
own_window = true,
own_window_class = 'Conky',
own_window_type = 'desktop',
own_window_transparent = false,
own_window_argb_visual = false,
own_window_argb_value = 0,
own_window_colour = '333333',
show_graph_range = false,
show_graph_scale = false,
stippled_borders = 0,
update_interval = 1.0,
uppercase = false,
lua_load = '/home/apih/.config/conky/conky_rings.lua',
lua_draw_hook_pre = 'conky_draw_pre',
lua_draw_hook_post = 'conky_draw_post',
use_spacer = 'none',
use_xft = true,
}
-- Variables: https://conky.cc/variables
conky.text = [[
${voffset 23}${offset 27}${color grey}${font Font Awesome 6 Free:style=Solid:size=17}${font}${voffset -4}${offset 55}${color grey}${font Font Awesome 6 Free:style=Solid:size=17}${font}${voffset -9}${offset 44}${color grey}${font Font Awesome 6 Free:style=Solid:size=20} ${font}
${voffset 20}${offset 30}${color grey}${cpu cpu0}%${offset 55}${color grey}${memperc}%${offset 50}${color grey}${battery_percent}%
]]This Lua script is loaded by conky.conf and contains the logic to draw the three circular rings using the Cairo graphics library. The conky_draw_pre function is hooked into Conky's update cycle to draw the rings before any text is rendered.
require 'cairo'
require 'cairo_xlib'
-- Function to draw a ring
function draw_ring(cr, x, y, radius, line_width, bg_color, fg_color, percentage)
local angle_start = math.rad(270) -- Start from top
local angle_end_bg = math.rad(270 + 360) -- Full circle
local angle_end_fg = math.rad(270 + (percentage * 3.6)) -- Percentage arc
-- Draw background ring
cairo_set_source_rgba(cr, bg_color[1], bg_color[2], bg_color[3], bg_color[4])
cairo_set_line_width(cr, line_width)
cairo_arc(cr, x, y, radius, angle_start, angle_end_bg)
cairo_stroke(cr)
-- Draw foreground ring
cairo_set_source_rgba(cr, fg_color[1], fg_color[2], fg_color[3], fg_color[4])
cairo_set_line_width(cr, line_width)
cairo_arc(cr, x, y, radius, angle_start, angle_end_fg)
cairo_stroke(cr)
end
function conky_draw_pre()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
-- Define colors (RGBA)
local bg_color = {0.4, 0.4, 0.4, 0.6} -- Lighter grey, semi-transparent
local fg_color_cpu = {0.0, 0.6, 1.0, 0.8} -- Light blue, semi-transparent
-- CPU Ring
local cpu_perc = tonumber(conky_parse("${cpu cpu0}")) or 0
draw_ring(cr, 43, 38, 30, 5, bg_color, fg_color_cpu, cpu_perc)
-- RAM Ring
local ram_perc = tonumber(conky_parse("${memperc}")) or 0
local fg_color_ram = {1.0, 0.6, 0.0, 0.8} -- Orange for RAM
draw_ring(cr, 123, 38, 30, 5, bg_color, fg_color_ram, ram_perc)
-- Battery Ring
local bat_perc = tonumber(conky_parse("${battery_percent}")) or 0
local fg_color_bat = {0.0, 1.0, 0.0, 0.8} -- Green for Battery
draw_ring(cr, 203, 38, 30, 5, bg_color, fg_color_bat, bat_perc)
cairo_destroy(cr)
cairo_surface_destroy(cs)
end
function conky_draw_post()
end
here is the conky with beautiful circular thingy and with icon at the middle...happy ricing !