userconf.lua 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. --- userconf.lua
  2. local downloads = require "downloads"
  3. downloads.default_dir = os.getenv("HOME") .. "/tmp"
  4. downloads.add_signal("download-location", function (uri, file)
  5. if not file or file == "" then
  6. file = (string.match(uri, "/([^/]+)$")
  7. or string.match(uri, "^%w+://(.+)")
  8. or string.gsub(uri, "/", "_")
  9. or "untitled")
  10. end
  11. return downloads.default_dir .. "/" .. file
  12. end)
  13. local settings = require "settings"
  14. settings.window.scroll_step = 40
  15. settings.window.zoom_step = 0.1
  16. settings.window.search_engines.searx = "https://search.unbl.ink/search?q=%s"
  17. settings.window.default_search_engine = "searx"
  18. settings.webview.enable_smooth_scrolling = true
  19. settings.webview.zoom_level = 110
  20. settings.webview.enable_webgl = true
  21. local follow = require "follow"
  22. follow.fontsize = "16px monospace"
  23. follow.stylesheet = [===[
  24. #luakit_select_overlay .hint_label {
  25. display:block;
  26. position:absolute;
  27. font-size: 14px;
  28. padding:3px;
  29. color:black;
  30. margin-top:10px;
  31. background-color:yellow;
  32. opacity:0.7;
  33. }
  34. ]===]
  35. local select = require "select"
  36. select.label_maker = function ()
  37. local chars = charset("abcefghjklnoprstuvw")
  38. return trim(sort(reverse(chars)))
  39. end
  40. local modes = require "modes"
  41. modes.add_binds("normal", {{
  42. "c",
  43. "Copy selected text.",
  44. function ()
  45. luakit.selection.clipboard = luakit.selection.primary
  46. end
  47. }})
  48. --- local unique_instance = require "unique_instance"
  49. --- unique_instance.open_links_in_new_window = true
  50. --local history require "history"
  51. --history.db_path = "~/var/luakit-history.sqlite"
  52. local add_cmds = modes.add_cmds
  53. local actions = {
  54. adblock_update = {
  55. desc = "Update adblock from easylist official site",
  56. func = function (w)
  57. local url = "https://easylist-downloads.adblockplus.org/easylist.txt"
  58. local dir = os.getenv("HOME") .. "/.local/share/luakit/adblock"
  59. downloads.add (url)
  60. os.rename(downloads.default_dir .. "/easylist.txt", dir .. "/easylist.txt")
  61. end,
  62. }
  63. }
  64. add_cmds({{":adblock-update", actions.adblock_update },})