diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-05-01 23:41:54 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-05-02 16:21:45 +0530 |
| commit | 9c812753e2b1f01b2e0c85be9904ff7694f0e6ec (patch) | |
| tree | f308228c63fc8eeb526c901e80746d8da633b352 /init.lua | |
| parent | f0faa92246c1f5fc58546051ace2d047869447df (diff) | |
| download | null-browser-9c812753e2b1f01b2e0c85be9904ff7694f0e6ec.tar.gz null-browser-9c812753e2b1f01b2e0c85be9904ff7694f0e6ec.zip | |
Implement NotificationReceived event
Diffstat (limited to '')
| -rw-r--r-- | init.lua | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -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...') |
