From 28a6468f37dc6d909e1f5d065c4a47f17d2a741a Mon Sep 17 00:00:00 2001 From: Da Risk Date: Fri, 2 Jan 2015 21:02:12 +0100 Subject: [PATCH] naughty: make sendNotificationClosed() and sendActionInvoked() local --- lib/naughty.lua.in | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index befab40f..3c2fb072 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -258,6 +258,20 @@ local function getById(id) end end +local function sendActionInvoked(notificationId, action) + res = capi.dbus.emit_signal("session", "/org/freedesktop/Notifications", + "org.freedesktop.Notifications", "ActionInvoked", + "i", notificationId, + "s", action) +end + +local function sendNotificationClosed(notificationId, reason) + res = capi.dbus.emit_signal("session", "/org/freedesktop/Notifications", + "org.freedesktop.Notifications", "NotificationClosed", + "i", notificationId, + "i", reason) +end + --- Create notification. args is a dictionary of (optional) arguments. -- @param text Text of the notification. Default: '' -- @param title Title of the notification. Default: nil @@ -449,11 +463,11 @@ function naughty.notify(args) actionmarginbox:buttons(util.table.join( button({ }, 1, function() sendActionInvoked(notification.id, actionid) - die(2) + die(notificationClosedReason.dismissedByUser) end), button({ }, 3, function() sendActionInvoked(notification.id, actionid) - die(2) + die(notificationClosedReason.dismissedByUser) end)) ) actionslayout:add(actionmarginbox) @@ -690,7 +704,7 @@ if capi.dbus then elseif data.member == "CloseNotification" then local obj = getById(appname) if obj then - sendNotificationClosed(obj.id, 3) + sendNotificationClosed(obj.id, notificationClosedReason.dismissedByCommand) naughty.destroy(obj) end elseif data.member == "GetServerInfo" or data.member == "GetServerInformation" then @@ -762,20 +776,6 @@ if capi.dbus then capi.dbus.request_name("session", "org.freedesktop.Notifications") end -function sendActionInvoked(notificationId, action) - res = capi.dbus.emit_signal("session", "/org/freedesktop/Notifications", - "org.freedesktop.Notifications", "ActionInvoked", - "i", notificationId, - "s", action) -end - -function sendNotificationClosed(notificationId, reason) - res = capi.dbus.emit_signal("session", "/org/freedesktop/Notifications", - "org.freedesktop.Notifications", "NotificationClosed", - "i", notificationId, - "i", reason) -end - return naughty -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80