Module widget
A collection of Widget classes
-
temperature_color(temperature, low, high)
-
Generate a temperature based color.
Colors are chosen based on float offset in a pre-defined color gradient.
Parameters:
- temperature
number
current temperature (or any other type of numeric value)
- low
number
threshold for lowest temperature / coolest color
- high
number
threshold for highest temperature / hottest color
-
default_text_color
-
Text color used by widgets if no other is specified.
Fields:
- default_text_color
{number,number,number,number}
-
default_graph_color
-
Color used to draw some widgets if no other is specified.
Fields:
- default_graph_color
{number,number,number,number}
-
default_font_family
-
Font used by widgets if no other is specified.
- default_font_family
string
-
default_font_size
-
Font size used by widgets if no other is specified.
Root widget wrapper
Takes care of managing layout reflows and background caching.
-
Renderer:init(args)
-
Parameters:
- args table of options
- root
Widget
The Widget subclass that should be rendered,
usually a Rows widget
- width
int
Width of the surface that should be covered
- height
int
Height of the surface that should be covered
-
Renderer:layout()
-
Layout all Widgets and cache their backgrounds.
Call this once to create the initial layout.
Will be called again automatically each time the layout changes.
-
Renderer:update(update_count)
-
Update all Widgets
Parameters:
- update_count
int
Conky's $updates
-
Renderer:render(cr)
-
Render to the given context
Parameters:
Base Widget class.
-
Widget.width
-
Set a width if the Widget should have a fixed width.
Omit (=nil) if width should be adjusted dynamically.
-
Widget.height
-
Set a height if the Widget should have a fixed height.
Omit (=nil) if height should be adjusted dynamically.
-
Widget:layout(width, height)
-
Called at least once to inform the widget of the width and height
it may occupy.
Parameters:
-
Widget:render_background(cr)
-
Called at least once to allow the widget to draw static content.
Parameters:
- cr
cairo_t
Cairo context for background rendering
(to be cached by the Renderer)
-
Widget:update(update_count)
-
Called before each call to Widget:render.
If this function returns a true-ish value, a reflow will be triggered.
Since this involves calls to all widgets' :layout functions,
reflows should be used sparingly.
Parameters:
- update_count
int
Conky's $updates
Returns:
optional bool
true(-ish) if a layout reflow should be triggered, causing
all Widget:layout and Widget:render_background methods
to be called again
-
Widget:render(cr)
-
Called once per update to do draw dynamic content.
Parameters:
Basic collection of widgets.
Rows are drawn in a vertical stack starting at the top of the drawble
surface.
-
Rows:init(widgets)
-
Parameters:
Display Widgets side by side
-
Columns:init(widgets)
-
Parameters:
Leave space between widgets.
If either height or width is not specified, the available space
inside a Rows or Columns widget will be distributed evenly between Fillers
with no fixed height/width.
A Filler may contain one other Widget which will have its dimensions
restricted to those of the Filler.
-
Filler:init(args)
-
Parameters:
- args table of options
- width
optional int
- height
optional int
- widget
optional Widget
Draw a static border and/or background around/behind another widget.
-
Frame:init(widget, args)
-
Parameters:
- widget
Widget
Widget to be wrapped
- args table of options
- padding
number or {number,...}
Leave some space around the inside
of the frame.
- number: same padding all around.
- table of two numbers: {top & bottom, left & right}
- table of three numbers: {top, left & right, bottom}
- table of four numbers: {top, right, bottom, left}
- margin
number or {number,...}
Like padding but outside the border.
- background_color
optional {number,number,number,number}
- border_color
optional {number,number,number,number}
(default transparent)
- border_width
optional number
border line width
(default 0)
- border_sides
optional {string,...}
any combination of
"top", "right", "bottom" and/or "left"
(default: all sides)
-
Text:init(args)
-
Parameters:
- args table of options
- align
optional string
"left" (default), "center" or "right"
- font_family
optional string
(default w.default_font_family)
- font_size
optional number
(default w.default_font_size)
- font_slant
optional cairo_font_slant_t
(default CAIRO_FONT_WEIGHT_NORMAL)
- font_weight
optional cairo_font_weight_t
(default CAIRO_FONT_SLANT_NORMAL)
- color
optional {number,number,number,number}
(default: default_text_color)
Draw some unchangeable text.
Use this widget for text that will never be updated.
-
StaticText:init(text, args)
-
Parameters:
- text
string
Text to be displayed.
- args
optional table
table of options, see Text:init
Draw a single line of changeable text.
Text line can be updated on each cycle via
set_text.
-
TextLine:init(args)
-
Parameters:
-
TextLine:set_text(text)
-
Update the text line to be displayed.
Parameters:
Progress-bar like box, similar to conky's bar.
Can have small and big ticks for visual clarity,
and a unit (static, up to 3 characters) written behind the end.
-
Bar:init(args)
-
Parameters:
- args table of options
- thickness
int
vertical size of the bar
(default 6)
- unit
optional string
to be drawn behind the bar - 3 characters will fit
- ticks
optional {number,...}
relative offsets (between 0 and 1) of ticks
- big_ticks
optional int
multiple of ticks to be drawn longer
- color
optional {number,number,number}
(default: default_graph_color)
-
Bar:set_fill(fraction)
-
Set the fill-ratio of the bar
Parameters:
- fraction
number
between 0 and 1
Specialized unit-based Bar.
-
MemoryBar:init(args)
-
Parameters:
- args table of options
- total
optional number
Total amount of memory to be represented
by this bar. If greater than 8, ticks will be
drawn. If omitted, total RAM will be used,
however no ticks can be drawn.
- unit
string
passed to Bar:init
(default "GiB")
- thickness
optional int
passed to Bar:init
- color
optional {number,number,number}
passed to Bar:init
-
MemoryBar:set_used(used)
-
Set the amount of used memory as an absolute value.
Parameters:
- used
number
should be between 0 and args.total
Track changing data; similar to conky's graphs.
-
Graph:init(args)
-
Parameters:
- args table of options
- max
number
maximum expected value to be represented;
may be expanded automatically as need arises
- data_points
int
how many values to store
(default 60)
- upside_down
bool
Draw graph from top to bottom?
(default false)
- smoothness
number
Bézier curves smoothness.
Set to 0 to draw straight lines instead,
which may be slightly faster.
(default 0.5)
- width
int
fix width in pixels
(optional)
- height
int
fixeheight in pixels
(optional)
- color
optional {number,number,number}
(default: default_graph_color)
-
Graph:add_value(value)
-
Append the latest value to be shown - this will displace the oldest value
Parameters:
- value
number
if value > args.max then the graphs vertical scale will be
adjusted, causing it to get squished
Round light indicator for minimalistic feedback.
-
LED:init(args)
-
Parameters:
- args table of options
- radius
number
size of the LED
- brightness
number
between 0 and 1, how "on" should the LED be?
Can be changed later with LED:set_brightness
(default 0)
- color
optional {number,number,number}
color of the LED,
can be changed later with LED:set_color.
(default: default_graph_color)
- background_color
optional {number,number,number,number}
mostly visible
when the LED is off. This allows you to choose
a neutral background if you plan on changing
the light color via LED:set_color.
(default: darkened
args.color
)
-
LED:set_brightness(brightness)
-
Parameters:
- brightness
number
between 0 and 1
-
LED:set_color(color)
-
Parameters:
- color
optional {number,number,number}
Polygon-style CPU usage & temperature indicator.
Looks best for CPUs with 4 to 8 cores but also works for higher numbers.
-
Cpu:init(args)
-
Parameters:
- args table of options
- cores
int
How many cores does your CPU have?
- scale
int
radius of central polygon
- gap
int
space between central polygon and outer segments
- segment_size
int
radial thickness of outer segments
Round CPU usage & temperature indicator.
Best suited for CPUs with high core counts.
-
CpuRound:init(args)
-
Parameters:
- args table of options
- cores
int
How many cores does your CPU have?
- inner_radius
int
Size of inner circle
- outer_radius
int
Max radius for core at 100%
- grid
int
Number of grid lines to draw in the background.
(optional)
Visualize cpu-frequencies in a style reminiscent of stacked progress bars.
-
CpuFrequencies:init(args)
-
Parameters:
- args table of options
- cores
int
How many cores does your CPU have?
- min_freq
number
What is your CPU's maximum frequency?
- min_freq
number
What is your CPU's maximum frequency?
- height
int
Maximum pixel height of the drawn shape
(default 16)
Visualize memory usage in a randomized grid.
Does not represent actual distribution of used memory.
Also shows buffere/cache memory at reduced brightness.
-
MemoryGrid:init(args)
-
Parameters:
- args table of options
- rows
optional int
Number of rows to draw.
For nil it will be determined based on Widget height.
- columns
optional int
Number of columns to draw.
For nil it will be determined based on Widget width.
- point_size
optional int
edge length of individual squares
(default 2)
- gap
optional int
space between squares
(default 1)
- shuffle
optional bool
randomize?
(default true)
- color
optional {number,number,number}
(default: default_graph_color)
Compound widget to display GPU and VRAM usage.
-
Gpu:init()
-
no options
Table of processes for the GPU, sorted by VRAM usage
-
GpuTop:init(args)
-
Parameters:
- args table of options
- lines
optional int
how many processes to display
(default 5)
- font_family
optional string
- font_size
optional number
- color
optional {number,number,number}
(default: default_text_color)
Graphs for up- and download speed.
This widget assumes that your conky.text adds some text between the graphs.
-
Network:init(args)
-
Parameters:
- args table of options
- interface
string
e.g. "eth0"
- graph_height
optional int
passed to Graph:init
- downspeed
number
passed as args.max to download speed graph
(default 1024)
- upspeed
number
passed as args.max to upload speed graph
(default 1024)
Visualize drive usage and temperature in a colorized Bar.
Also writes temperature as text.
This widget is exptected to be combined with some special conky.text.
-
Drive:init(path)
-
Parameters: