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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
------------------------------------------------------------------------------
-- luakit configuration file, more information at https://luakit.github.io/ --
------------------------------------------------------------------------------
require "lfs"
-- This might cause confusing behaviors with used along with session management
-- and one want to be able to run simultaneous instances with different sessions
--require "unique_instance"
-- Set the number of web processes to use. A value of 0 means 'no limit'.
luakit.process_limit = 0
-- Set the cookie storage location
soup.cookies_storage = luakit.data_dir .. "/cookies.db"
-- Load library of useful functions for luakit
local lousy = require "lousy"
-- Load users theme
-- ("$XDG_CONFIG_HOME/luakit/theme.lua" or "/etc/xdg/luakit/theme.lua")
lousy.theme.init(lousy.util.find_config("theme.lua"))
assert(lousy.theme.get(), "failed to load theme")
-- Load users window class
-- ("$XDG_CONFIG_HOME/luakit/window.lua" or "/etc/xdg/luakit/window.lua")
local window = require "window"
-- Load users webview class
-- ("$XDG_CONFIG_HOME/luakit/webview.lua" or "/etc/xdg/luakit/webview.lua")
local webview = require "webview"
-- Add luakit;//log/ chrome page
local log_chrome = require "log_chrome"
window.add_signal("build", function (w)
local widgets, l, r = require "lousy.widget", w.sbar.l, w.sbar.r
-- Left-aligned status bar widgets
l.layout:pack(widgets.uri())
l.layout:pack(widgets.hist())
l.layout:pack(widgets.progress())
-- Right-aligned status bar widgets
r.layout:pack(widgets.buf())
r.layout:pack(log_chrome.widget())
r.layout:pack(widgets.ssl())
r.layout:pack(widgets.tabi())
r.layout:pack(widgets.scroll())
end)
-- Load luakit binds and modes
local modes = require "modes"
local binds = require "binds"
local settings = require "settings"
require "settings_chrome"
----------------------------------
-- Optional user script loading --
----------------------------------
-- Add adblock
local adblock = require "adblock"
local adblock_chrome = require "adblock_chrome"
local webinspector = require "webinspector"
-- Add uzbl-like form filling
local formfiller = require "formfiller"
-- Add proxy support & manager
local proxy = require "proxy"
-- Add quickmarks support & manager
local quickmarks = require "quickmarks"
-- Add session saving/loading support
local session = require "session"
-- Add command to list closed tabs & bind to open closed tabs
local undoclose = require "undoclose"
-- Add command to list tab history items
local tabhistory = require "tabhistory"
-- Add greasemonkey-like javascript userscript support
local userscripts = require "userscripts"
-- Add bookmarks support
local bookmarks = require "bookmarks"
local bookmarks_chrome = require "bookmarks_chrome"
-- Add download support
local downloads = require "downloads"
local downloads_chrome = require "downloads_chrome"
-- Add automatic PDF downloading and opening
local viewpdf = require "viewpdf"
-- Example using xdg-open for opening downloads / showing download folders
downloads.add_signal("open-file", function (file)
luakit.spawn(string.format("xdg-open %q", file))
return true
end)
-- Add vimperator-like link hinting & following
local follow = require "follow"
-- Add command history
local cmdhist = require "cmdhist"
-- Add search mode & binds
local search = require "search"
-- Add ordering of new tabs
local taborder = require "taborder"
-- Add grouping of tabs
local tabgroups = require "tabgroups"
-- Save web history
local history = require "history"
local history_chrome = require "history_chrome"
local help_chrome = require "help_chrome"
local binds_chrome = require "binds_chrome"
-- Add command completion
local completion = require "completion"
-- Press Control-E while in insert mode to edit the contents of the currently
-- focused <textarea> or <input> element, using `xdg-open`
local open_editor = require "open_editor"
-- NoScript plugin, toggle scripts and or plugins on a per-domain basis.
-- `,ts` to toggle scripts, `,tp` to toggle plugins, `,tr` to reset.
-- If you use this module, don't use any site-specific `enable_scripts` or
-- `enable_plugins` settings, as these will conflict.
--require "noscript"
local follow_selected = require "follow_selected"
local go_input = require "go_input"
local go_next_prev = require "go_next_prev"
local go_up = require "go_up"
-- Filter Referer HTTP header if page domain does not match Referer domain
require_web_module("referer_control_wm")
local error_page = require "error_page"
-- Add userstyles loader
local styles = require "styles"
-- Hide scrollbars on all pages
local hide_scrollbars = require "hide_scrollbars"
-- Add a stylesheet when showing images
local image_css = require "image_css"
-- Add a new tab page
local newtab_chrome = require "newtab_chrome"
-- Add tab favicons mod
local tab_favicons = require "tab_favicons"
-- Add :view-source command
local view_source = require "view_source"
-- Load sessions
local sessions = require "sessions"
-- Custom keys
local keys = require "keys"
-- Globals
local userprefs = require "userprefs"
-----------------------------
-- End user script loading --
-----------------------------
-- Restore last saved session
--local w = (not luakit.nounique) and (session and session.restore())
--if w then
-- for i, uri in ipairs(uris) do
-- w:new_tab(uri, { switch = i == 1 })
-- end
--else
-- -- Or open new window
-- window.new(uris)
--end
-- Session environment variable
local luakit_session = os.getenv("LUAKIT_SESSION")
-- Check if session was requested, otherwise open uris
if luakit_session then
local path = basedir() .. "/luakit/sessions/"
local session = require "session"
local file = path .. luakit_session
if not lfs.attributes(path) then lfs.mkdir(path) end
session.session_file = file
session.restore(false)
else
window.new(uris)
end
-- vim: et:sw=4:ts=8:sts=4:tw=80
|