Add a fallback notif
This commit is contained in:
parent
21c5125def
commit
49e7c07657
|
@ -5,9 +5,9 @@ local gtable = require("gears.table")
|
|||
local gtimer = require("gears.timer")
|
||||
local gmatrix = require("gears.matrix")
|
||||
local gsurface = require("gears.surface")
|
||||
local naughty = require("naughty")
|
||||
local wibox = require("wibox")
|
||||
local beautiful = require("beautiful")
|
||||
local helpers = require(tostring(...):match(".*bling") .. ".helpers")
|
||||
local dpi = beautiful.xresources.apply_dpi
|
||||
local collectgarbage = collectgarbage
|
||||
local ipairs = ipairs
|
||||
|
@ -22,8 +22,8 @@ local function _get_widget_geometry(_hierarchy, widget)
|
|||
if _hierarchy:get_widget() == widget then
|
||||
-- Get the extents of this widget in the device space
|
||||
local x, y, w, h = gmatrix.transform_rectangle(
|
||||
_hierarchy:get_matrix_to_device(),
|
||||
0, 0, width, height)
|
||||
_hierarchy:get_matrix_to_device(), 0, 0, width,
|
||||
height)
|
||||
return {x = x, y = y, width = w, height = h, hierarchy = _hierarchy}
|
||||
end
|
||||
|
||||
|
@ -58,11 +58,7 @@ function task_preview:show(c, args)
|
|||
self._private.widget.y = args.coords.y
|
||||
end
|
||||
|
||||
if not pcall(function()
|
||||
return type(c.content)
|
||||
end) then
|
||||
return
|
||||
end
|
||||
if not pcall(function() return type(c.content) end) then return end
|
||||
|
||||
local content = nil
|
||||
if c.active then
|
||||
|
@ -92,19 +88,19 @@ function task_preview:show(c, args)
|
|||
resize = true,
|
||||
forced_height = dpi(20),
|
||||
forced_width = dpi(20),
|
||||
widget = wibox.widget.imagebox,
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
{
|
||||
{
|
||||
id = "name_role",
|
||||
align = "center",
|
||||
widget = wibox.widget.textbox,
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
left = dpi(4),
|
||||
right = dpi(4),
|
||||
widget = wibox.container.margin,
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
layout = wibox.layout.align.horizontal,
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
{
|
||||
{
|
||||
|
@ -112,30 +108,30 @@ function task_preview:show(c, args)
|
|||
id = "image_role",
|
||||
resize = true,
|
||||
clip_shape = self.image_shape,
|
||||
widget = wibox.widget.imagebox,
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
widget = wibox.container.place,
|
||||
widget = wibox.container.place
|
||||
},
|
||||
top = self.margin * 0.25,
|
||||
widget = wibox.container.margin,
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
fill_space = true,
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
margins = self.margin,
|
||||
widget = wibox.container.margin,
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = self.bg,
|
||||
shape_border_width = self.border_width,
|
||||
shape_border_color = self.border_color,
|
||||
shape = self.shape,
|
||||
widget = wibox.container.background,
|
||||
widget = wibox.container.background
|
||||
}),
|
||||
width = self.forced_width,
|
||||
height = self.forced_height,
|
||||
widget = wibox.container.constraint,
|
||||
widget = wibox.container.constraint
|
||||
}
|
||||
|
||||
-- TODO: have something like a create callback here?
|
||||
|
@ -183,9 +179,13 @@ local function new(args)
|
|||
args.margin = args.margin or beautiful.task_preview_widget_margin or dpi(0)
|
||||
args.shape = args.shape or beautiful.task_preview_widget_shape or nil
|
||||
args.bg = args.bg or beautiful.task_preview_widget_bg or "#000000"
|
||||
args.border_width = args.border_width or beautiful.task_preview_widget_border_width or nil
|
||||
args.border_color = args.border_color or beautiful.task_preview_widget_border_color or "#ffffff"
|
||||
args.image_shape = args.image_shape or beautiful.task_preview_image_shape or nil
|
||||
args.border_width = args.border_width or
|
||||
beautiful.task_preview_widget_border_width or nil
|
||||
args.border_color = args.border_color or
|
||||
beautiful.task_preview_widget_border_color or
|
||||
"#ffffff"
|
||||
args.image_shape = args.image_shape or beautiful.task_preview_image_shape or
|
||||
nil
|
||||
|
||||
local ret = gobject {}
|
||||
ret._private = {}
|
||||
|
@ -193,15 +193,14 @@ local function new(args)
|
|||
gtable.crush(ret, task_preview)
|
||||
gtable.crush(ret, args)
|
||||
|
||||
ret._private.widget = awful.popup
|
||||
{
|
||||
ret._private.widget = awful.popup {
|
||||
type = ret.type,
|
||||
visible = false,
|
||||
ontop = true,
|
||||
placement = ret.placement,
|
||||
input_passthrough = ret.input_passthrough,
|
||||
bg = "#00000000",
|
||||
widget = wibox.container.background, -- A dummy widget to make awful.popup not scream
|
||||
widget = wibox.container.background -- A dummy widget to make awful.popup not scream
|
||||
}
|
||||
|
||||
capi.tag.connect_signal("property::selected", function(t)
|
||||
|
@ -223,37 +222,16 @@ local function new(args)
|
|||
end)
|
||||
|
||||
return ret
|
||||
|
||||
-- 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
|
||||
-- )
|
||||
-- else
|
||||
-- task_preview_box.widget = nil
|
||||
-- collectgarbage("collect")
|
||||
-- end
|
||||
|
||||
-- if not placement_fn then
|
||||
-- task_preview_box.x = s.geometry.x + widget_x
|
||||
-- task_preview_box.y = s.geometry.y + widget_y
|
||||
-- end
|
||||
|
||||
-- task_preview_box.visible = v
|
||||
-- end)
|
||||
end
|
||||
|
||||
function task_preview.mt:__call(...)
|
||||
return new(...)
|
||||
end
|
||||
function task_preview.mt:__call(...) return new(...) end
|
||||
|
||||
awesome.connect_signal("bling::task_preview::visibility", function(_, _, _)
|
||||
naughty.notify {
|
||||
title = "Bling Task Preview",
|
||||
urgency = "normal",
|
||||
message = "This method of activating the task preview has been deprecated. https://blingcorp.github.io/bling/#/widgets/task_preview"
|
||||
}
|
||||
end)
|
||||
|
||||
return setmetatable(task_preview, task_preview.mt)
|
||||
|
|
Loading…
Reference in New Issue