awful.tooltip: Add (and use) :set_markup() function
Since commit 5b4666432f
, we use set_text() instead of set_markup()
on the tooltip's textbox. This means it is no longer possible to use pango
markup in the tooltip which was not intended.
Fix this (properly) by introducing a :set_markup() function on tooltips (and use
it in the timer function to restore the old behavior).
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
90226d0ccf
commit
6dfe48690b
|
@ -124,6 +124,14 @@ local function set_text(self, text)
|
|||
set_geometry(self)
|
||||
end
|
||||
|
||||
--- Change displayed text.
|
||||
-- @param self The tooltip object.
|
||||
-- @param text New tooltip text, including pango markup.
|
||||
local function set_markup(self, text)
|
||||
self.textbox:set_markup(text)
|
||||
set_geometry(self)
|
||||
end
|
||||
|
||||
--- Change the tooltip's update interval.
|
||||
-- @param self A tooltip object.
|
||||
-- @param timeout The timeout value.
|
||||
|
@ -160,6 +168,7 @@ end
|
|||
-- @see add_to_object
|
||||
-- @see set_timeout
|
||||
-- @see set_text
|
||||
-- @see set_markup
|
||||
local function new(args)
|
||||
local self = {
|
||||
wibox = wibox({ }),
|
||||
|
@ -174,6 +183,7 @@ local function new(args)
|
|||
|
||||
-- export functions
|
||||
self.set_text = set_text
|
||||
self.set_markup = set_markup
|
||||
self.set_timeout = set_timeout
|
||||
self.add_to_object = add_to_object
|
||||
self.remove_from_object = remove_from_object
|
||||
|
@ -182,7 +192,7 @@ local function new(args)
|
|||
if args.timer_function then
|
||||
data[self].timer = timer { timeout = args.timeout and args.timeout or 1 }
|
||||
data[self].timer_function = function()
|
||||
self:set_text(args.timer_function())
|
||||
self:set_markup(args.timer_function())
|
||||
end
|
||||
data[self].timer:connect_signal("timeout", data[self].timer_function)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue