Module: wibox.widget.graph

Display multiple values as a stream of bars.

The graph goes from left to right. To change the movement's direction, use a wibox.container.mirror widget. This can also be used to have data shown from top to bottom.

To add text on top of the graph, use a wibox.layout.stack and a wibox.container.align widgets.

To display the graph vertically, use a wibox.container.rotate widget.

Usage:

    wibox.widget {
        max_value = 29,
        widget = wibox.widget.graph
    }
    

Class Hierarchy

Info:

Constructors

wibox.widget.graph {[args]} Create a graph widget.

Object properties

border_width number Set the graph border_width.
border_color color or nil Set the graph border color.
color color Set the graph foreground color.
background_color color Set the graph background color.
group_colors table Set the colors for data groups.
max_value number The maximum value the graph should handle.
min_value number The minimum value the graph should handle.
scale boolean Set the graph to automatically scale its values.
clamp_bars boolean Clamp graph bars to keep them inside the widget for out-of-range values.
baseline_value number The value corresponding to the starting point of graph bars.
step_width number Set the width or the individual steps.
step_spacing number Set the spacing between the steps.
step_shape shape The step shape.
stack boolean Set the graph to draw stacks.
nan_indication boolean Display NaN indication.
nan_color color The color of NaN indication.
capacity integer or nil Set the graph capacity.
children table Get or set the children elements. Inherited from wibox.widget.base
all_children table Get all direct and indirect children widgets. Inherited from wibox.widget.base
forced_height number or nil Force a widget height. Inherited from wibox.widget.base
forced_width number or nil Force a widget width. Inherited from wibox.widget.base
opacity number The widget opacity (transparency). Inherited from wibox.widget.base
visible boolean The widget visibility. Inherited from wibox.widget.base
buttons table The widget buttons. Inherited from wibox.widget.base

Deprecated object properties

height number Set the graph height. Deprecated
width number Set the graph width. Deprecated
stack_colors table Set the colors for data groups. Deprecated

Object methods

:pick_data_group_color (group_idx) -> color Determine the color to paint a data group with.
:compute_drawn_values_num (usable_width) -> number Determine how many values should be drawn for a given widget width.
:add_value (value, group) Add a value to the graph.
:clear () Clear the graph.
:add_button (button) Add a new awful.button to this widget. Inherited from wibox.widget.base
:emit_signal_recursive (signal_name, ...) Emit a signal and ensure all parent widgets in the hierarchies also forward the signal. Inherited from wibox.widget.base
:index (widget, recursive, ...) -> (number, widget, table) Get the index of a widget. Inherited from wibox.widget.base
:connect_signal (name, func) Connect to a signal. Inherited from gears.object
:weak_connect_signal (name, func) Connect to a signal weakly. Inherited from gears.object
:disconnect_signal (name, func) Disconnect from a signal. Inherited from gears.object
:emit_signal (name, ...) Emit a signal. Inherited from gears.object

Theme variables

beautiful.graph_fg color The graph foreground color Used, when the color property isn't set.
beautiful.graph_bg color The graph background color.
beautiful.graph_border_color color The graph border color.

Signals

widget::layout_changed When the layout (size) change. Inherited from wibox.widget.base
widget::redraw_needed When the widget content changed. Inherited from wibox.widget.base
button::press When a mouse button is pressed over the widget. Inherited from wibox.widget.base
button::release When a mouse button is released over the widget. Inherited from wibox.widget.base
mouse::enter When the mouse enter a widget. Inherited from wibox.widget.base
mouse::leave When the mouse leave a widget. Inherited from wibox.widget.base


Constructors

🔗 wibox.widget.graph {[args]}
Create a graph widget.

Parameters:

Name Type(s) Description
args table Standard widget() arguments.

Returns:

    wibox.widget.graph A new graph widget.

Object properties

🔗 border_width number · 1 signal
Set the graph border_width.

Constraints:

Default value : 0
Unit : pixel
Negative allowed : false

See also:

border_color Set the graph border color. object properties

Usage:

    for _, width in ipairs { 1, 2, 4, 10 } do
        wibox.widget {
            border_width  = width,
            border_color  = beautiful.border_color,
            widget        = wibox.widget.graph,
        }
     end

Click to display more

Emit signals:

  • property::border_width When the border_width value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value border_width The new value affected to the property.
🔗 border_color color or nil · 1 signal · 1 theme variable
Set the graph border color.

Constraints:

Default value : beautiful.wibox_widget_graph_border_color
Type description:
string : An hexadecimal color code, such as "#ff0000" for red.
string : A color name, such as "red".
table : A gradient table.
cairo.pattern : Any valid Cairo pattern.
cairo.pattern : A texture build from an image by gears.color.create_png_pattern
nil : Fallback to the current value of beautiful.graph_border_color.
Valid values : The border color to set.

See also:

gears.color This module simplifies the creation of cairo pattern objects. module

Usage:

    for _, color in ipairs {"#ff0000", "#00ff00", "#0000ff", "#ff00ff" } do
        wibox.widget {
            border_width  = 2,
            border_color  = color,
            widget        = wibox.widget.graph,
        }
     end

Click to display more

Emit signals:

  • property::border_color When the border_color value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value border_color The new value affected to the property.

Consumed theme variables:

Theme variable Usage
beautiful.graph_border_colorFallback when border_color isn't set.
🔗 color color · 1 signal · 1 theme variable
Set the graph foreground color.

This color is used, when group_colors isn't set.

Constraints:

Default value : beautiful.graph_fg
Type description:
string : An hexadecimal color code, such as "#ff0000" for red.
string : A color name, such as "red".
table : A gradient table.
cairo.pattern : Any valid Cairo pattern.
cairo.pattern : A texture build from an image by gears.color.create_png_pattern
Valid values : The graph color.

See also:

gears.color This module simplifies the creation of cairo pattern objects. module

Usage:

    for _, color in ipairs {"#ff0000", "#00ff00", "#0000ff", "#ff00ff" } do
        wibox.widget {
            color     = color,
            widget    = wibox.widget.graph,
        }
     end

Click to display more

Emit signals:

  • property::color When the color value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value color The new value affected to the property.

Consumed theme variables:

Theme variable Usage
beautiful.graph_fg
🔗 background_color color · 1 signal · 1 theme variable
Set the graph background color.

Constraints:

Default value : beautiful.graph_bg
Type description:
string : An hexadecimal color code, such as "#ff0000" for red.
string : A color name, such as "red".
table : A gradient table.
cairo.pattern : Any valid Cairo pattern.
cairo.pattern : A texture build from an image by gears.color.create_png_pattern
Valid values : The graph background color.

See also:

gears.color This module simplifies the creation of cairo pattern objects. module

Usage:

    for _, color in ipairs {"#ff0000", "#00ff00", "#0000ff", "#ff00ff" } do
        wibox.widget {
            background_color = color,
            widget           = wibox.widget.graph,
        }
     end

Click to display more

Emit signals:

Consumed theme variables:

Theme variable Usage
beautiful.graph_bg
🔗 group_colors table
Set the colors for data groups.

Colors in this table are used to paint respective data groups. When this property is unset (default), the color property is used instead for all data groups. When this property is set, but there's no color for a data group in it (i.e. group_colors[group] is nil or false), then the respective data group is disabled, i.e. not drawn.

Constraints:

Default value : self.color
Table content : List of color values.
Valid values : A table with colors for data groups.

See also:

gears.color This module simplifies the creation of cairo pattern objects. module

Usage:

    local colors_normal = {
        "#ff0000",
        "#00ff00", -- the data group is green
        "#0000ff"
    }
    local colors_transparent = {
        "#ff0000",
        "#00000000", -- the data group is transparent
        "#0000ff"
    }
    local colors_disabled = {
        "#ff0000",
        nil, -- the data group is disabled
        "#0000ff"
    }
    
    wibox.widget {
        stack         = true,
        group_colors  = colors_normal,
        widget        = wibox.widget.graph,
    }
    
    wibox.widget {
        stack         = true,
        group_colors  = colors_transparent,
        widget        = wibox.widget.graph,
    }
    
    wibox.widget {
        stack         = true,
        group_colors  = colors_disabled,
        widget        = wibox.widget.graph,
    } 
🔗 max_value number · 1 signal
The maximum value the graph should handle.

This value corresponds to the top of the graph. If scale is also set, the graph never scales up below this value, but it automatically scales down to make all data fit. If scale and max_value are unset, max_value defaults to 1.

Constraints:

Default value : 1
Negative allowed : true

Usage:

    wibox.widget {
        max_value = 30,
        widget    = wibox.widget.graph,
    }
    
    wibox.widget {
        max_value = 10,
        widget    = wibox.widget.graph,
    }

Click to display more

Emit signals:

  • property::max_value When the max_value value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value max_value The new value affected to the property.
🔗 min_value number · 1 signal
The minimum value the graph should handle.

This value corresponds to the bottom of the graph. If scale is also set, the graph never scales up above this value, but it automatically scales down to make all data fit. If scale and min_value are unset, min_value defaults to 0.

Constraints:

Default value : 0
Negative allowed : true

Usage:

    wibox.widget {
        max_value = 30,
        widget    = wibox.widget.graph,
    }
    
    wibox.widget {
        min_value = 10,
        max_value = 30,
        widget    = wibox.widget.graph,
    }

Click to display more

Emit signals:

  • property::min_value When the min_value value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value min_value The new value affected to the property.
🔗 scale boolean · 1 signal
Set the graph to automatically scale its values.

If this property is set to true, the graph calculates effective min_value and max_value based on the displayed data, so that all data fits on screen. The properties themselves aren't changed, but the graph is drawn as though min_value(max_value) were equal to the minimum(maximum) value among itself and the currently drawn values. If min_value(max_value) is unset, then only the drawn values are considered in this calculation.

Constraints:

Default value : false
Valid values : true or false.

Usage:

    wibox.widget {
        scale  = false,
        widget = wibox.widget.graph,
    }
    
    wibox.widget {
        scale  = true,
        widget = wibox.widget.graph,
    }

Click to display more

Emit signals:

  • property::scale When the scale value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value scale The new value affected to the property.
🔗 clamp_bars boolean · 1 signal
Clamp graph bars to keep them inside the widget for out-of-range values.

Drawing values outside the [min_value, max_value] range leads to bar shapes that exceed physical widget dimensions. Most of the time this doesn't matter, because bar shapes are rectangles and bar heights aren't large enough to trigger errors in the drawing system. However for some shapes and values it does make a difference and leads to visibly different and/or invalid result.

When this property is set to true (the default), the graph clamps bars' heights to keep them within the graph.

Constraints:

Default value : false
Valid values : true or false.

Usage:

    wibox.widget {
        clamp_bars    = false,
        step_width    = 9,
        step_spacing  = 1,
        step_shape    = gears.shape.arrow,
        widget        = wibox.widget.graph,
    }
    
    wibox.widget {
        --clamp_bars    = true, --default
        step_width    = 9,
        step_spacing  = 1,
        step_shape    = gears.shape.arrow,
        widget        = wibox.widget.graph,
    } 

Click to display more

Emit signals:

  • property::clamp_bars When the clamp_bars value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value clamp_bars The new value affected to the property.
🔗 baseline_value number · 1 signal
The value corresponding to the starting point of graph bars.

Constraints:

Default value : 0
Negative allowed : true

Usage:

    wibox.widget {
        --baseline_value = 0, --default
        min_value      = -5,
        max_value      = 5,
        widget         = wibox.widget.graph,
    }
    
    wibox.widget {
        baseline_value = 5,
        min_value      = -5,
        max_value      = 5,
        widget         = wibox.widget.graph,
    }
    
    wibox.widget {
        baseline_value = -2.5,
        min_value      = -5,
        max_value      = 5,
        widget         = wibox.widget.graph,
    } 

Click to display more

Emit signals:

  • property::baseline_value When the baseline_value value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value baseline_value The new value affected to the property.
🔗 step_width number · 1 signal
Set the width or the individual steps.

Constraints:

Default value : 1
Unit : pixel
Negative allowed : false

Usage:

    for _, width in ipairs {1, 2, 3, 10} do
        wibox.widget {
            step_width   = width,
            step_spacing = 1,
            step_shape   = function(cr, s_width, height)
                gears.shape.rounded_rect(cr, s_width, height, 2)
            end,
            widget       = wibox.widget.graph,
        }
     end

Click to display more

Emit signals:

  • property::step_width When the step_width value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value step_width The new value affected to the property.
🔗 step_spacing number · 1 signal
Set the spacing between the steps.

Constraints:

Default value : 0
Unit : pixel
Negative allowed : false

Usage:

    for _, spacing in ipairs {0, 2, 4, 10} do
        wibox.widget {
            step_spacing = spacing,
            widget       = wibox.widget.graph,
        }
     end

Click to display more

Emit signals:

  • property::step_spacing When the step_spacing value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value step_spacing The new value affected to the property.
🔗 step_shape shape · 1 signal
The step shape.

Constraints:

Default value : gears.rect.rectangle
Type description:
gears.shape : Like gears.shape.circle
function: : This can be used for custom shapes or to set parameters of existing shapes.
Function prototype:
Parameters:
cr (cairo.context) : A Cairo context
width (number) : The area width.
height (number) : The area height.
Return : The function returns nothing.

See also:

gears.shape Module dedicated to gather common shape painters. module

Usage:

    local shapes = {
        gears.shape.squircle,
        gears.shape.octogon,
        gears.shape.rounded_bar,
        gears.shape.arrow
    }
    
    for _, shape in ipairs(shapes) do
        wibox.widget {
            step_width   = 5,
            step_spacing = 1,
            step_shape   = shape,
            widget       = wibox.widget.graph,
        }
     end

Click to display more

Emit signals:

  • property::step_shape When the step_shape value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value step_shape The new value affected to the property.
🔗 stack boolean · 1 signal
Set the graph to draw stacks. Default is false.

When set to true, bars of each successive data group are drawn on top of bars of previous groups, instead of the baseline. This necessitates all data values to be non-negative. Negative values, if present, will trigger NaN indication.

Constraints:

Default value : false
Valid values : true or false.

Usage:

    local colors = {
        "#ff0000",
        "#00ff00",
        "#0000ff"
    }
    local thin_arrow_shape = function(cr, width, height)
        gears.shape.arrow(cr, width, height, nil, 1, math.max(0, height-4))
    end
    
    wibox.widget {
        --stack         = false, --default
        group_colors  = colors,
        step_width    = 5,
        step_spacing  = 1,
        step_shape    = thin_arrow_shape,
        widget        = wibox.widget.graph,
    }
    
    wibox.widget {
        stack         = true,
        group_colors  = colors,
        step_width    = 5,
        step_spacing  = 1,
        step_shape    = thin_arrow_shape,
        widget        = wibox.widget.graph,
    } 

Click to display more

Emit signals:

  • property::stack When the stack value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value stack The new value affected to the property.
🔗 nan_indication boolean · 1 signal
Display NaN indication. Default is true.

When the data contains NaN values, and nan_indication is set, the corresponding area, where the value bar should have been drawn, is filled with the nan_color from top to bottom. The painting is done after all other data is rendered, to make sure that it won't be overpainted and go unnoticed.

Constraints:

Default value : true
Valid values : true or false.

Usage:

    local data = {
        -5, -4, 0/0, -2, -1, 0/0, 1, 2, 3, 0/0, 5,
    }
    
    wibox.widget {
        -- nan_indication = true, -- default
        -- default nan_color
        step_width    = 9,
        step_spacing  = 1,
        widget        = wibox.widget.graph,
    }
    
    wibox.widget {
        -- nan_indication = true, -- default
        nan_color     = "#ff00007f",
        step_width    = 9,
        step_spacing  = 1,
        widget        = wibox.widget.graph,
    }
    
    wibox.widget {
        nan_indication = false,
        step_width     = 9,
        step_spacing   = 1,
        widget         = wibox.widget.graph,
    } 

Click to display more

Emit signals:

  • property::nan_indication When the nan_indication value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value nan_indication The new value affected to the property.
🔗 nan_color color · 1 signal
The color of NaN indication.

The color used when nan_indication is set. Defaults to a yellow-black diagonal stripes pattern.

Constraints:

Default value : "#ffff00"
Type description:
string : An hexadecimal color code, such as "#ff0000" for red.
string : A color name, such as "red".
table : A gradient table.
cairo.pattern : Any valid Cairo pattern.
cairo.pattern : A texture build from an image by gears.color.create_png_pattern
Valid values : The color of NaN indication.

See also:

gears.color This module simplifies the creation of cairo pattern objects. module

Usage:

    -- The red and blue data groups are constant,
    -- but the green data group is a sine,
    -- which, when it becomes negative,
    -- triggers NaN indication in a stacked graph.
    local colors = {
        "#ff0000",
        "#00ff00",
        "#0000ff"
    }
    
    wibox.widget {
        --default nan_color
        stack        = true,
        group_colors = colors,
        step_width   = 1,
        step_spacing = 1,
        widget       = wibox.widget.graph,
    }
    
    wibox.widget {
        nan_color    = "#ff00ff7f",
        stack        = true,
        group_colors = colors,
        step_width   = 1,
        step_spacing = 1,
        widget       = wibox.widget.graph,
    }
    
    wibox.widget {
        nan_indication = false,
        stack          = true,
        group_colors   = colors,
        step_width     = 1,
        step_spacing   = 1,
        widget         = wibox.widget.graph,
    } 

Click to display more

Emit signals:

  • property::nan_color When the nan_color value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value nan_color The new value affected to the property.
🔗 capacity integer or nil · 1 signal
Set the graph capacity.

Since the typical uses of the graph widget imply that add_value will be called an indefinite number of times, the widget needs a way to know, when to start discarding old values from the backing array.

When capacity is set, it defines the maximum number of values to keep in each data group.

When capacity is unset (default), the number is determined heuristically, which is sufficient most of the time, unless the widget gets resized too much too fast.

Constraints:

Default value : nil
Unit : Number of value.
Negative allowed : false
Valid values : The maximum number of values to keep per data group (nil for automatic guess).

Click to display more

Emit signals:

  • property::capacity When the capacity value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value capacity The new value affected to the property.
🔗 children table · Inherited from wibox.widget.base
Get or set the children elements.

Constraints:

Default value : {}
Table content : A list of wibox.widget.

See also:

wibox.widget.base.all_children
🔗 all_children table · Inherited from wibox.widget.base
Get all direct and indirect children widgets. This will scan all containers recursively to find widgets Warning: This method it prone to stack overflow if there is a loop in the widgets hierarchy. A hierarchy loop is when a widget, or any of its children, contain (directly or indirectly) itself.

Constraints:

Default value : {}
Table content : A list of wibox.widget.

See also:

wibox.widget.base.children
🔗 forced_height number or nil · Inherited from wibox.widget.base
Force a widget height.

Constraints:

Default value : nil
Type description:
nil : Let the layout decide the height. Usually using the widget native height.
number : Enforce a number of pixels.
Unit : pixel
Negative allowed : false

See also:

wibox.widget.base.forced_width
🔗 forced_width number or nil · Inherited from wibox.widget.base
Force a widget width.

Constraints:

Default value : nil
Type description:
nil : Let the layout decide the width. Usually using the widget native width.
number : Enforce a number of pixels.
Unit : pixel
Negative allowed : false

See also:

wibox.widget.base.forced_height
🔗 opacity number · Inherited from wibox.widget.base
The widget opacity (transparency).

Constraints:

Default value : 1.0
Unit : A gradient between transparent (0.0) and opaque (1.0).
Minimum value : 0.0
Maximum value : 1.0

See also:

wibox.widget.base.visible
🔗 visible boolean · Inherited from wibox.widget.base
The widget visibility.

Constraints:

Default value : true
Valid values : true or false.

See also:

wibox.widget.base.opacity
🔗 buttons table · Inherited from wibox.widget.base
The widget buttons.

The table contains a list of awful.button objects.

Constraints:

Default value : {}
Table content : A list of awful.button.

See also:

awful.button Create easily new buttons objects ignoring certain modifiers. module

Deprecated object properties

🔗 height number · 1 signal
Set the graph height.

This property is deprecated. Use a wibox.container.constraint widget or forced_height.

Type constraints:

Name Type(s) Description
height number The height to set.

Click to display more

Emit signals:

  • property::height When the height value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value height The new value affected to the property.
🔗 width number · 1 signal
Set the graph width.

This property is deprecated. Use a wibox.container.constraint widget or forced_width.

Type constraints:

Name Type(s) Description
width number The width to set.

Click to display more

Emit signals:

  • property::width When the width value changes.
    • self wibox.widget.graph The object which changed (useful when connecting many object to the same callback).
    • new_value width The new value affected to the property.
🔗 stack_colors table
Set the colors for data groups.

This property is deprecated. Use group_colors instead.

Type constraints:

Name Type(s) Description
colors table A table with colors for data groups.

See also:

group_colors Set the colors for data groups. object properties

Object methods

🔗 :pick_data_group_color (group_idx) -> color
Determine the color to paint a data group with.

The graph uses this method to choose a color for a given data group. The default implementation uses a color from the group_colors table, if present, otherwise it falls back to color, then beautiful.graph_fg and finally to color red (#ff0000).

Parameters:

Name Type(s) Description
group_idx number The index of the data group.

Returns:

    color The color to paint the data group's values with.
🔗 :compute_drawn_values_num (usable_width) -> number
Determine how many values should be drawn for a given widget width.

The graph uses this method to determine the upper bound on the number of values that will be drawn from each data group. This affects, among other things, how many values will be considered for autoscaling, when scale is true, and, indirectly, how many values will be kept in the backing array, when capacity is unset.

The default implementation computes the minimum number that is enough to completely cover the given width with step_width + step_spacing intervals. The graph calls this method on every redraw and the width passed is the width of the value drawing area, i.e the graph borders are subtracted (2*border_width).

Parameters:

Name Type(s) Description
usable_width number

Returns:

    number The number of values.
🔗 :add_value (value, group)
Add a value to the graph.

The graph widget keeps its values grouped in data groups. Each data group is drawn with its own set of bars, starting with the latest value in the data group at the left edge of the graph.

Simply calling this method with a particular data group index is the only thing necessary and sufficient for creating a data group. Any natural integer as a group number is ok, but the user is advised to keep the group numbers low and consecutive for performance reasons.

There are no constraints on the value parameter, other than it should be a number.

Parameters:

Name Type(s) Description Default value
value Optional number The value to be added to a graph's data group. NaN
group Optional integer The index of the data group. 1
🔗 :clear ()
Clear the graph.

Removes all values from all data groups.

🔗 :add_button (button) · Inherited from wibox.widget.base
Add a new awful.button to this widget.

Parameters:

Name Type(s) Description
button awful.button The button to add.
🔗 :emit_signal_recursive (signal_name, ...) · Inherited from wibox.widget.base

Emit a signal and ensure all parent widgets in the hierarchies also forward the signal.

This is useful to track signals when there is a dynamic set of containers and layouts wrapping the widget.

Note that this function has some flaws:

  1. The signal is only forwarded once the widget tree has been built. This happens after all currently scheduled functions have been executed. Therefore, it will not start to work right away.
  2. In case the widget is present multiple times in a single widget tree, this function will also forward the signal multiple times (once per upward tree path).
  3. If the widget is removed from the widget tree, the signal is still forwarded for some time, similar to the first case.

Parameters:

Name Type(s) Description
signal_name string
... Other arguments
🔗 :index (widget, recursive, ...) -> (number, widget, table) · Inherited from wibox.widget.base
Get the index of a widget.

Parameters:

Name Type(s) Description
widget widget The widget to look for.
recursive Optional boolean Recursively check accross the sub-widgets hierarchy.
... Optional widget Additional widgets to add at the end of the sub-widgets hierarchy "path".

Returns:

  1. number The widget index.
  2. widget The parent widget.
  3. table The hierarchy path between "self" and "widget".
🔗 :connect_signal (name, func) · Inherited from gears.object

Connect to a signal.

Usage example output:

In slot [obj]   nil nil nil
In slot [obj]   foo bar 42

Parameters:

Name Type(s) Description
name string The name of the signal.
func function The callback to call when the signal is emitted.

Usage:

    local o = gears.object{}
    -- Function can be attached to signals
    local function slot(obj, a, b, c)
        print("In slot", obj, a, b, c)
    end
    o:connect_signal("my_signal", slot)
    -- Emitting can be done without arguments. In that case, the object will be
    -- implicitly added as an argument.
    o:emit_signal "my_signal"
    -- It is also possible to add as many random arguments are required.
    o:emit_signal("my_signal", "foo", "bar", 42)
    -- Finally, to allow the object to be garbage collected (the memory freed), it
    -- is necessary to disconnect the signal or use weak_connect_signal
    o:disconnect_signal("my_signal", slot)
    -- This time, the slot wont be called as it is no longer connected.
    o:emit_signal "my_signal"
🔗 :weak_connect_signal (name, func) · Inherited from gears.object
Connect to a signal weakly.

This allows the callback function to be garbage collected and automatically disconnects the signal when that happens. Warning: Only use this function if you really, really, really know what you are doing.

Parameters:

Name Type(s) Description
name string The name of the signal.
func function The callback to call when the signal is emitted.
🔗 :disconnect_signal (name, func) · Inherited from gears.object
Disconnect from a signal.

Parameters:

Name Type(s) Description
name string The name of the signal.
func function The callback that should be disconnected.
🔗 :emit_signal (name, ...) · Inherited from gears.object
Emit a signal.

Parameters:

Name Type(s) Description
name string The name of the signal
... Extra arguments for the callback functions. Each connected function receives the object as first argument and then any extra arguments that are given to emit_signal()

Theme variables

🔗 beautiful.graph_fg color
The graph foreground color Used, when the color property isn't set.
Click to display more

Used by:

  • color Set the graph foreground color.
🔗 beautiful.graph_bg color
The graph background color. Used, when the background_color property isn't set.
Click to display more

Used by:

🔗 beautiful.graph_border_color color
The graph border color. Used, when the border_color property isn't set.
Click to display more

Used by:

Signals

🔗 widget::layout_changed · Inherited from wibox.widget.base
When the layout (size) change. This signal is emitted when the previous results of :layout() and :fit() are no longer valid. Unless this signal is emitted, :layout() and :fit() must return the same result when called with the same arguments.

See also:

widget::redraw_needed When the widget content changed. signals
🔗 widget::redraw_needed · Inherited from wibox.widget.base
When the widget content changed. This signal is emitted when the content of the widget changes. The widget will be redrawn, it is not re-layouted. Put differently, it is assumed that :layout() and :fit() would still return the same results as before.

See also:

widget::layout_changed When the layout (size) change. signals
🔗 button::press · Inherited from wibox.widget.base
When a mouse button is pressed over the widget.

Arguments:

Name Type(s) Description
self table The current object instance itself.
lx number The horizontal position relative to the (0,0) position in the widget.
ly number The vertical position relative to the (0,0) position in the widget.
button number The button number.
mods table The modifiers (mod4, mod1 (alt), Control, Shift)
find_widgets_result table The entry from the result of wibox:find_widgets for the position that the mouse hit.
drawable wibox.drawable The drawable containing the widget.
widget widget The widget being displayed.
hierarchy wibox.hierarchy The hierarchy managing the widget's geometry.
x number An approximation of the X position that the widget is visible at on the surface.
y number An approximation of the Y position that the widget is visible at on the surface.
width number An approximation of the width that the widget is visible at on the surface.
height number An approximation of the height that the widget is visible at on the surface.
widget_width number The exact width of the widget in its local coordinate system.
widget_height number The exact height of the widget in its local coordinate system.

See also:

mouse Manipulate and inspect the mouse cursor. module
🔗 button::release · Inherited from wibox.widget.base
When a mouse button is released over the widget.

Arguments:

Name Type(s) Description
self table The current object instance itself.
lx number The horizontal position relative to the (0,0) position in the widget.
ly number The vertical position relative to the (0,0) position in the widget.
button number The button number.
mods table The modifiers (mod4, mod1 (alt), Control, Shift)
find_widgets_result table The entry from the result of wibox:find_widgets for the position that the mouse hit.
drawable wibox.drawable The drawable containing the widget.
widget widget The widget being displayed.
hierarchy wibox.hierarchy The hierarchy managing the widget's geometry.
x number An approximation of the X position that the widget is visible at on the surface.
y number An approximation of the Y position that the widget is visible at on the surface.
width number An approximation of the width that the widget is visible at on the surface.
height number An approximation of the height that the widget is visible at on the surface.
widget_width number The exact width of the widget in its local coordinate system.
widget_height number The exact height of the widget in its local coordinate system.

See also:

mouse Manipulate and inspect the mouse cursor. module
🔗 mouse::enter · Inherited from wibox.widget.base
When the mouse enter a widget.

Arguments:

Name Type(s) Description
self table The current object instance itself.
find_widgets_result table The entry from the result of wibox:find_widgets for the position that the mouse hit.
drawable wibox.drawable The drawable containing the widget.
widget widget The widget being displayed.
hierarchy wibox.hierarchy The hierarchy managing the widget's geometry.
x number An approximation of the X position that the widget is visible at on the surface.
y number An approximation of the Y position that the widget is visible at on the surface.
width number An approximation of the width that the widget is visible at on the surface.
height number An approximation of the height that the widget is visible at on the surface.
widget_width number The exact width of the widget in its local coordinate system.
widget_height number The exact height of the widget in its local coordinate system.

See also:

mouse Manipulate and inspect the mouse cursor. module
🔗 mouse::leave · Inherited from wibox.widget.base
When the mouse leave a widget.

Arguments:

Name Type(s) Description
self table The current object instance itself.
find_widgets_result table The entry from the result of wibox:find_widgets for the position that the mouse hit.
drawable wibox.drawable The drawable containing the widget.
widget widget The widget being displayed.
hierarchy wibox.hierarchy The hierarchy managing the widget's geometry.
x number An approximation of the X position that the widget is visible at on the surface.
y number An approximation of the Y position that the widget is visible at on the surface.
width number An approximation of the width that the widget is visible at on the surface.
height number An approximation of the height that the widget is visible at on the surface.
widget_width number The exact width of the widget in its local coordinate system.
widget_height number The exact height of the widget in its local coordinate system.

See also:

mouse Manipulate and inspect the mouse cursor. module
generated by LDoc 1.5.0