diff --git a/lib/naughty/action.lua b/lib/naughty/action.lua index abc24c4da..17d7874fe 100644 --- a/lib/naughty/action.lua +++ b/lib/naughty/action.lua @@ -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 diff --git a/tests/examples/wibox/nwidget/actionlist/icon_only.lua b/tests/examples/wibox/nwidget/actionlist/icon_only.lua new file mode 100644 index 000000000..483d5ba10 --- /dev/null +++ b/tests/examples/wibox/nwidget/actionlist/icon_only.lua @@ -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