]>
Commit | Line | Data |
---|---|---|
03bc64c4 | 1 | ------------------------------------------------------------------------------ |
2 | -- luakit configuration file, more information at https://luakit.github.io/ -- | |
3 | ------------------------------------------------------------------------------ | |
4 | ||
5 | require "lfs" | |
6 | ||
7 | require "unique_instance" | |
8 | ||
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" | |
13 | ||
14 | -- Load library of useful functions for luakit | |
15 | local lousy = require "lousy" | |
16 | ||
17 | -- Load users theme | |
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") | |
21 | ||
22 | -- Load users window class | |
23 | -- ("$XDG_CONFIG_HOME/luakit/window.lua" or "/etc/xdg/luakit/window.lua") | |
24 | local window = require "window" | |
25 | ||
26 | -- Load users webview class | |
27 | -- ("$XDG_CONFIG_HOME/luakit/webview.lua" or "/etc/xdg/luakit/webview.lua") | |
28 | local webview = require "webview" | |
29 | ||
30 | -- Add luakit;//log/ chrome page | |
31 | local log_chrome = require "log_chrome" | |
32 | ||
33 | window.add_signal("build", function (w) | |
34 | local widgets, l, r = require "lousy.widget", w.sbar.l, w.sbar.r | |
35 | ||
36 | -- Left-aligned status bar widgets | |
37 | l.layout:pack(widgets.uri()) | |
38 | l.layout:pack(widgets.hist()) | |
39 | l.layout:pack(widgets.progress()) | |
40 | ||
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()) | |
47 | end) | |
48 | ||
49 | -- Load luakit binds and modes | |
50 | local modes = require "modes" | |
51 | local binds = require "binds" | |
52 | ||
53 | local settings = require "settings" | |
54 | require "settings_chrome" | |
55 | ||
56 | ---------------------------------- | |
57 | -- Optional user script loading -- | |
58 | ---------------------------------- | |
59 | ||
60 | -- Add adblock | |
61 | local adblock = require "adblock" | |
62 | local adblock_chrome = require "adblock_chrome" | |
63 | ||
64 | local webinspector = require "webinspector" | |
65 | ||
66 | -- Add uzbl-like form filling | |
67 | local formfiller = require "formfiller" | |
68 | ||
69 | -- Add proxy support & manager | |
70 | local proxy = require "proxy" | |
71 | ||
72 | -- Add quickmarks support & manager | |
73 | local quickmarks = require "quickmarks" | |
74 | ||
75 | -- Add session saving/loading support | |
76 | local session = require "session" | |
77 | ||
78 | -- Add command to list closed tabs & bind to open closed tabs | |
79 | local undoclose = require "undoclose" | |
80 | ||
81 | -- Add command to list tab history items | |
82 | local tabhistory = require "tabhistory" | |
83 | ||
84 | -- Add greasemonkey-like javascript userscript support | |
85 | local userscripts = require "userscripts" | |
86 | ||
87 | -- Add bookmarks support | |
88 | local bookmarks = require "bookmarks" | |
89 | local bookmarks_chrome = require "bookmarks_chrome" | |
90 | ||
91 | -- Add download support | |
92 | local downloads = require "downloads" | |
93 | local downloads_chrome = require "downloads_chrome" | |
94 | ||
95 | -- Add automatic PDF downloading and opening | |
96 | local viewpdf = require "viewpdf" | |
97 | ||
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)) | |
101 | return true | |
102 | end) | |
103 | ||
104 | -- Add vimperator-like link hinting & following | |
105 | local follow = require "follow" | |
106 | ||
107 | -- Add command history | |
108 | local cmdhist = require "cmdhist" | |
109 | ||
110 | -- Add search mode & binds | |
111 | local search = require "search" | |
112 | ||
113 | -- Add ordering of new tabs | |
114 | local taborder = require "taborder" | |
115 | ||
116 | -- Save web history | |
117 | local history = require "history" | |
118 | local history_chrome = require "history_chrome" | |
119 | ||
120 | local help_chrome = require "help_chrome" | |
121 | local binds_chrome = require "binds_chrome" | |
122 | ||
123 | -- Add command completion | |
124 | local completion = require "completion" | |
125 | ||
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" | |
129 | ||
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. | |
134 | require "noscript" | |
135 | ||
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" | |
140 | ||
141 | -- Filter Referer HTTP header if page domain does not match Referer domain | |
142 | require_web_module("referer_control_wm") | |
143 | ||
144 | local error_page = require "error_page" | |
145 | ||
146 | -- Add userstyles loader | |
147 | local styles = require "styles" | |
148 | ||
149 | -- Hide scrollbars on all pages | |
150 | local hide_scrollbars = require "hide_scrollbars" | |
151 | ||
152 | -- Add a stylesheet when showing images | |
153 | local image_css = require "image_css" | |
154 | ||
155 | -- Add a new tab page | |
156 | local newtab_chrome = require "newtab_chrome" | |
157 | ||
158 | -- Add tab favicons mod | |
159 | local tab_favicons = require "tab_favicons" | |
160 | ||
161 | -- Add :view-source command | |
162 | local view_source = require "view_source" | |
163 | ||
164 | ----------------------------- | |
165 | -- End user script loading -- | |
166 | ----------------------------- | |
167 | ||
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" | |
172 | } | |
173 | settings.window.search_engines.default = settings.window.search_engines.ddg | |
174 | ||
118fb6e0 | 175 | -- change tab text |
176 | require("lousy.widget.tab").label_format = '<span foreground="{index_fg}" font-weight="bold">{index}</span> {title}' | |
03bc64c4 | 177 | |
178 | -- Restore last saved session | |
179 | local w = (not luakit.nounique) and (session and session.restore()) | |
180 | if w then | |
181 | for i, uri in ipairs(uris) do | |
182 | w:new_tab(uri, { switch = i == 1 }) | |
183 | end | |
184 | else | |
185 | -- Or open new window | |
186 | window.new(uris) | |
187 | end | |
188 | ||
189 | -- vim: et:sw=4:ts=8:sts=4:tw=80 |