Class awful.tooltip
Tooltip module for awesome objects.
A tooltip is a small hint displayed when the mouse cursor
hovers a specific item.
In awesome, a tooltip can be linked with almost any
object having a :connect_signal()
method and receiving
mouse::enter
and mouse::leave
signals.
How to create a tooltip?
myclock = wibox.widget.textclock({}, "%T", 1) myclock_t = awful.tooltip({ objects = { myclock }, timer_function = function() return os.date("Today is %A %B %d %Y\nThe time is %T") end, })
How to add the same tooltip to multiple objects?
myclock_t:add_to_object(obj1) myclock_t:add_to_object(obj2)
Now the same tooltip is attached to myclock
, obj1
, obj2
.
How to remove a tooltip from several objects?
myclock_t:remove_from_object(obj1) myclock_t:remove_from_object(obj2)
Now the same tooltip is only attached to myclock
.
Info:
- Copyright: 2009 Sébastien Gross
- Author: Sébastien Gross <seb•ɱɩɲʋʃ•awesome•ɑƬ•chezwam•ɖɵʈ•org>
Functions
awful.tooltip (args) | Create a new tooltip and link it to a widget. |
Object properties
awful.tooltip.wibox | The wibox. |
awful.tooltip.visible | Is the tooltip visible? |
awful.tooltip.align | The horizontal alignment. |
awful.tooltip.shape | The shape of the tooltip window. |
awful.tooltip.mode | Set the tooltip positioning mode. |
awful.tooltip.preferred_positions | The preferred positions when in outside mode. |
awful.tooltip.text | Change displayed text. |
awful.tooltip.markup | Change displayed markup. |
awful.tooltip.timeout | Change the tooltip’s update interval. |
Theme variables
beautiful.tooltip_border_color | The tooltip border color. |
beautiful.tooltip_bg | The tooltip background color. |
beautiful.tooltip_fg | The tooltip foregound (text) color. |
beautiful.tooltip_font | The tooltip font. |
beautiful.tooltip_border_width | The tooltip border width. |
beautiful.tooltip_opacity | The tooltip opacity. |
beautiful.tooltip_shape | The default tooltip shape. |
beautiful.tooltip_align | The default tooltip alignment. |
Methods
awful.tooltip:set_shape (s) | Set the tooltip shape. |
awful.tooltip:add_to_object (self, obj) | Add tooltip to an object. |
awful.tooltip:remove_from_object (self, obj) | Remove tooltip from an object. |
Functions
Methods- awful.tooltip (args)
-
Create a new tooltip and link it to a widget.
Tooltips emit
property::visible
when their visibility changes.- args Arguments for tooltip creation.
- timer_function
function
A function to dynamically set the
tooltip text. Its return value will be passed to
wibox.widget.textbox.set_markup
. - timeout
number
The timeout value for
timer_function
. (default 1) - objects table A list of objects linked to the tooltip. (optional)
- delay_show number Delay showing the tooltip by this many seconds. (optional)
- margin_leftright integer The left/right margin for the text. (default apply_dpi(5))
- margin_topbottom integer The top/bottom margin for the text. (default apply_dpi(3))
- shape gears.shape The shape (default nil)
- timer_function
function
A function to dynamically set the
tooltip text. Its return value will be passed to
Returns:
-
awful.tooltip
The created tooltip.
See also:
- args Arguments for tooltip creation.
Object properties
- awful.tooltip.wibox
-
The wibox.
Type:
- wibox `
- awful.tooltip.visible
-
Is the tooltip visible?
Type:
- boolean
- awful.tooltip.align
-
The horizontal alignment.
The following values are valid:
- top_left
- left
- bottom_left
- right
- top_right
- bottom_right
- bottom
- top
See also:
- awful.tooltip.shape
-
The shape of the tooltip window.
If the shape require some parameters, use set_shape.
See also:
- awful.tooltip.mode
-
Set the tooltip positioning mode. This affects how the tooltip is placed. By default, the tooltip is aligned close to the mouse cursor. It is also possible to place the tooltip relative to the widget geometry.
Valid modes are:
- “mouse”: Next to the mouse cursor
- “outside”: Outside of the widget
Type:
- string
- awful.tooltip.preferred_positions
-
The preferred positions when in
outside
mode.If the tooltip fits on multiple sides of the drawable, then this defines the priority
The default is:
{"top", "right", "left", "bottom"}
Type:
- preferred_positions table The position, ordered by priorities
- awful.tooltip.text
-
Change displayed text.
Type:
- awful.tooltip.markup
-
Change displayed markup.
Type:
- awful.tooltip.timeout
-
Change the tooltip’s update interval.
Type:
- self tooltip A tooltip object.
- timeout number The timeout value.
Theme variables
- beautiful.tooltip_border_color
- The tooltip border color.
- beautiful.tooltip_bg
- The tooltip background color.
- beautiful.tooltip_fg
- The tooltip foregound (text) color.
- beautiful.tooltip_font
- The tooltip font.
- beautiful.tooltip_border_width
- The tooltip border width.
- beautiful.tooltip_opacity
- The tooltip opacity.
- beautiful.tooltip_shape
-
The default tooltip shape.
By default, all tooltips are rectangles, however, by setting this variables,
they can default to rounded rectangle or stretched octogons.
Type:
- shape function A gears.shape compatible function (default gears.shape.rectangle)
See also:
- beautiful.tooltip_align
-
The default tooltip alignment.
Type:
- string
See also:
Methods
- awful.tooltip:set_shape (s)
-
Set the tooltip shape.
All other arguments will be passed to the shape function.
- s gears.shape The shape
See also:
- awful.tooltip:add_to_object (self, obj)
-
Add tooltip to an object.
- self tooltip The tooltip.
- obj
gears.object
An object with
mouse::enter
andmouse::leave
signals.
- awful.tooltip:remove_from_object (self, obj)
-
Remove tooltip from an object.
- self tooltip The tooltip.
- obj
gears.object
An object with
mouse::enter
andmouse::leave
signals.