Skip to content

Instantly share code, notes, and snippets.

@zoqaeski
Created February 28, 2013 01:52
Show Gist options
  • Save zoqaeski/5053550 to your computer and use it in GitHub Desktop.
Save zoqaeski/5053550 to your computer and use it in GitHub Desktop.
Diff between my luakit configuration and the default. Can’t find any weirdness that may cause https://github.com/mason-larobina/luakit/issues/182.
diff --git a/etc/xdg/luakit/globals.lua b/home/robbie/.config/luakit/globals.lua
index b8b4a25..14a3417 100644
--- a/etc/xdg/luakit/globals.lua
+++ b/home/robbie/.config/luakit/globals.lua
@@ -1,6 +1,6 @@
-- Global variables for luakit
globals = {
- homepage = "http://luakit.org/",
+ homepage = "http://www.questionablecontent.net/",
-- homepage = "http://github.com/mason-larobina/luakit",
scroll_step = 40,
zoom_step = 0.1,
@@ -8,6 +8,8 @@ globals = {
max_srch_history = 100,
-- http_proxy = "http://example.com:3128",
default_window_size = "800x600",
+ -- Default terminal
+ term = "/usr/bin/urxvt"
-- Disables loading of hostnames from /etc/hosts (for large host files)
-- load_etc_hosts = false,
@@ -51,11 +53,33 @@ 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 = "https://duckduckgo.com/?q=%s",
- github = "https://github.com/search?q=%s",
- google = "https://google.com/search?q=%s",
- imdb = "http://www.imdb.com/find?s=all&q=%s",
- wikipedia = "https://en.wikipedia.org/wiki/Special:Search?search=%s",
+ google = "http://google.com/search?q=%s",
+ translate = "http://translate.google.com/?source=osdd#auto|auto|%s",
+ duckduckgo = "http://duckduckgo.com/?q=%s",
+ -- Wikipedia searching
+ wikipedia = "http://en.wikipedia.org/wiki/Special:Search?search=%s",
+ wiktionary = "http://en.wiktionary.org/wiki/%s",
+ -- Arch Linux specific
+ archlinux = "https://www.archlinux.org/packages/?q=%s",
+ aur = "https://aur.archlinux.org/packages.php?O=0&K=%s&do_Search=Go",
+ archwiki = "https://wiki.archlinux.org/index.php?title=Special:Search&search=%s",
+ -- Stack Exchange sites
+ stackoverflow = "http://stackoverflow.com/search?q=%s",
+ texoverflow = "http://tex.stackexchange.com/search?q=%s",
+ -- Film and Video
+ vimeo = "http://vimeo.com/search?q=%s",
+ youtube = "http://www.youtube.com/results?search_query=%s&page={startPage?}&utm_source=opensearch",
+ dailymotion = "http://www.dailymotion.com/relevance/search/%s/1",
+ -- Others
+ flickr = "http://www.flickr.com/search/?q=%s",
+ pitchfork = "http://pitchfork.com/search/?query=%s",
+ lastfm = "http://www.last.fm/search?q=%s",
+ gumtree = "http://gumtree.com.au/s-search-results.html?keyword=%s",
+ urbandictionary = "http://www.urbandictionary.com/define.php?term=%s",
+ debbugs = "http://bugs.debian.org/%s",
+ imdb = "http://imdb.com/find?s=all&q=%s",
+ sourceforge = "http://sf.net/search/?words=%s",
}
-- Set google as fallback search engine
@@ -65,21 +89,25 @@ search_engines.default = search_engines.google
-- Per-domain webview properties
-- See http://webkitgtk.org/reference/webkitgtk/stable/WebKitWebSettings.html
-domain_props = { --[[
+domain_props = {
["all"] = {
- enable_scripts = false,
- enable_plugins = false,
+ enable_scripts = true,
+ enable_plugins = true,
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
diff --git a/etc/xdg/luakit/rc.lua b/home/robbie/.config/luakit/rc.lua
index c03a6bd..f2b0e7c 100644
--- a/etc/xdg/luakit/rc.lua
+++ b/home/robbie/.config/luakit/rc.lua
@@ -145,6 +145,9 @@ require "go_input"
require "go_next_prev"
require "go_up"
+-- Extra plugins
+require "plugins"
+
-----------------------------
-- End user script loading --
-----------------------------
@@ -178,4 +181,116 @@ if unique then
end)
end
+-------------------------------------------
+-- Key Binding
+-------------------------------------------
+
+-- Binding aliases
+local key, buf, but = lousy.bind.key, lousy.bind.buf, lousy.bind.but
+local cmd, any = lousy.bind.cmd, lousy.bind.any
+
+add_binds("all", {
+ -- Open link in new tab or navigate to selection
+ but({}, 2, [[Open link under mouse cursor in new tab or navigate to the
+ contents of `luakit.selection.primary`.]],
+ function (w, m)
+ -- Ignore button 2 clicks in form fields
+ if not m.context.editable then
+ -- Open hovered uri in new tab
+ local uri = w.view.hovered_uri
+ if uri then
+ w:new_tab(uri, false)
+ end
+ end
+ end
+ ),
+}, true)
+
+add_binds("normal", {
+ key({}, "D", "Scroll half page down.",
+ function (w) w:scroll{ ypagerel = 0.5 } end),
+
+ key({}, "d", "Scroll half page down.",
+ function (w) w:scroll{ ypagerel = 0.5 } end),
+
+ key({}, "u", "Scroll half page up.",
+ function (w) w:scroll{ ypagerel = -0.5 } end),
+
+ key({"Control"}, "w", "Close current tab.",
+ function (w) if w.tabs:count() > 1 then w:close_tab() else w:close_win() end end),
+
+ key({}, "x", "Close current tab (or `[count]` tabs).",
+ function (w, m)
+ for i=1,m.count do
+ if w.tabs:count() > 1 then w:close_tab() else w:close_win() end
+ end
+ end, {count=1}),
+
+ key({}, "X", "Undo last closed tab (or `[count]` tabs).",
+ function (w, m) for i=1,m.count do w:undo_close_tab() end end, {count=1}),
+
+ -- Clipboard
+ key({}, "p", [[Open a URL based on the current primary selection contents
+ in the current tab.]],
+ function (w)
+ local uri = luakit.selection.primary
+ if not uri then w:notify("No primary selection...") return end
+ w:navigate(w:search_open(uri))
+ end),
+
+ key({"Control"}, "p", [[Open a URL based on the current primary selection contents
+ in `[count=1]` new tab(s).]],
+ function (w, m)
+ local uri = luakit.selection.primary
+ if not uri then w:notify("No primary selection...") return end
+ for i = 1, m.count do w:new_tab(w:search_open(uri)) end
+ end, {count = 1}),
+
+ key({}, "P", [[Open a URL based on the current clipboard contents
+ in the current tab.]],
+ function (w)
+ local uri = luakit.selection.clipboard
+ if not uri then w:notify("Nothing in clipboard...") return end
+ w:navigate(w:search_open(uri))
+ end),
+
+ key({"Shift","Control"}, "P", [[Open a URL based on the clipboard selection contents
+ in `[count=1]` new tab(s).]],
+ function (w, m)
+ local uri = luakit.selection.primary
+ if not uri then w:notify("Nothing in clipboard...") return end
+ for i = 1, m.count do w:new_tab(w:search_open(uri)) end
+ end, {count = 1}),
+
+ -- Yanking
+ key({}, "y", "Yank current URI to primary selection.",
+ function (w)
+ local uri = string.gsub(w.view.uri or "", " ", "%%20")
+ luakit.selection.primary = uri
+ w:notify("Yanked uri: " .. uri)
+ end),
+
+ key({}, "Y", "Yank current URI to clipboard.",
+ function (w)
+ local uri = string.gsub(w.view.uri or "", " ", "%%20")
+ luakit.selection.clipboard = uri
+ w:notify("Yanked uri (to clipboard): " .. uri)
+ end),
+
+}, true)
+
+-------------------------------------------
+-- Webview extras
+-------------------------------------------
+
+-- Custom magnet: URI handlers
+webview.init_funcs.magnet_hook = function (view, w)
+ view:add_signal("navigation-request", function (v, uri)
+ if string.match(string.lower(uri), "^magnet:") then
+ luakit.spawn(string.format("%s %q", "transmission-gtk", uri))
+ return false
+ end
+ end)
+end
+
-- vim: et:sw=4:ts=8:sts=4:tw=80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment