luakit: init
Anirudh Oppiliappan x@icyphox.sh
Mon, 31 Jan 2022 15:14:57 +0530
7 files changed,
347 insertions(+),
24 deletions(-)
M
bash/.bashrc.d/04-exports.bash
→
bash/.bashrc.d/04-exports.bash
@@ -1,13 +1,3 @@
-# PATH mods -export PATH=$HOME/bin:$PATH -export PATH=$PATH:$HOME/.local/bin -export PATH=$PATH:/usr/local/go/bin -export PATH=$PATH:$HOME/go/bin -export PATH=$PATH:/usr/local/pgsql/bin - -export PLAN9=/usr/local/plan9 -export PATH=$PATH:$PLAN9/bin - # export thingys export EDITOR=nvim export BROWSER=firefox
M
bash/.bashrc.d/99-prompt.bash
→
bash/.bashrc.d/99-prompt.bash
@@ -2,5 +2,5 @@ refresh_tmux() {
tmux refresh-client -S } PROMPT_COMMAND=refresh_tmux -PS1='▲ ' +PS1='\n▲ ' PS2="> "
A
config/luakit/rc.lua
@@ -0,0 +1,211 @@
+------------------------------------------------------------------------------ +-- luakit configuration file, more information at https://luakit.github.io/ -- +------------------------------------------------------------------------------ + +require "lfs" + +-- Check for lua configuration files that will never be loaded because they are +-- shadowed by builtin modules. +table.insert(package.loaders, 2, function (modname) + if not package.searchpath then return end + local f = package.searchpath(modname, package.path) + if not f or f:find(luakit.install_paths.install_dir .. "/", 0, true) ~= 1 then + return + end + local lf = luakit.config_dir .. "/" .. modname:gsub("%.","/") .. ".lua" + if f == lf then + msg.warn("Loading local version of '" .. modname .. "' module: " .. lf) + elseif lfs.attributes(lf) then + msg.warn("Found local version " .. lf + .. " for core module '" .. modname + .. "', but it won't be used, unless you update 'package.path' accordingly.") + end +end) + +require "unique_instance" + +-- Set the number of web processes to use. A value of 0 means 'no limit'. This +-- has no effect since WebKit 2.26 +luakit.process_limit = 4 +-- 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 cache control (clear-data, clear-favicon-db) +local clear_data = require "clear_data" + +-- 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 command to list open tabs +local tabmenu = require "tabmenu" + +-- Add gopher protocol support (this module needs luasocket) +-- local gopher = require "gopher" + +-- 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" + +-- 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" + +-- 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" + +-- Put "userconf.lua" in your Luakit config dir with your own tweaks; if this is +-- permanent, no need to copy/paste/modify the default rc.lua whenever you +-- update Luakit. +if pcall(function () lousy.util.find_config("userconf.lua") end) then + require "userconf" +end + +----------------------------- +-- 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 + +-- vim: et:sw=4:ts=8:sts=4:tw=80
A
config/luakit/theme.lua
@@ -0,0 +1,108 @@
+-------------------------- +-- Default luakit theme -- +-------------------------- + +local fg = "#676767" +local bg = "#f4f4f4" +local green = "#7c9f4b" +local red = "#db7070" +local blue = "#6587BF" +local med_gray = "#aaa" + +local theme = {} + +-- Default settings +theme.font = "16px Inter" +theme.fg = fg +theme.bg = bg + +-- Genaral colours +theme.success_fg = "#0f0" +theme.loaded_fg = "#33AADD" +theme.error_fg = "#FFF" +theme.error_bg = "#F00" + +-- Warning colours +theme.warning_fg = "#F00" +theme.warning_bg = "#FFF" + +-- Notification colours +theme.notif_fg = "#444" +theme.notif_bg = "#FFF" + +-- Menu colours +theme.menu_fg = fg +theme.menu_bg = bg +theme.menu_selected_fg = bg +theme.menu_selected_bg = fg +theme.menu_title_bg = bg +theme.menu_primary_title_fg = fg +theme.menu_secondary_title_fg = "#666" + +theme.menu_disabled_fg = "#999" +theme.menu_disabled_bg = theme.menu_bg +theme.menu_enabled_fg = theme.menu_fg +theme.menu_enabled_bg = theme.menu_bg +theme.menu_active_fg = "#060" +theme.menu_active_bg = theme.menu_bg + +-- Proxy manager +theme.proxy_active_menu_fg = '#000' +theme.proxy_active_menu_bg = '#FFF' +theme.proxy_inactive_menu_fg = '#888' +theme.proxy_inactive_menu_bg = '#FFF' + +-- Statusbar specific +theme.sbar_fg = fg +theme.sbar_bg = bg + +-- Downloadbar specific +theme.dbar_fg = "#fff" +theme.dbar_bg = "#000" +theme.dbar_error_fg = "#F00" + +-- Input bar specific +theme.ibar_fg = fg +theme.ibar_bg = bg + +-- Tab label +theme.tab_fg = fg +theme.tab_bg = bg +theme.tab_hover_bg = med_gray +theme.tab_ntheme = "#ddd" +theme.selected_fg = bg +theme.selected_bg = fg +theme.selected_ntheme = "#ddd" +theme.loading_fg = blue +theme.loading_bg = "#000" + +theme.selected_private_tab_bg = "#3d295b" +theme.private_tab_bg = "#22254a" + +-- Trusted/untrusted ssl colours +theme.trust_fg = green +theme.notrust_fg = red + +-- Follow mode hints +theme.hint_font = "12px SF Mono, courier, sans-serif" +theme.hint_fg = "#fff" +theme.hint_bg = "#000088" +theme.hint_border = "1px dashed #000" +theme.hint_opacity = "0.3" +theme.hint_overlay_bg = "rgba(255,255,153,0.3)" +theme.hint_overlay_border = "1px dotted #000" +theme.hint_overlay_selected_bg = "rgba(0,255,0,0.3)" +theme.hint_overlay_selected_border = theme.hint_overlay_border + +-- General colour pairings +theme.ok = { fg = fg, bg = bg } +theme.warn = { fg = "#F00", bg = "#FFF" } +theme.error = { fg = "#FFF", bg = "#F00" } + +-- Gopher page style (override defaults) +theme.gopher_light = { bg = "#E8E8E8", fg = "#17181C", link = "#03678D" } +theme.gopher_dark = { bg = "#17181C", fg = "#E8E8E8", link = "#f90" } + +return theme + +-- vim: et:sw=4:ts=8:sts=4:tw=80
A
config/luakit/userconf.lua
@@ -0,0 +1,14 @@
+local vertical_tabs = require "vertical_tabs" +local editor = require "editor" +editor.editor_cmd = "st -e nvim {file} +{line}" + +local modes = require "modes" +modes.add_binds("normal", { + { "<Control-c>", "Copy selected text.", function () + luakit.selection.clipboard = luakit.selection.primary + end}, +}) + +modes.remap_binds("normal", { + { "b", "<shift-h>", true }, +})
M
home/.tmux.conf
→
home/.tmux.conf
@@ -72,8 +72,8 @@ set -g status-left-length 100
set -g status-left "#[fg=colour8]time #[fg=colour15]#(date +"%H:%M") " set -ag status-left "#[fg=colour8]date #[fg=colour15]#(date.sh) " set -ag status-left "#[fg=colour8]bat #[fg=colour15]#(~/bin/bat -q) " -set -ag status-left "#[fg=colour8]cwd #[fg=colour15]#(prompt -p #{pane_current_path}) " -set -ag status-left "#[fg=colour15]#(prompt -gb #{pane_current_path}) " +set -ag status-left "#[fg=colour8]cwd #[fg=colour15]#(prompt -p #{pane_current_path}) " +set -ag status-left "#[fg=colour8]#(prompt -gb #{pane_current_path}) " set -ag status-left "#[fg=colour15]#(prompt -gs #{pane_current_path})" # dim inactive pane
M
prompt/prompt.go
→
prompt/prompt.go
@@ -3,7 +3,6 @@
import ( "fmt" "os" - "path/filepath" "strings" git "github.com/libgit2/git2go/v33"@@ -22,16 +21,17 @@ // entire path as is.
path = cwd return path } - items := strings.Split(path, "/") - truncItems := []string{} - for i, item := range items { - if i == (len(items) - 1) { - truncItems = append(truncItems, item) - break - } - truncItems = append(truncItems, item[:1]) - } - return filepath.Join(truncItems...) + return path + // items := strings.Split(path, "/") + // truncItems := []string{} + // for i, item := range items { + // if i == (len(items) - 1) { + // truncItems = append(truncItems, item) + // break + // } + // truncItems = append(truncItems, item[:1]) + // } + // return filepath.Join(truncItems...) } func main() {