From aabbb412fe0aa135fb656d5aab674c44fac5fb7d Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 7 Jul 2019 16:04:17 -0400 Subject: [PATCH] naughty.action: Fix icon_only. It could not be specified in the contructor. Fix #2815 --- lib/naughty/action.lua | 6 +++ .../wibox/nwidget/actionlist/icon_only.lua | 40 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/examples/wibox/nwidget/actionlist/icon_only.lua diff --git a/lib/naughty/action.lua b/lib/naughty/action.lua index abc24c4d..17d7874f 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 00000000..483d5ba1 --- /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