From 9c812753e2b1f01b2e0c85be9904ff7694f0e6ec Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Thu, 1 May 2025 23:41:54 +0530 Subject: Implement NotificationReceived event --- init.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index af0458c..bbffb50 100644 --- a/init.lua +++ b/init.lua @@ -23,8 +23,7 @@ web.event.add_listener('PermissionRequested', { callback = function(event) dmenu.select({ 'Allow', 'Deny' }, { prompt = 'Requesting permission for ' .. event.permission_type }, function(err, choice) - if err then return print('-- x permission ignored') end - print('----- permission', event.permission_type, web.inspect(choice)) + if err then return end if web.utils.string_trim(choice) == 'Allow' then event.accept() else @@ -34,4 +33,15 @@ web.event.add_listener('PermissionRequested', { end, }) +web.event.add_listener('NotificationReceived', { + callback = function(event) + local args = { '-a', 'null-browser', '-r', event.tag, event.title, event.message } + uv.spawn('notify-send', { args = args }, function(code) + if code ~= 0 then + print('[notify-send] Exit with status code: ' .. code) + end + end) + end, +}) + print('ending...') -- cgit v1.3.1