Merge pull request #899 from Jajauma/naughty-action-text
naughty: display improvement of the notification client actions
This commit is contained in:
commit
eea8de5057
|
@ -543,7 +543,7 @@ function naughty.notify(args)
|
||||||
actionmarginbox:set_widget(actiontextbox)
|
actionmarginbox:set_widget(actiontextbox)
|
||||||
actiontextbox:set_valign("middle")
|
actiontextbox:set_valign("middle")
|
||||||
actiontextbox:set_font(font)
|
actiontextbox:set_font(font)
|
||||||
actiontextbox:set_markup(string.format('<b>%s</b>', action))
|
actiontextbox:set_markup(string.format('☛ <u>%s</u>', action))
|
||||||
-- calculate the height and width
|
-- calculate the height and width
|
||||||
local w, h = actiontextbox:get_preferred_size(s)
|
local w, h = actiontextbox:get_preferred_size(s)
|
||||||
local action_height = h + 2 * margin
|
local action_height = h + 2 * margin
|
||||||
|
|
|
@ -137,24 +137,20 @@ capi.dbus.connect_signal("org.freedesktop.Notifications", function (data, appnam
|
||||||
if actions then
|
if actions then
|
||||||
args.actions = {}
|
args.actions = {}
|
||||||
|
|
||||||
local actionid
|
for i = 1,#actions,2 do
|
||||||
-- create actions callbacks
|
local action_id = actions[i]
|
||||||
for i , v in ipairs(actions) do
|
local action_text = actions[i + 1]
|
||||||
if i % 2 == 1 then
|
|
||||||
actionid = v
|
if action_id == "default" then
|
||||||
elseif actionid == "default" then
|
|
||||||
args.run = function()
|
args.run = function()
|
||||||
sendActionInvoked(notification.id, "default")
|
sendActionInvoked(notification.id, "default")
|
||||||
naughty.destroy(notification, naughty.notificationClosedReason.dismissedByUser)
|
naughty.destroy(notification, naughty.notificationClosedReason.dismissedByUser)
|
||||||
end
|
end
|
||||||
actionid = nil
|
elseif action_id ~= nil and action_text ~= nil then
|
||||||
elseif actionid ~= nil then
|
args.actions[action_text] = function()
|
||||||
local action = actionid
|
sendActionInvoked(notification.id, action_id)
|
||||||
args.actions[actionid] = function()
|
|
||||||
sendActionInvoked(notification.id, action)
|
|
||||||
naughty.destroy(notification, naughty.notificationClosedReason.dismissedByUser)
|
naughty.destroy(notification, naughty.notificationClosedReason.dismissedByUser)
|
||||||
end
|
end
|
||||||
actionid = nil
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue