Skip to content

Commit

Permalink
Merge pull request #3906 from danimateo/patch-1
Browse files Browse the repository at this point in the history
Dismiss the notification without triggering default action on right-click
  • Loading branch information
Elv13 committed Aug 27, 2024
2 parents 7034db3 + 01b0652 commit a35fced
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/naughty/layout/box.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ local abutton = require("awful.button")
local ascreen = require("awful.screen")
local gpcall = require("gears.protected_call")
local dpi = require("beautiful").xresources.apply_dpi
local cst = require("naughty.constants")

local default_widget = require("naughty.widget._default")

Expand Down Expand Up @@ -378,18 +379,20 @@ local function new(args)
end

--TODO remove
local function hide()
local n = ret._private.notification[1]
local function hide(reason)
return function ()
local n = ret._private.notification[1]

if n then
n:destroy()
if n then
n:destroy(reason)
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(
abutton({ }, 1, hide),
abutton({ }, 3, hide)
abutton({ }, 1, hide(cst.notification_closed_reason.dismissed_by_user)),
abutton({ }, 3, hide(cst.notification_closed_reason.silent))
))

gtable.crush(ret, box, false)
Expand Down

0 comments on commit a35fced

Please sign in to comment.