awful.tooltip: Fix for new widget layouts
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
9d4e5d31bf
commit
7edabc39fd
|
@ -10,6 +10,7 @@ local screen = screen
|
||||||
local timer = timer
|
local timer = timer
|
||||||
local a_placement = require("awful.placement")
|
local a_placement = require("awful.placement")
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
|
local textbox = require("wibox.widget.textbox")
|
||||||
local setmetatable = setmetatable
|
local setmetatable = setmetatable
|
||||||
local ipairs = ipairs
|
local ipairs = ipairs
|
||||||
|
|
||||||
|
@ -76,9 +77,9 @@ end
|
||||||
local function set_geometry(self)
|
local function set_geometry(self)
|
||||||
local my_geo = self.wibox:geometry()
|
local my_geo = self.wibox:geometry()
|
||||||
-- calculate width / height
|
-- calculate width / height
|
||||||
n_s = self.wibox.widgets[1]:extents()
|
local n_w, n_h = self.widget:fit(-1, -1)
|
||||||
if my_geo.width ~= n_s.width or my_geo.height ~= n_s.height then
|
if my_geo.width ~= n_w or my_geo.height ~= n_h then
|
||||||
self.wibox:geometry(n_s)
|
self.wibox:geometry({ width = n_w, height = n_h })
|
||||||
place(self)
|
place(self)
|
||||||
end
|
end
|
||||||
if not self.wibox.visible then
|
if not self.wibox.visible then
|
||||||
|
@ -122,8 +123,8 @@ end
|
||||||
-- @param self The tooltip object.
|
-- @param self The tooltip object.
|
||||||
-- @param text New tooltip text.
|
-- @param text New tooltip text.
|
||||||
local function set_text(self, text)
|
local function set_text(self, text)
|
||||||
self.wibox.widgets[1].text = '<span color="' .. data[self].fg
|
self.widget:set_markup('<span color="' .. data[self].fg
|
||||||
.. '" font_desc="' .. data[self].font .. '">' .. text .. "</span>"
|
.. '" font_desc="' .. data[self].font .. '">' .. text .. "</span>")
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Change the tooltip's update interval.
|
--- Change the tooltip's update interval.
|
||||||
|
@ -179,10 +180,7 @@ local function new(args)
|
||||||
visible = false,
|
visible = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
local my_textbox = widget({
|
local my_textbox = textbox()
|
||||||
type = "textbox",
|
|
||||||
name = "tooltip_textbox",
|
|
||||||
align="right"})
|
|
||||||
|
|
||||||
-- private data
|
-- private data
|
||||||
data[self] = {
|
data[self] = {
|
||||||
|
@ -212,7 +210,8 @@ local function new(args)
|
||||||
self.wibox.visible = false
|
self.wibox.visible = false
|
||||||
-- Who want a non ontop tooltip ?
|
-- Who want a non ontop tooltip ?
|
||||||
self.wibox.ontop = true
|
self.wibox.ontop = true
|
||||||
self.wibox.widgets = { my_textbox }
|
self.wibox:set_widget(my_textbox)
|
||||||
|
self.widget = my_textbox
|
||||||
|
|
||||||
-- add some signals on both the tooltip and widget
|
-- add some signals on both the tooltip and widget
|
||||||
self.wibox:connect_signal("mouse::enter", data[self].hide)
|
self.wibox:connect_signal("mouse::enter", data[self].hide)
|
||||||
|
|
Loading…
Reference in New Issue