Converted tag_preview to `awful.popup`

This commit is contained in:
Gokul Swaminathan 2021-08-09 10:43:59 -07:00
parent ebe55b56f9
commit 37edd6e1eb
1 changed files with 18 additions and 18 deletions

View File

@ -14,11 +14,10 @@ local beautiful = require("beautiful")
local dpi = beautiful.xresources.apply_dpi
local cairo = require("lgi").cairo
local function draw_widget(tag_preview_box, t, tag_preview_image, scale,
screen_radius, client_radius, client_opacity,
client_bg, client_border_color, client_border_width,
widget_bg, widget_border_color, widget_border_width,
geo, margin)
local function draw_widget(t, tag_preview_image, scale, screen_radius,
client_radius, client_opacity, client_bg,
client_border_color, client_border_width, widget_bg,
widget_border_color, widget_border_width, geo, margin)
local client_list = wibox.layout.manual()
client_list.forced_height = geo.height
@ -96,7 +95,7 @@ local function draw_widget(tag_preview_box, t, tag_preview_image, scale,
end
end
tag_preview_box:setup{
return {
{
{
{
@ -149,10 +148,12 @@ local enable = function(opts)
local widget_border_width = beautiful.tag_preview_widget_border_width or
dpi(3)
local tag_preview_box = wibox({
local tag_preview_box = awful.popup({
type = "dropdown_menu",
visible = false,
ontop = true,
placement = placement_fn,
widget = wibox.container.background,
input_passthrough = true,
bg = "#00000000"
})
@ -164,25 +165,24 @@ local enable = function(opts)
end)
awesome.connect_signal("bling::tag_preview::update", function(t)
local geo = t.screen:get_bounding_geometry{
honor_padding = padding,
honor_workarea = work_area
}
tag_preview_box.width = scale * geo.width + margin * 2
tag_preview_box.height = scale * geo.height + margin * 2
draw_widget(tag_preview_box, t, tag_preview_image, scale, screen_radius,
client_radius, client_opacity, client_bg,
client_border_color, client_border_width, widget_bg,
widget_border_color, widget_border_width, geo, margin)
tag_preview_box.maximum_width = scale * geo.width + margin * 2
tag_preview_box.maximum_height = scale * geo.height + margin * 2
tag_preview_box:setup(draw_widget(t, tag_preview_image, scale,
screen_radius, client_radius,
client_opacity, client_bg,
client_border_color,
client_border_width, widget_bg,
widget_border_color,
widget_border_width, geo, margin))
end)
awesome.connect_signal("bling::tag_preview::visibility", function(s, v)
if placement_fn then
placement_fn(tag_preview_box)
else
if not placement_fn then
tag_preview_box.x = s.geometry.x + widget_x
tag_preview_box.y = s.geometry.y + widget_y
end