Dismiss the notification without triggering default action on right-click
This commit is contained in:
parent
8b1f8958b4
commit
29f41d70fc
|
@ -23,6 +23,7 @@ local abutton = require("awful.button")
|
||||||
local ascreen = require("awful.screen")
|
local ascreen = require("awful.screen")
|
||||||
local gpcall = require("gears.protected_call")
|
local gpcall = require("gears.protected_call")
|
||||||
local dpi = require("beautiful").xresources.apply_dpi
|
local dpi = require("beautiful").xresources.apply_dpi
|
||||||
|
local cst = require("naughty.constants")
|
||||||
|
|
||||||
local default_widget = require("naughty.widget._default")
|
local default_widget = require("naughty.widget._default")
|
||||||
|
|
||||||
|
@ -378,18 +379,20 @@ local function new(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
--TODO remove
|
--TODO remove
|
||||||
local function hide()
|
local function hide(reason)
|
||||||
local n = ret._private.notification[1]
|
return function ()
|
||||||
|
local n = ret._private.notification[1]
|
||||||
|
|
||||||
if n then
|
if n then
|
||||||
n:destroy()
|
n:destroy()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--FIXME there's another pull request for this
|
-- On right click, close the notification without triggering the default action
|
||||||
ret:buttons(gtable.join(
|
ret:buttons(gtable.join(
|
||||||
abutton({ }, 1, hide),
|
abutton({ }, 1, hide(cst.notification_closed_reason.dismissed_by_user)),
|
||||||
abutton({ }, 3, hide)
|
abutton({ }, 3, hide(cst.notification_closed_reason.silent))
|
||||||
))
|
))
|
||||||
|
|
||||||
gtable.crush(ret, box, false)
|
gtable.crush(ret, box, false)
|
||||||
|
|
Loading…
Reference in New Issue