naughty: Plug to the permission system.
This allows to control which kind of icon actions can be done on individual notifications. Once the second part of the permission system will be merged, this will mostly be used in `ruled.notification`.
This commit is contained in:
parent
4492a37885
commit
9601cf4a89
|
@ -23,6 +23,7 @@ local gfs = require("gears.filesystem")
|
|||
local cst = require("naughty.constants")
|
||||
local naughty = require("naughty.core")
|
||||
local gdebug = require("gears.debug")
|
||||
local pcommon = require("awful.permissions._common")
|
||||
|
||||
local notification = {}
|
||||
|
||||
|
@ -648,7 +649,8 @@ for _, prop in ipairs { "category", "resident" } do
|
|||
end
|
||||
|
||||
-- Stop the request::icon when one is found.
|
||||
local function request_filter(self, _, _)
|
||||
local function request_filter(self, context, _)
|
||||
if not pcommon.check(self, "notification", "icon", context) then return true end
|
||||
if self._private.icon then return true end
|
||||
end
|
||||
|
||||
|
@ -1011,6 +1013,22 @@ local function create(args)
|
|||
return n
|
||||
end
|
||||
|
||||
--- Grant a permission for a notification.
|
||||
--
|
||||
-- @method grant
|
||||
-- @tparam string permission The permission name (just the name, no `request::`).
|
||||
-- @tparam string context The reason why this permission is requested.
|
||||
-- @see awful.permissions
|
||||
|
||||
--- Deny a permission for a notification
|
||||
--
|
||||
-- @method deny
|
||||
-- @tparam string permission The permission name (just the name, no `request::`).
|
||||
-- @tparam string context The reason why this permission is requested.
|
||||
-- @see awful.permissions
|
||||
|
||||
pcommon.setup_grant(notification, "notification")
|
||||
|
||||
-- This allows notification to be updated later.
|
||||
local counter = 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue