Module blingbling.helpers

Functions used in blingbling.

Functions

dbg (vars) Display values of variables in an awesome popup.
hexadecimal_to_rgba_percent (my_color) Convert an hexadecimal color to rgba color.
rgb (red, green, blue) Get red green blue value in parameters and return hexadecimal string
rgba (red, green, blue, alpha) Get red green blue and alpha value in parameters and return hexadecimal string.
is_transparent (my_color) Check if an hexadecimal color is fully transparent.
split (str, pat) Split string in different parts which are returned in a table.
draw_background_tiles (cr, height, v_margin, width, h_margin) Draw tiles in a cairo context.
draw_text_and_background (cr, text, x, y, text_background_color, text_color, show_text_centered_on_x, show_text_centered_on_y, show_text_on_left_of_x, show_text_on_bottom_of_y) Draw text on a rectangle which width and height depend on the text width and height.
draw_up_down_arrows (cr, x, y_bottom, y_top, value, background_arrow_color, arrow_color, arrow_line_color, up) Drawn one foreground arrow with a background arrow that depend on a value.
draw_vertical_bar (cr, h_margin, v_margin, width, height, represent) Draw a vertical bar with gradient color, so it looks like a cylinder, and it's height depends on a value.
draw_horizontal_bar (cr, h_margin, v_margin, width, height, represent) Draw an horizontal bar with gradient color, so it looks like a cylinder, and it's height depends on a value.
draw_rounded_corners_rectangle (cr, x, y, width, height, color, rounded_size) Draw a rectangle width rounded corners.
clip_rounded_corners_rectangle (cr, x, y, width, height, rounded_size) Set a rectangle width rounded corners that define the area to draw.
draw_rounded_corners_horizontal_graph (cr, x, y, width, height, background_color, graph_color, rounded_size, value_to_represent, graph_line_color) Draw a foreground rounded corners rectangle which width depends on a value, and a background rounded corners rectangle.
draw_rounded_corners_vertical_graph (cr, x, y, width, height, background_color, graph_color, rounded_size, value_to_represent, graph_line_color) Draw a foreground rounded corners rectangle which height depends on a value, and a background rounded corners rectangle.
generate_rounded_rectangle_with_text (cr, width, height, text, padding, background_color, text_color, font_size, rounded_size, border) Generate a text in front of a centered rectangle with rounded corners (or not) in a cairo context.
draw_triangle (cr, first, second, third, color) Draw a rectangular triangle filled with given color
draw_triangle_outline (cr, first, second, third, color) Draw a rectangular triangular outline of the given color
compute_bar_width (nb_bars, width, sep) Compute the width of each bar in a graph It returns the width of the bar and a value that corresponds to the remaing space divided by 2
draw_triangle_graph_using_bars (cr, width, height, h_margin, v_margin, color, value) Display a value using bars or parts of bar in a triangular form
hash_remove (hash, key) Remove an element from a table using key.
get_days_in_month (month, year) Get the number of days in a given month of a year.
get_ISO8601_weeks_number_of_month (month, year) Find the weeks numbers of a given month.
get_nb_cores () Get the number of cpu cores
get_cpu_name () Get the cpu name
get_mounted_devices () Get all the currently mounted devices
get_total_mem_in_kb () Get the total amount of RAM in kb
get_input_devices () Get the input device names
get_graphic_card () Get the current graphic card
get_os_release_informations () Get OS related informations from /etc/os-release
icons_only_tasklist (w, buttons, label, data, objects) Function used in order to have a tasklist with icons only The classical usage of it is: awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons,nil,icons_only_tasklist)
load_properties (properties, data, graph, superproperties) Function used in widgets in order to create a local table of all the widget properties which are a mix between the properties provided by the user trought the widget interface, or the properties defined by superproperties


Functions

dbg (vars)
Display values of variables in an awesome popup. Each variables in vars is separated by a "|"

Parameters:

  • vars a table of variable
hexadecimal_to_rgba_percent (my_color)
Convert an hexadecimal color to rgba color. It convert a string variable "#rrggbb" or "#rrggbbaa" (with r,g,b and a which are hexadecimal value) to r, g, b a=1 or r,g,b,a (with r,g,b,a floated value from 0 to 1. The function returns 4 variables.

Parameters:

  • my_color a string "#rrggbb" or "#rrggbbaa"
rgb (red, green, blue)
Get red green blue value in parameters and return hexadecimal string

Parameters:

  • red
  • green
  • blue
rgba (red, green, blue, alpha)
Get red green blue and alpha value in parameters and return hexadecimal string.

Parameters:

  • red
  • green
  • blue
  • alpha
is_transparent (my_color)
Check if an hexadecimal color is fully transparent. Returns true or false

Parameters:

  • my_color a string "#rrggbb" or "#rrggbbaa"
split (str, pat)
Split string in different parts which are returned in a table. The delimiter of each part is a pattern given in argument.

Parameters:

  • str the string to split
  • pat the pattern delimiter
draw_background_tiles (cr, height, v_margin, width, h_margin)
Draw tiles in a cairo context.

Parameters:

  • cr a cairo context.
  • height the height of the surface on which we want tiles
  • v_margin value used to define top margin and/or bottom margin (tiles are not drawn on the margins)
  • width the width of the surface on which we want tiles
  • h_margin value used to define left margin and/or right margin.
draw_text_and_background (cr, text, x, y, text_background_color, text_color, show_text_centered_on_x, show_text_centered_on_y, show_text_on_left_of_x, show_text_on_bottom_of_y)
Draw text on a rectangle which width and height depend on the text width and height.

Parameters:

  • cr a cairo context already initialised with oocairo.context_create( )
  • text the text to display
  • x the x coordinate of the left of the text
  • y the y coordinate of the bottom of the text
  • text_background_color a string "#rrggbb" or "#rrggbbaa" for the rectangle color
  • text_color a string "#rrggbb" or "#rrggbbaa" for the text color
  • show_text_centered_on_x a boolean value not mandatory (false by default) if true, x parameter is the coordinate of the middle of the text
  • show_text_centered_on_y a boolean value not mandatory (false by default) if true, y parameter is the coordinate of the middle of the text
  • show_text_on_left_of_x a boolean value not mandatory (false by default) if true, x parameter is the right of the text
  • show_text_on_bottom_of_y a boolean value not mandatory (false by default) if true, y parameter is the top of the text
draw_up_down_arrows (cr, x, y_bottom, y_top, value, background_arrow_color, arrow_color, arrow_line_color, up)
Drawn one foreground arrow with a background arrow that depend on a value. If the value is egal to 0 then the foreground arrow is not drawn.

Parameters:

  • cr a cairo context already initialised with oocairo.context_create( )
  • x the x coordinate in the cairo context where the arrow start
  • y_bottom the bottom corrdinate of the arrows
  • y_top the top coordinate of the arrows
  • value a number
  • background_arrow_color the color of the background arrow, a string "#rrggbb" or "#rrggbbaa"
  • arrow_color the color of the foreground arrow, a string "#rrggbb" or "#rrggbbaa"
  • arrow_line_color the color of the outline of the foreground arrow , a string "#rrggbb" or "#rrggbbaa"
  • up boolean value if false draw a down arrow, if true draw a up arrow
draw_vertical_bar (cr, h_margin, v_margin, width, height, represent)
Draw a vertical bar with gradient color, so it looks like a cylinder, and it's height depends on a value.

Parameters:

  • cr a cairo context already initialised with oocairo.context_create( )
  • h_margin the left and right margin of the bar in the cr
  • v_margin the top and bottom margin of the bar in the cr
  • width the width used to display the left margin, the bar and the right margin
  • height the height used to display the top margin, the bar and the bottom margin
  • represent a table {background_bar_color = "#rrggbb" or "#rrggbbaa", color = "#rrggbb" or "#rrggbbaa", value =the value used to calculate the height of the bar}
draw_horizontal_bar (cr, h_margin, v_margin, width, height, represent)
Draw an horizontal bar with gradient color, so it looks like a cylinder, and it's height depends on a value.

Parameters:

  • cr a cairo context already initialised with oocairo.context_create( )
  • h_margin the left and right margin of the bar in the cr
  • v_margin the top and bottom margin of the bar in the cr
  • width the width used to display the left margin, the bar and the right margin
  • height the height used to display the top margin, the bar and the bottom margin
  • represent a table {background_bar_color = "#rrggbb" or "#rrggbbaa", color = "#rrggbb" or "#rrggbbaa", value =the value used to calculate the width of the bar}
draw_rounded_corners_rectangle (cr, x, y, width, height, color, rounded_size)
Draw a rectangle width rounded corners.

Parameters:

  • cr a cairo context already initialised with oocairo.context_create( )
  • x the x coordinate of the left top corner
  • y the y corrdinate of the left top corner
  • width the width of the rectangle
  • height the height of the rectangle
  • color a string "#rrggbb" or "#rrggbbaa" for the color of the rectangle
  • rounded_size a float value from 0 to 1 (0 is no rounded corner) or a table of float value
clip_rounded_corners_rectangle (cr, x, y, width, height, rounded_size)
Set a rectangle width rounded corners that define the area to draw.

Parameters:

  • cr a cairo context already initialised with oocairo.context_create( )
  • x the x coordinate of the left top corner
  • y the y corrdinate of the left top corner
  • width the width of the rectangle
  • height the height of the rectangle
  • rounded_size a float value from 0 to 1 (0 is no rounded corner)
draw_rounded_corners_horizontal_graph (cr, x, y, width, height, background_color, graph_color, rounded_size, value_to_represent, graph_line_color)
Draw a foreground rounded corners rectangle which width depends on a value, and a background rounded corners rectangle.

Parameters:

  • cr a cairo context already initialised with oocairo.context_create( )
  • x the x coordinate of the left top corner
  • y the y corrdinate of the left top corner
  • width the width of the background rectangle and the maximal width of th foreground rectangle
  • height the height of the background and the foreground rectangles
  • background_color a string "#rrggbb" or "#rrggbbaa" for the color of the background rectangle
  • graph_color a string "#rrggbb" or "#rrggbbaa" for the color of the foreground rectangle
  • rounded_size a float value from 0 to 1 (0 is no rounded corner)
  • value_to_represent the percent of the max width used to calculate the width of the foreground rectangle
  • graph_line_color a string "#rrggbb" or "#rrggbbaa" for the outiline color of the background rectangle
draw_rounded_corners_vertical_graph (cr, x, y, width, height, background_color, graph_color, rounded_size, value_to_represent, graph_line_color)
Draw a foreground rounded corners rectangle which height depends on a value, and a background rounded corners rectangle.

Parameters:

  • cr a cairo context already initialised with oocairo.context_create( )
  • x the x coordinate of the left top corner
  • y the y corrdinate of the left top corner
  • width the width of the background and the foreground rectangles
  • height the height of the background rectangle and the maximal height of the foreground rectangle
  • background_color a string "#rrggbb" or "#rrggbbaa" for the color of the background rectangle
  • graph_color a string "#rrggbb" or "#rrggbbaa" for the color of the foreground rectangle
  • rounded_size a float value from 0 to 1 (0 is no rounded corner)
  • value_to_represent the percent of the max height used to calculate the height of the foreground rectangle
  • graph_line_color a string "#rrggbb" or "#rrggbbaa" for the outiline color of the background rectangle
generate_rounded_rectangle_with_text (cr, width, height, text, padding, background_color, text_color, font_size, rounded_size, border)
Generate a text in front of a centered rectangle with rounded corners (or not) in a cairo context. It returns a table ={ width = the width of the image, height = the height of the image}

Parameters:

  • cr a cairo context already initialised with oocairo.context_create( )
  • width the width of the widget
  • height the height of the widget
  • text the text to display
  • padding the left/right/top/bottom padding used to center the text in the background rectangle
  • background_color a string "#rrggbb" or "#rrggbbaa" for the color of the background rectangle
  • text_color a string "#rrggbb" or "#rrggbbaa" for the color of the text
  • font_size define the size of the font
  • rounded_size a float value from 0 to 1 (0 is no rounded corner)
  • border a color as a string "#rrggbb" or "#rrggbbaa"
draw_triangle (cr, first, second, third, color)
Draw a rectangular triangle filled with given color

Parameters:

  • cr cairo context
  • first point coordinates {x= 1.0, y = 2.0}
  • second point coordinates {x= 1.0, y = 2.0}
  • third point coordinates {x= 1.0, y = 2.0}
  • color a color as a string "#rrggbb" or "#rrggbbaa"
draw_triangle_outline (cr, first, second, third, color)
Draw a rectangular triangular outline of the given color

Parameters:

  • cr cairo context
  • first point coordinates {x= 1.0, y = 2.0}
  • second point coordinates {x= 1.0, y = 2.0}
  • third point coordinates {x= 1.0, y = 2.0}
  • color a color as a string "#rrggbb" or "#rrggbbaa"
compute_bar_width (nb_bars, width, sep)
Compute the width of each bar in a graph It returns the width of the bar and a value that corresponds to the remaing space divided by 2

Parameters:

  • nb_bars the number of bars
  • width the width of the graph
  • sep the size between two bars
draw_triangle_graph_using_bars (cr, width, height, h_margin, v_margin, color, value)
Display a value using bars or parts of bar in a triangular form

Parameters:

  • cr cairo context
  • width width of the graph
  • height height of the graph
  • h_margin horizontal space left at left and right of the graph
  • v_margin vertical space left at top and bottom of the graph
  • color the color of the graph
  • value to represent
hash_remove (hash, key)
Remove an element from a table using key.

Parameters:

  • hash the table
  • key the key to remove
get_days_in_month (month, year)
Get the number of days in a given month of a year. iT returns a number

Parameters:

  • month the month we focus on ( 1 to 12 )
  • year a number YYYY used to check if it's a leap year.
get_ISO8601_weeks_number_of_month (month, year)
Find the weeks numbers of a given month. Implementation as per the ISO 8601 definition (http://en.wikipedia.org/wiki/ISO_week_date) Fully compatible with original, returns table with 6 week numbers

Parameters:

  • month the month
  • year the year
get_nb_cores ()
Get the number of cpu cores

Returns:

    a number
get_cpu_name ()
Get the cpu name

Returns:

    a string describing the cpu
get_mounted_devices ()
Get all the currently mounted devices

Returns:

    an indexed table from 1 to n, where each element is a table with the "mnt", and "dev" key.
get_total_mem_in_kb ()
Get the total amount of RAM in kb

Returns:

    a number
get_input_devices ()
Get the input device names

Returns:

    an table with "keyboard" and "mouse" keys
get_graphic_card ()
Get the current graphic card

Returns:

    a string
get_os_release_informations ()
Get OS related informations from /etc/os-release

Returns:

    a key/value table
icons_only_tasklist (w, buttons, label, data, objects)
Function used in order to have a tasklist with icons only The classical usage of it is: awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons,nil,icons_only_tasklist)

Parameters:

  • w
  • buttons
  • label
  • data
  • objects
load_properties (properties, data, graph, superproperties)
Function used in widgets in order to create a local table of all the widget properties which are a mix between the properties provided by the user trought the widget interface, or the properties defined by superproperties

Parameters:

  • properties a table with the names of all the properties
  • data the data table of the module that references all the same widgets
  • graph the widget itself
  • superproperties the table of the superporperties
generated by LDoc 1.4.3 Last updated 2015-08-04 10:16:50