Code style improvements

Autoformatted code for task_preview
This commit is contained in:
Gokul Swaminathan 2021-08-11 13:58:19 -07:00
parent 46282edf72
commit 5ae63cd860
1 changed files with 67 additions and 63 deletions

View File

@ -5,7 +5,6 @@
-- v (boolean)
-- c (client)
--
local awful = require("awful")
local wibox = require("wibox")
local helpers = require(tostring(...):match(".*bling") .. ".helpers")
@ -16,7 +15,8 @@ local cairo = require("lgi").cairo
-- TODO: rename structure to something better?
local function draw_widget(c, widget_template, screen_radius, widget_bg,
widget_border_color, widget_border_width, margin, widget_width, widget_height)
widget_border_color, widget_border_width, margin,
widget_width, widget_height)
if not pcall(function() return type(c.content) end) then return end
local content = gears.surface(c.content)
@ -79,15 +79,15 @@ local function draw_widget(c, widget_template, screen_radius, widget_bg,
shape = helpers.shape.rrect(screen_radius),
widget = wibox.container.background
}),
widget = wibox.container.constraint,
width = widget_width,
height = widget_height
height = widget_height,
widget = wibox.container.constraint
}
-- todo: have something like a create callback here?
-- TODO: have something like a create callback here?
for _, w in ipairs(widget:get_children_by_id("image_role")) do
w.image = img -- todo: copy it with gears.surface.xxx or something
w.image = img -- TODO: copy it with gears.surface.xxx or something
end
for _, w in ipairs(widget:get_children_by_id("name_role")) do
@ -95,7 +95,7 @@ local function draw_widget(c, widget_template, screen_radius, widget_bg,
end
for _, w in ipairs(widget:get_children_by_id("icon_role")) do
w.image = c.icon -- todo: detect clienticon
w.image = c.icon -- TODO: detect clienticon
end
return widget
@ -119,7 +119,8 @@ local function draw_widget(c, widget_template, screen_radius, widget_bg,
local widget_border_width = beautiful.task_preview_widget_border_width or
dpi(3)
local task_preview_box = awful.popup({
local task_preview_box = awful.popup(
{
type = "dropdown_menu",
visible = false,
ontop = true,
@ -132,8 +133,11 @@ local function draw_widget(c, widget_template, screen_radius, widget_bg,
awesome.connect_signal("bling::task_preview::visibility", function(s, v, c)
if v then
-- Update task preview contents
task_preview_box.widget = draw_widget(c, opts.structure, screen_radius, widget_bg,
widget_border_color, widget_border_width, margin, widget_width, widget_height)
task_preview_box.widget = draw_widget(c, opts.structure,
screen_radius, widget_bg,
widget_border_color,
widget_border_width, margin,
widget_width, widget_height)
end
if not placement_fn then