Class wibox.container.background

A container capable of changing the background color, foreground color widget shape.

Info:

  • Copyright: 2010 Uli Schlachter
  • Author: Uli Schlachter

Functions

background:set_shape (shape) Set the background shape.
wibox.container.background ([widget[, bg[, shape]]]) Returns a new background container.

Object properties

wibox.container.background.widget The widget displayed in the background widget.
wibox.container.background.bg The background color/pattern/gradient to use.
wibox.container.background.fg The foreground (text) color/pattern/gradient to use.
wibox.container.background.shape The background shap e.
wibox.container.background.shape_border_width When a shape is set, also draw a border.
wibox.container.background.shape_border_color When a shape is set, also draw a border.
wibox.container.background.shape_clip When a shape is set, make sure nothing is drawn outside of it.
wibox.container.background.bgimage The background image to use If image is a function, it will be called with (context, cr, width, height) as arguments.


Functions

background:set_shape (shape)
Set the background shape.

Any other arguments will be passed to the shape function

  • shape A function taking a context, width and height as arguments

See also:

wibox.container.background ([widget[, bg[, shape]]])
Returns a new background container.

A background container applies a background and foreground color to another widget.

  • widget The widget to display.
  • bg The background to use for that widget.
  • shape A gears.shape compatible shape function

Object properties

wibox.container.background.widget
The widget displayed in the background widget.

Type:

  • widget widget The widget to be disaplayed inside of the background area
wibox.container.background.bg
The background color/pattern/gradient to use.

Type:

  • bg A color string, pattern or gradient

See also:

Usage:

    local text_widget = {
        text   = 'Hello world!',
        widget = wibox.widget.textbox
    }
    parent : setup {
        {
            text_widget,
            bg     = '#ff0000',
            widget = wibox.container.background
        },
        {
            text_widget,
            bg     = '#00ff00',
            widget = wibox.container.background
        },
        {
            text_widget,
            bg     = '#0000ff',
            widget = wibox.container.background
        },
        spacing = 10,
        layout  = wibox.layout.fixed.vertical
    }
wibox.container.background.fg
The foreground (text) color/pattern/gradient to use.

Type:

  • fg A color string, pattern or gradient

See also:

Usage:

    local text_widget = {
        text   = 'Hello world!',
        widget = wibox.widget.textbox
    }
    parent : setup {
        {
            text_widget,
            fg     = '#ff0000',
            widget = wibox.container.background
        },
        {
            text_widget,
            fg     = '#00ff00',
            widget = wibox.container.background
        },
        {
            text_widget,
            fg     = '#0000ff',
            widget = wibox.container.background
        },
        spacing = 10,
        layout  = wibox.layout.fixed.vertical
    }
wibox.container.background.shape
The background shap e.

Use set_shape to set additional shape paramaters.

Type:

  • shape A function taking a context, width and height as arguments

See also:

Usage:

    parent : setup {
        {
            -- Adding a shape without margin may result in cropped output
            {
                text   = 'Hello world!',
                widget = wibox.widget.textbox
            },
            shape              = gears.shape.hexagon,
            bg                 = beautiful.bg_normal,
            shape_border_color = beautiful.border_color,
            shape_border_width = beautiful.border_width,
            widget             = wibox.container.background
        },
        {
            -- To solve this, use a margin
            {
                {
                    text   = 'Hello world!',
                    widget = wibox.widget.textbox
                },
                left   = 10,
                right  = 10,
                top    = 3,
                bottom = 3,
                widget = wibox.container.margin
            },
            shape              = gears.shape.hexagon,
            bg                 = beautiful.bg_normal,
            shape_border_color = beautiful.border_color,
            shape_border_width = beautiful.border_width,
            widget             = wibox.container.background
        },
        spacing = 10,
        layout  = wibox.layout.fixed.vertical
    }
wibox.container.background.shape_border_width
When a shape is set, also draw a border.

See wibox.container.background.shape for an usage example.

Type:

  • width number The border width
wibox.container.background.shape_border_color
When a shape is set, also draw a border.

See wibox.container.background.shape for an usage example.

Type:

  • fg The border color, pattern or gradient (default self._private.foreground)

See also:

wibox.container.background.shape_clip
When a shape is set, make sure nothing is drawn outside of it.

Type:

  • value boolean If the shape clip is enable

Usage:

    parent : setup {
        {
            -- Some content may be outside of the shape
            {
                text   = 'Hello\nworld!',
                widget = wibox.widget.textbox
            },
            shape              = gears.shape.circle,
            bg                 = beautiful.bg_normal,
            shape_border_color = beautiful.border_color,
            widget             = wibox.container.background
        },
        {
            -- To solve this, clip the content
            {
                text   = 'Hello\nworld!',
                widget = wibox.widget.textbox
            },
            shape_clip         = true,
            shape              = gears.shape.circle,
            bg                 = beautiful.bg_normal,
            shape_border_color = beautiful.border_color,
            widget             = wibox.container.background
        },
        spacing = 10,
        layout  = wibox.layout.fixed.vertical
    }
wibox.container.background.bgimage
The background image to use If image is a function, it will be called with (context, cr, width, height) as arguments. Any other arguments passed to this method will be appended.

Type:

  • image A background image or a function

See also:

generated by LDoc 1.4.2