naughty.action: Fix icon_only.

It could not be specified in the contructor.

Fix #2815
This commit is contained in:
Emmanuel Lepage Vallee 2019-07-07 16:04:17 -04:00
parent d699968475
commit aabbb412fe
2 changed files with 46 additions and 0 deletions

View File

@ -44,6 +44,9 @@ local action = {}
-- @tparam gears.surface|string icon
--- If the action should hide the label and only display the icon.
--
-- @DOC_wibox_nwidget_actionlist_icon_only_EXAMPLE@
--
-- @property icon_only
-- @param[opt=false] boolean
@ -125,10 +128,13 @@ local function new(_, args)
position = args.position,
icon = args.icon,
notification = args.notification,
icon_only = args.icon_only or false,
}
rawset(ret, "_private", default)
gtable.crush(ret, args)
return ret
end

View File

@ -0,0 +1,40 @@
--DOC_GEN_IMAGE
local parent = ... --DOC_HIDE --DOC_NO_USAGE
local naughty = { --DOC_HIDE
list = {actions = require("naughty.list.actions")}, --DOC_HIDE
notification = require("naughty.notification"), --DOC_HIDE
action = require("naughty.action") --DOC_HIDE
} --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local beautiful = require("beautiful") --DOC_HIDE
local notif = naughty.notification {
title = "A notification",
message = "This notification has actions!",
actions = {
naughty.action {
name = "Accept",
icon = beautiful.awesome_icon,
icon_only = true,
},
naughty.action {
name = "Refuse",
icon = beautiful.awesome_icon,
icon_only = true,
},
naughty.action {
name = "Ignore",
icon = beautiful.awesome_icon,
icon_only = true,
},
}
}
--DOC_NEWLINE
parent:add( wibox.container.background(--DOC_HIDE
wibox.widget {
notification = notif,
widget = naughty.list.actions,
}
,beautiful.bg_normal)) --DOC_HIDE