aboutsummaryrefslogtreecommitdiff
path: root/init.lua
blob: 43b841f65f3bcde72cb33c1b674ae07f0fd636d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
print('hello starting up...')

web.set('new_view_url', 'https://lite.duckduckgo.com')
web.set('close_window_when_no_views', true)
web.set('user_agent',
  'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36')
web.set('downloads_dir', os.getenv('HOME') .. '/Downloads/firefox')

local history = require 'null-browser.extras.history'
history.attach_hooks()

local search_engines = require 'null-browser.extras.search-engines'
search_engines.urls['ld'] = 'https://lite.duckduckgo.com/?q={}'

local Dmenu = require 'null-browser.extras.dmenu'
local menu = Dmenu:new {
  command = os.getenv('HOME') .. '/scripts/fzfmenu.sh',
  prompt_arg = '--prompt',
  query_arg = '-q',
  args = { 'input', '--layout=default' },
}

require 'null-browser.defaults.vi'.setup {
  menu = menu,
  history = history,
  transform_url_input = search_engines.transform_url_input,
}

web.set('permissions_persistance', 'never')

web.event.add_listener('NotificationReceived', {
  callback = function(event)
    -- TODO: Add action/click (-A)
    local args = { '-a', 'null-browser', '-r', event.tag, event.title, event.message }
    web.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...')