aboutsummaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-05-01 23:41:54 +0530
committerAkshay Nair <phenax5@gmail.com>2025-05-02 16:21:45 +0530
commit9c812753e2b1f01b2e0c85be9904ff7694f0e6ec (patch)
treef308228c63fc8eeb526c901e80746d8da633b352 /init.lua
parentf0faa92246c1f5fc58546051ace2d047869447df (diff)
downloadnull-browser-9c812753e2b1f01b2e0c85be9904ff7694f0e6ec.tar.gz
null-browser-9c812753e2b1f01b2e0c85be9904ff7694f0e6ec.zip
Implement NotificationReceived event
Diffstat (limited to '')
-rw-r--r--init.lua14
1 files changed, 12 insertions, 2 deletions
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...')