Skip to content

Commit

Permalink
Converted tag_preview to awful.popup
Browse files Browse the repository at this point in the history
  • Loading branch information
javacafe01 committed Aug 9, 2021
1 parent ebe55b5 commit 37edd6e
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions widget/tag_preview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -96,7 +95,7 @@ local function draw_widget(tag_preview_box, t, tag_preview_image, scale,
end
end

tag_preview_box:setup{
return {
{
{
{
Expand Down Expand Up @@ -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"
})
Expand All @@ -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
Expand Down

0 comments on commit 37edd6e

Please sign in to comment.