1 ------------------------------------------------------------------------------
2 -- luakit configuration file, more information at https://luakit.github.io/ --
3 ------------------------------------------------------------------------------
7 require "unique_instance"
9 -- Set the number of web processes to use. A value of 0 means 'no limit'.
10 luakit.process_limit = 4
11 -- Set the cookie storage location
12 soup.cookies_storage = luakit.data_dir .. "/cookies.db"
14 -- Load library of useful functions for luakit
15 local lousy = require "lousy"
18 -- ("$XDG_CONFIG_HOME/luakit/theme.lua" or "/etc/xdg/luakit/theme.lua")
19 lousy.theme.init(lousy.util.find_config("theme.lua"))
20 assert(lousy.theme.get(), "failed to load theme")
22 -- Load users window class
23 -- ("$XDG_CONFIG_HOME/luakit/window.lua" or "/etc/xdg/luakit/window.lua")
24 local window = require "window"
26 -- Load users webview class
27 -- ("$XDG_CONFIG_HOME/luakit/webview.lua" or "/etc/xdg/luakit/webview.lua")
28 local webview = require "webview"
30 -- Add luakit;//log/ chrome page
31 local log_chrome = require "log_chrome"
33 window.add_signal("build", function (w)
34 local widgets, l, r = require "lousy.widget", w.sbar.l, w.sbar.r
36 -- Left-aligned status bar widgets
37 l.layout:pack(widgets.uri())
38 l.layout:pack(widgets.hist())
39 l.layout:pack(widgets.progress())
41 -- Right-aligned status bar widgets
42 r.layout:pack(widgets.buf())
43 r.layout:pack(log_chrome.widget())
44 r.layout:pack(widgets.ssl())
45 r.layout:pack(widgets.tabi())
46 r.layout:pack(widgets.scroll())
49 -- Load luakit binds and modes
50 local modes = require "modes"
51 local binds = require "binds"
53 local settings = require "settings"
54 require "settings_chrome"
56 ----------------------------------
57 -- Optional user script loading --
58 ----------------------------------
61 local adblock = require "adblock"
62 local adblock_chrome = require "adblock_chrome"
64 local webinspector = require "webinspector"
66 -- Add uzbl-like form filling
67 local formfiller = require "formfiller"
69 -- Add proxy support & manager
70 local proxy = require "proxy"
72 -- Add quickmarks support & manager
73 local quickmarks = require "quickmarks"
75 -- Add session saving/loading support
76 local session = require "session"
78 -- Add command to list closed tabs & bind to open closed tabs
79 local undoclose = require "undoclose"
81 -- Add command to list tab history items
82 local tabhistory = require "tabhistory"
84 -- Add greasemonkey-like javascript userscript support
85 local userscripts = require "userscripts"
87 -- Add bookmarks support
88 local bookmarks = require "bookmarks"
89 local bookmarks_chrome = require "bookmarks_chrome"
91 -- Add download support
92 local downloads = require "downloads"
93 local downloads_chrome = require "downloads_chrome"
95 -- Add automatic PDF downloading and opening
96 local viewpdf = require "viewpdf"
98 -- Example using xdg-open for opening downloads / showing download folders
99 downloads.add_signal("open-file", function (file)
100 luakit.spawn(string.format("xdg-open %q", file))
104 -- Add vimperator-like link hinting & following
105 local follow = require "follow"
107 -- Add command history
108 local cmdhist = require "cmdhist"
110 -- Add search mode & binds
111 local search = require "search"
113 -- Add ordering of new tabs
114 local taborder = require "taborder"
117 local history = require "history"
118 local history_chrome = require "history_chrome"
120 local help_chrome = require "help_chrome"
121 local binds_chrome = require "binds_chrome"
123 -- Add command completion
124 local completion = require "completion"
126 -- Press Control-E while in insert mode to edit the contents of the currently
127 -- focused <textarea> or <input> element, using `xdg-open`
128 local open_editor = require "open_editor"
130 -- NoScript plugin, toggle scripts and or plugins on a per-domain basis.
131 -- `,ts` to toggle scripts, `,tp` to toggle plugins, `,tr` to reset.
132 -- If you use this module, don't use any site-specific `enable_scripts` or
133 -- `enable_plugins` settings, as these will conflict.
136 local follow_selected = require "follow_selected"
137 local go_input = require "go_input"
138 local go_next_prev = require "go_next_prev"
139 local go_up = require "go_up"
141 -- Filter Referer HTTP header if page domain does not match Referer domain
142 require_web_module("referer_control_wm")
144 local error_page = require "error_page"
146 -- Add userstyles loader
147 local styles = require "styles"
149 -- Hide scrollbars on all pages
150 local hide_scrollbars = require "hide_scrollbars"
152 -- Add a stylesheet when showing images
153 local image_css = require "image_css"
155 -- Add a new tab page
156 local newtab_chrome = require "newtab_chrome"
158 -- Add tab favicons mod
159 local tab_favicons = require "tab_favicons"
161 -- Add :view-source command
162 local view_source = require "view_source"
164 -----------------------------
165 -- End user script loading --
166 -----------------------------
168 settings.window.search_engines = {
169 ddg = "https://duckduckgo.com/?q=%s",
170 gh = "https://github.com/search?q=%s",
171 w = "https://en.wikipedia.org/wiki/Special:Search?search=%s"
173 settings.window.search_engines.default = settings.window.search_engines.ddg
176 require("lousy.widget.tab").label_format = '<span foreground="{index_fg}" font-weight="bold">{index}</span> {title}'
178 -- Restore last saved session
179 local w = (not luakit.nounique) and (session and session.restore())
181 for i, uri in ipairs(uris) do
182 w:new_tab(uri, { switch = i == 1 })
185 -- Or open new window
189 -- vim: et:sw=4:ts=8:sts=4:tw=80