Luakit
Luakit is an extremely fast, lightweight and flexible web browser using the webkit engine. It is customizable through lua scripts and fully usable with keyboard shortcuts.
Contents
Installing
The luakit package can be found in the official repositories and can be installed with pacman.
You can also use the git version available from the [AUR].
Configuration
With the Unix philosophy in mind, Luakit is entirely customizable through its configuration files. Those files are written in the Lua scripting language, thus allowing virtually unlimited features. First, copy the configuration files to your $XDG_CONFIG_HOME folder:
cp -r $XDG_CONFIG_DIRS/luakit $XDG_CONFIG_HOME
Now you can edit any of these files to make your brower fit your needs. Even if you do not know much about Lua, the configuration is quiet simple and well commented enough to make it straightforward.
Basic usage
binds.lua
.Press Template:Keypress to access the command prompt. You can do nearly everything from there. Use Template:Keypress to autocomplete commands.
To quit, use the quit
command, or the Template:KeypressTemplate:Keypress shortcut.
You can also close the browser while remembering the session (i.e. restoring the tabs) by using the writequit
command instead, or the Template:KeypressTemplate:Keypress shortcut.
Browsing
- Press Template:Keypress to open a prompt with the
open
command and enter the URI you want. - If it is not a recognized URI, luakit will use the default search engine (specified in
globals.lua
). - Specify which search engine to use by prefixing the entry with the appropriate keywork (e.g.
:open google foobar
will search foobar on Google). - Use common shortcuts to navigate. For emacs and vim aficionados, some of their regular shortcuts are provided. You can use the mouse as well.
- Use Template:Keypress to display the index of all visible links. Enter the appropriate number to open the link.
- Use Template:Keypress instead to open link in a new tab.
- Press Template:Keypress to open a new tab, Template:Keypress to close it.
- Switch from one tab to another with Template:Keypress and Template:Keypress, or Template:Keypress and Template:Keypress.
- You can switch to a specific tab with Template:Keypress.
- Reorder the tabs with Template:Keypress and Template:Keypress.
Input fields
Many webpages have editable elements like dropdown lists, checkboxes, text fields and so one. While they work perfectly with the mouse, you may encounter some troubles using the follow commands. In such a case, pressing the arrow keys may help.
Bookmarks
If enabled (default configuration), bookmarks can be used from within Luakit.
- The
:bookmarks
command opens the bookmarks page. (Shortcut: Template:Keypress). - The
:bookmark uri group
command adds the specified URI to the specified group in the bookmarks.
Configuration
Homepage
Set your homepage as follows:
globals.lua
globals = { homepage = "about:blank", -- ... }
Custom search engines
You can virtually add any search engine you want. Make a search on the website you want and copy paste the URI to the Luakit configuration by replacing the searched terms with an %s
. Example:
globals.lua
search_engines = { aur = "https://aur.archlinux.org/packages.php?O=0&K=%s&do_Search=Go", -- ... }
The variable is used as a keyword for the :open
command in Luakit.
Set the defaut search engine by using this same keyword:
globals.lua
search_engines.default = search_engines.aur
Bookmarks sync and import
Bookmarks are stored in a simple plain text file: $XDG_DATA_HOME/luakit/bookmarks
.
Each line is a bookmark. It is composed of 2 fields:
$XDG_DATA_HOME/luakit/bookmarks
link group
Groups and links are alphabetically sorted, so there is no need to do it manually.
You can put a symbolic link in place of the default file to store your bookmarks anywhere on your machine. This way if your are using a cloud sync application like Dropbox, you can keep your bookmarks synchronized between your different computers.
To import your bookmarks from Firefox, first you must export them to an HTML file using its bookmarks manager. Now we must convert the XML file to a Luakit format. You can use the following one-line awk command:
$ cat bookmarks.html | awk '{gsub(/=/," ")}{gsub(/\"/," ")}/<\/H3>/{FS=">";gsub(/</,">");og=g;g=$(NF-2);FS=" "}/
- /{x++;if(x>= 3)gl[x-3]=g}/<\/DL>/{x--;if(x==2)g=og"2"}'/HREF/{gsub(/</," ");gsub(/>/," ");if(g!=""){if(og!=g){printf "\n";og=g};printf "%s\t",$4;if(x>=3){for(i=0;i<=x-4;i++){printf "%s-",gl[i]}printf "%s\n",gl[x-3]}else{printf "\n"}}}'
Or if you prefer the more readable script version:
ff2lk.awk
{gsub(/=/," ")} {gsub(/\"/," ")} /<\/H3>/ { FS=">" gsub(/</,">") oldgroup=group group=$(NF-2) FS=" " } /<DL>/ { count++ if ( count >= 3 ) groupline[count-3]=group } /<\/DL>/ { count-- if( count == 2 ) group=oldgroup"ROOT" } /HREF/ { gsub(/</," ") gsub(/>/," ") if (group != "") { if(oldgroup != group) { printf "\n" oldgroup=group } printf "%s\t",$4 if ( count >= 3 ) { for ( i=0 ; i <= count-4 ; i++ ) {printf "%s-" , groupline[i]} printf "%s\n" , groupline[count-3] } else printf "\n" } }
Run it with
$ awk -f ff2lk.awk bookmarks.html