all repos — dotfiles @ 4ef5778216d93754b929aaacb93633abba5e0223

my *nix dotfiles

config/luakit/rc.lua (view raw)

  1------------------------------------------------------------------------------
  2-- luakit configuration file, more information at https://luakit.github.io/ --
  3------------------------------------------------------------------------------
  4
  5require "lfs"
  6
  7-- Check for lua configuration files that will never be loaded because they are
  8-- shadowed by builtin modules.
  9table.insert(package.loaders, 2, function (modname)
 10    if not package.searchpath then return end
 11    local f = package.searchpath(modname, package.path)
 12    if not f or f:find(luakit.install_paths.install_dir .. "/", 0, true) ~= 1 then
 13        return
 14    end
 15    local lf = luakit.config_dir .. "/" .. modname:gsub("%.","/") .. ".lua"
 16    if f == lf then
 17        msg.warn("Loading local version of '" .. modname .. "' module: " .. lf)
 18    elseif lfs.attributes(lf) then
 19        msg.warn("Found local version " .. lf
 20            .. " for core module '" .. modname
 21            .. "', but it won't be used, unless you update 'package.path' accordingly.")
 22    end
 23end)
 24
 25require "unique_instance"
 26
 27-- Set the number of web processes to use. A value of 0 means 'no limit'. This
 28-- has no effect since WebKit 2.26
 29luakit.process_limit = 4
 30-- Set the cookie storage location
 31soup.cookies_storage = luakit.data_dir .. "/cookies.db"
 32
 33-- Load library of useful functions for luakit
 34local lousy = require "lousy"
 35
 36-- Load users theme
 37-- ("$XDG_CONFIG_HOME/luakit/theme.lua" or "/etc/xdg/luakit/theme.lua")
 38lousy.theme.init(lousy.util.find_config("theme.lua"))
 39assert(lousy.theme.get(), "failed to load theme")
 40
 41-- Load users window class
 42-- ("$XDG_CONFIG_HOME/luakit/window.lua" or "/etc/xdg/luakit/window.lua")
 43local window = require "window"
 44
 45-- Load users webview class
 46-- ("$XDG_CONFIG_HOME/luakit/webview.lua" or "/etc/xdg/luakit/webview.lua")
 47local webview = require "webview"
 48
 49-- Add luakit;//log/ chrome page
 50local log_chrome = require "log_chrome"
 51
 52window.add_signal("build", function (w)
 53    local widgets, l, r = require "lousy.widget", w.sbar.l, w.sbar.r
 54
 55    -- Left-aligned status bar widgets
 56    l.layout:pack(widgets.uri())
 57    l.layout:pack(widgets.hist())
 58    l.layout:pack(widgets.progress())
 59
 60    -- Right-aligned status bar widgets
 61    r.layout:pack(widgets.buf())
 62    r.layout:pack(log_chrome.widget())
 63    r.layout:pack(widgets.ssl())
 64    r.layout:pack(widgets.tabi())
 65    r.layout:pack(widgets.scroll())
 66end)
 67
 68-- Load luakit binds and modes
 69local modes = require "modes"
 70local binds = require "binds"
 71
 72local settings = require "settings"
 73require "settings_chrome"
 74
 75----------------------------------
 76-- Optional user script loading --
 77----------------------------------
 78
 79-- Add adblock
 80local adblock = require "adblock"
 81local adblock_chrome = require "adblock_chrome"
 82
 83local webinspector = require "webinspector"
 84
 85-- Add uzbl-like form filling
 86local formfiller = require "formfiller"
 87
 88-- Add proxy support & manager
 89local proxy = require "proxy"
 90
 91-- Add cache control (clear-data, clear-favicon-db)
 92local clear_data = require "clear_data"
 93
 94-- Add quickmarks support & manager
 95local quickmarks = require "quickmarks"
 96
 97-- Add session saving/loading support
 98local session = require "session"
 99
100-- Add command to list closed tabs & bind to open closed tabs
101local undoclose = require "undoclose"
102
103-- Add command to list tab history items
104local tabhistory = require "tabhistory"
105
106-- Add command to list open tabs
107local tabmenu = require "tabmenu"
108
109-- Add gopher protocol support (this module needs luasocket)
110-- local gopher = require "gopher"
111
112-- Add greasemonkey-like javascript userscript support
113local userscripts = require "userscripts"
114
115-- Add bookmarks support
116local bookmarks = require "bookmarks"
117local bookmarks_chrome = require "bookmarks_chrome"
118
119-- Add download support
120local downloads = require "downloads"
121local downloads_chrome = require "downloads_chrome"
122
123-- Add automatic PDF downloading and opening
124local viewpdf = require "viewpdf"
125
126-- Example using xdg-open for opening downloads / showing download folders
127downloads.add_signal("open-file", function (file)
128    luakit.spawn(string.format("xdg-open %q", file))
129    return true
130end)
131
132-- Add vimperator-like link hinting & following
133local follow = require "follow"
134
135-- Add command history
136local cmdhist = require "cmdhist"
137
138-- Add search mode & binds
139local search = require "search"
140
141-- Add ordering of new tabs
142local taborder = require "taborder"
143
144-- Save web history
145local history = require "history"
146local history_chrome = require "history_chrome"
147
148local help_chrome = require "help_chrome"
149local binds_chrome = require "binds_chrome"
150
151-- Add command completion
152local completion = require "completion"
153
154-- Press Control-E while in insert mode to edit the contents of the currently
155-- focused <textarea> or <input> element, using `xdg-open`
156local open_editor = require "open_editor"
157
158-- NoScript plugin, toggle scripts and or plugins on a per-domain basis.
159-- `,ts` to toggle scripts, `,tp` to toggle plugins, `,tr` to reset.
160-- If you use this module, don't use any site-specific `enable_scripts` or
161-- `enable_plugins` settings, as these will conflict.
162--require "noscript"
163
164local follow_selected = require "follow_selected"
165local go_input = require "go_input"
166local go_next_prev = require "go_next_prev"
167local go_up = require "go_up"
168
169-- Filter Referer HTTP header if page domain does not match Referer domain
170require_web_module("referer_control_wm")
171
172local error_page = require "error_page"
173
174-- Add userstyles loader
175local styles = require "styles"
176
177-- Add a stylesheet when showing images
178local image_css = require "image_css"
179
180-- Add a new tab page
181local newtab_chrome = require "newtab_chrome"
182
183-- Add tab favicons mod
184local tab_favicons = require "tab_favicons"
185
186-- Add :view-source command
187local view_source = require "view_source"
188
189-- Put "userconf.lua" in your Luakit config dir with your own tweaks; if this is
190-- permanent, no need to copy/paste/modify the default rc.lua whenever you
191-- update Luakit.
192if pcall(function () lousy.util.find_config("userconf.lua") end) then
193    require "userconf"
194end
195
196-----------------------------
197-- End user script loading --
198-----------------------------
199
200-- Restore last saved session
201local w = (not luakit.nounique) and (session and session.restore())
202if w then
203    for i, uri in ipairs(uris) do
204        w:new_tab(uri, { switch = i == 1 })
205    end
206else
207    -- Or open new window
208    window.new(uris)
209end
210
211-- vim: et:sw=4:ts=8:sts=4:tw=80