Lua config: Reformat with tabs and more consistent style

master
Pierre Neidhardt 2014-11-12 19:41:10 +01:00
parent d13548540a
commit a5e40117a5
4 changed files with 534 additions and 538 deletions

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,8 @@ theme.border_marked = "#91231c"
-- There are other variable sets
-- overriding the default one when
-- defined, the sets are:
-- [taglist|tasklist]_[bg|fg]_[focus|urgent]
-- taglist_[bg|fg]_[focus|urgent|occupied|empty]
-- tasklist_[bg|fg]_[focus|urgent]
-- titlebar_[bg|fg]_[normal|focus]
-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
-- mouse_finder_[color|timeout|animate_timeout|radius|factor]
@ -90,7 +91,7 @@ theme.layout_dwindle = "/usr/share/awesome/themes/default/layouts/dwindlew.png"
theme.awesome_icon = "/usr/share/awesome/icons/awesome16.png"
-- Define the icon theme for application icons. If not set then the icons
-- Define the icon theme for application icons. If not set then the icons
-- from /usr/share/icons and /usr/share/icons/hicolor will be used.
theme.icon_theme = nil

View File

@ -1,17 +1,17 @@
-- Global variables for luakit
globals = {
homepage = "about:blank",
scroll_step = 40,
zoom_step = 0.1,
max_cmd_history = 100,
max_srch_history = 100,
-- http_proxy = "http://example.com:3128",
default_window_size = "800x600",
homepage = "about:blank",
scroll_step = 40,
zoom_step = 0.1,
max_cmd_history = 100,
max_srch_history = 100,
-- http_proxy = "http://example.com:3128",
default_window_size = "800x600",
-- Disables loading of hostnames from /etc/hosts (for large host files)
-- load_etc_hosts = false,
-- Disables checking if a filepath exists in search_open function
-- check_filepath = false,
-- Disables loading of hostnames from /etc/hosts (for large host files)
-- load_etc_hosts = false,
-- Disables checking if a filepath exists in search_open function
-- check_filepath = false,
}
-- Make useragent
@ -19,22 +19,22 @@ local _, arch = luakit.spawn_sync("uname -sm")
-- Only use the luakit version if in date format (reduces identifiability)
local lkv = string.match(luakit.version, "^(%d+.%d+.%d+)")
globals.useragent = string.format("Mozilla/5.0 (%s) AppleWebKit/%s+ (KHTML, like Gecko) WebKitGTK+/%s luakit%s",
string.sub(arch, 1, -2), luakit.webkit_user_agent_version,
luakit.webkit_version, (lkv and ("/" .. lkv)) or "")
string.sub(arch, 1, -2), luakit.webkit_user_agent_version,
luakit.webkit_version, (lkv and ("/" .. lkv)) or "")
-- Search common locations for a ca file which is used for ssl connection validation.
local ca_files = {
-- $XDG_DATA_HOME/luakit/ca-certificates.crt
luakit.data_dir .. "/ca-certificates.crt",
"/etc/certs/ca-certificates.crt",
"/etc/ssl/certs/ca-certificates.crt",
-- $XDG_DATA_HOME/luakit/ca-certificates.crt
luakit.data_dir .. "/ca-certificates.crt",
"/etc/certs/ca-certificates.crt",
"/etc/ssl/certs/ca-certificates.crt",
}
-- Use the first ca-file found
for _, ca_file in ipairs(ca_files) do
if os.exists(ca_file) then
soup.ssl_ca_file = ca_file
break
end
if os.exists(ca_file) then
soup.ssl_ca_file = ca_file
break
end
end
-- Change to stop navigation sites with invalid or expired ssl certificates
@ -50,25 +50,25 @@ soup.accept_policy = cookie_policy.always
-- it to avoid collisions with lua's string.format characters.
-- See: http://www.lua.org/manual/5.1/manual.html#pdf-string.format
search_engines = {
-- duckduckgo = "http://duckduckgo.com/?q=%s",
-- luakit = "http://luakit.org/search/index/luakit?q=%s",
-- sourceforge = "http://sf.net/search/?words=%s",
arch = "http://wiki.archlinux.org/index.php?title=Special%%3ASearch&search=%s&go=Go",
aur = "https://aur.archlinux.org/packages.php?O=0&K=%s&do_Search=Go",
ctan = "http://www.ctan.org/search/?search=%s&search_type=description",
g = "http://google.com/search?q=%s",
gm = "https://maps.google.com/maps?q=%s",
gt = "http://translate.google.com/#en/fr/%s",
imdb = "http://www.imdb.com/find?s=all&q=%s",
torrent = "http://torrentz.eu/search?f=%s",
w = "http://en.wikipedia.org/wiki/Special:Search?search=%s",
wb = "http://en.wikibooks.org/wiki/Special:Search?search=%s",
wbf = "http://fr.wikibooks.org/wiki/Special:Search?search=%s",
wf = "http://fr.wikipedia.org/wiki/Special:Search?search=%s",
wkf = "http://fr.wiktionary.org/wiki/Special:Search?search=%s",
wk = "http://en.wiktionary.org/wiki/Special:Search?search=%s",
wr = "http://www.wordreference.com/enfr/%s",
youtube = "http://www.youtube.com/results?search_query=%s",
-- duckduckgo = "http://duckduckgo.com/?q=%s",
-- luakit = "http://luakit.org/search/index/luakit?q=%s",
-- sourceforge = "http://sf.net/search/?words=%s",
arch = "http://wiki.archlinux.org/index.php?title=Special%%3ASearch&search=%s&go=Go",
aur = "https://aur.archlinux.org/packages.php?O=0&K=%s&do_Search=Go",
ctan = "http://www.ctan.org/search/?search=%s&search_type=description",
g = "http://google.com/search?q=%s",
gm = "https://maps.google.com/maps?q=%s",
gt = "http://translate.google.com/#en/fr/%s",
imdb = "http://www.imdb.com/find?s=all&q=%s",
torrent = "http://torrentz.eu/search?f=%s",
w = "http://en.wikipedia.org/wiki/Special:Search?search=%s",
wb = "http://en.wikibooks.org/wiki/Special:Search?search=%s",
wbf = "http://fr.wikibooks.org/wiki/Special:Search?search=%s",
wf = "http://fr.wikipedia.org/wiki/Special:Search?search=%s",
wkf = "http://fr.wiktionary.org/wiki/Special:Search?search=%s",
wk = "http://en.wiktionary.org/wiki/Special:Search?search=%s",
wr = "http://www.wordreference.com/enfr/%s",
youtube = "http://www.youtube.com/results?search_query=%s",
}
-- Set google as fallback search engine
@ -79,20 +79,20 @@ search_engines.default = search_engines.g
-- Per-domain webview properties
-- See http://webkitgtk.org/reference/webkitgtk/stable/WebKitWebSettings.html
domain_props = { --[[
["all"] = {
enable_scripts = false,
enable_plugins = false,
enable_private_browsing = false,
user_stylesheet_uri = "",
},
["youtube.com"] = {
enable_scripts = true,
enable_plugins = true,
},
["bbs.archlinux.org"] = {
user_stylesheet_uri = "file://" .. luakit.data_dir .. "/styles/dark.css",
enable_private_browsing = true,
}, ]]
["all"] = {
enable_scripts = false,
enable_plugins = false,
enable_private_browsing = false,
user_stylesheet_uri = "",
},
["youtube.com"] = {
enable_scripts = true,
enable_plugins = true,
},
["bbs.archlinux.org"] = {
user_stylesheet_uri = "file://" .. luakit.data_dir .. "/styles/dark.css",
enable_private_browsing = true,
}, ]]
}
-- vim: et:sw=4:ts=8:sts=4:tw=80

View File

@ -5,19 +5,19 @@
require "lfs"
if unique then
unique.new("org.luakit")
-- Check for a running luakit instance
if unique.is_running() then
if uris[1] then
for _, uri in ipairs(uris) do
if lfs.attributes(uri) then uri = os.abspath(uri) end
unique.send_message("tabopen " .. uri)
end
else
unique.send_message("winopen")
end
luakit.quit()
end
unique.new("org.luakit")
-- Check for a running luakit instance
if unique.is_running() then
if uris[1] then
for _, uri in ipairs(uris) do
if lfs.attributes(uri) then uri = os.abspath(uri) end
unique.send_message("tabopen " .. uri)
end
else
unique.send_message("winopen")
end
luakit.quit()
end
end
-- Load library of useful functions for luakit
@ -25,7 +25,11 @@ require "lousy"
-- Small util functions to print output (info prints only when luakit.verbose is true)
function warn(...) io.stderr:write(string.format(...) .. "\n") end
function info(...) if luakit.verbose then io.stdout:write(string.format(...) .. "\n") end end
function info(...)
if luakit.verbose then
io.stdout:write(string.format(...) .. "\n")
end
end
-- Load users global config
-- ("$XDG_CONFIG_HOME/luakit/globals.lua" or "/etc/xdg/luakit/globals.lua")
@ -152,12 +156,12 @@ require "go_up"
-- Restore last saved session
local w = (session and session.restore())
if w then
for i, uri in ipairs(uris) do
w:new_tab(uri, i == 1)
end
for i, uri in ipairs(uris) do
w:new_tab(uri, i == 1)
end
else
-- Or open new window
window.new(uris)
-- Or open new window
window.new(uris)
end
-------------------------------------------
@ -165,17 +169,17 @@ end
-------------------------------------------
if unique then
unique.add_signal("message", function (msg, screen)
local cmd, arg = string.match(msg, "^(%S+)%s*(.*)")
local w = lousy.util.table.values(window.bywidget)[1]
if cmd == "tabopen" then
w:new_tab(arg)
elseif cmd == "winopen" then
w = window.new((arg ~= "") and { arg } or {})
end
w.win.screen = screen
w.win.urgency_hint = true
end)
unique.add_signal("message", function (msg, screen)
local cmd, arg = string.match(msg, "^(%S+)%s*(.*)")
local w = lousy.util.table.values(window.bywidget)[1]
if cmd == "tabopen" then
w:new_tab(arg)
elseif cmd == "winopen" then
w = window.new((arg ~= "") and { arg } or {})
end
w.win.screen = screen
w.win.urgency_hint = true
end)
end
--------------------------------------------------------------------------------
@ -184,16 +188,16 @@ end
-- Always save tabs before closing
local close_win = window.methods.close_win
window.methods.close_win = function (w, ...)
session.save{w}
close_win(w, ...)
session.save{w}
close_win(w, ...)
end
-- Always open in a new tab in current instance.
webview.init_funcs.window_decision = function (view, w)
view:add_signal("new-window-decision", function (v, uri, reason)
w:new_tab(uri)
return true
end)
view:add_signal("new-window-decision", function (v, uri, reason)
w:new_tab(uri)
return true
end)
end
-- Download folder.
@ -202,14 +206,14 @@ downloads.default_dir = os.getenv("HOME") .. "/temp"
-- downloads.default_dir = os.getenv("HOME")
-- end
downloads.add_signal("download-location", function (uri, file)
if not file or file == "" then
file = (string.match(uri, "/([^/]+)$")
or string.match(uri, "^%w+://(.+)")
or string.gsub(uri, "/", "_")
or "untitled")
end
return downloads.default_dir .. "/" .. file
end)
if not file or file == "" then
file = (string.match(uri, "/([^/]+)$")
or string.match(uri, "^%w+://(.+)")
or string.gsub(uri, "/", "_")
or "untitled")
end
return downloads.default_dir .. "/" .. file
end)
-- Adblock
require("adblock")