Notice: Use of undefined constant DC_MAX_ATTEMPTS - assumed 'DC_MAX_ATTEMPTS' in /home/light42/public_html/ on line 32

Notice: Use of undefined constant DC_ALLOWED_DOWNLOADS - assumed 'DC_ALLOWED_DOWNLOADS' in /home/light42/public_html/ on line 33

Notice: Use of undefined constant DC_FILE_TYPES - assumed 'DC_FILE_TYPES' in /home/light42/public_html/ on line 34

Notice: Use of undefined constant DC_CODE_CHARS - assumed 'DC_CODE_CHARS' in /home/light42/public_html/ on line 35

Notice: Use of undefined constant DC_HEADER_CONTENT_TYPE - assumed 'DC_HEADER_CONTENT_TYPE' in /home/light42/public_html/ on line 36
Raspberry Pi: Faster and Lighter Web Browsing with Luakit - Coding Epiphany

Raspberry Pi: Faster and Lighter Web Browsing with Luakit

April 2, 2013 10:31 pm 3 Comments

Raspberry Pi with Luakit
So enter Luakit. An extremely lightweight and highly configurable web browser. It is based on webkit and GTK+. Now, as lean and mean Luakit can be, its user-friendliness can’t be rated as high. Therefore I have created this guide to help installing Luakit and configuring some options that I think will help your user experience. I personally think this guide is needed because I had to do quite a bit of research to get it to work the way I want, close to a normal browser.The Raspberry Pi with its original Raspbian OS comes with Midori as its default browser. While Midori is already light in comparison with Chrome and Firefox, this is not light enough under many circumstances. There are a lot of times when I opened up a website and it locks up completely; mostly because the CPU is very busy. Now of course I can use Lynx as an alternative but that wouldn’t be cool.

Install Luakit

This is the easy part. Thankfully with Raspbian we won’t even have to compile Luakit from its source.

So open your terminal and simply do :

Get the Basic Essential Plugins

The next thing you want to do is prepare the plugins location and download the essential plugins. This is important as we want to be able to switch useragent later on.

So create the plugins directory and go into the directory.

After that clone Luakit plugins, this pack will contain things like user-agent changer and ad-blocker. Now, if you read my previous retro gaming article, you would have already installed git console needed to clone codes from Github.

Then prepare the Luakit configuration file.

Next we want to tell Luakit to include the plugins when starting up. Therefore open the rc.lua file that you just copied into your config directory with your favourite editors, be it VI or leafpad. Edit the file and add require “plugins” after the Optional user script loading. So your configuration file in that section will look like:

Start luakit to instantiate the plugins and generate the rc.lua file in the plugins directory.

You can type luakit anywhere in the terminal.

You’ll get an adblock error. Don’t panic, this is normal. To fix this you have two options: you can either download the list manually or simply disable adblock. We’ll take a look at both.

Disabling plugins you don’t need

cd ~/.config/luakit/plugins/Go into your plugins directory

Open rc.lua with your text editor. For example: leafpad rc.lua or vim rc.lua

Set plugins.policy = “manual”

Comment out the plugins that you don’t want.

For example in this instance we only want to use tabmenu (which will give us the ability to list all the tabs that we have open) and uaswitch (the user agent switcher that we will use to simulate mobile website).

So edit the plugins_to_load section:

Setup Luakit Ad-Block.

As an alternative to disabling this, you can download the ad blocker list. I’m sure this will affect the browser performance as it would need to do pattern matching, etc on each web page; which is why I disable this on my installation.

However if you want to enable this extension:

Setup the Mobile Useragent

The Raspberry Pi doesn’t have as much processing power as your powerhouse machine, so you might want to consider using mobile useragent as the default. It may not look as pretty, but it will be easier on your Pi because some websites really have Javascripts that might bring the Raspberry Pi to its knees.

Then edit the file to add a mobile useragent:

Now we’ll set the mobile useragent as the default.

Open the init file, so:

In the load() section, modify interfox to mobile as we have defined previously.

Add some scrollbars

By default luakit doesn’t come with any scrollbars. To scroll up and down you will use our mouse scroller but left and right will have to be done using your keyboard.

Open your luakit rc.lua

Find the part where it says — Restore last saved session then add the scrollbars code before that section. So your settings should look like the following:

Changing your default homepage

Copy your luakit globals configuration to your .config/luakit/

Then open your newly created globals.lua with your favourite editor.

Change the homepage parameter into your preference.

Useful shortcuts

On with the Web Browsing!

i Insert mode
:o Open a website
:tabopen Open in a tab
ctrl + w Close current tab
i Insert mode, you’ll be able to type into input boxes in the website
esc Reset to command mode
:ua Change useragent

Simply start a terminal session and type luakit to start your new browser anytime. Have fun!

start luakitshortcuts

Tags: , , ,

Categorised in: , , ,

  • Pingback: Raspberry Pi: Luakit Shortcut Card - Coding Epiphany : Coding Epiphany()

  • Aminga

    I installed Luakit and Arora but both are sluggish compared to NetSurf which is already included in Raspbian and seems rendering complex web pages fairly good.

    • Many thanks for your input. It’s really differs depending on which websites visited really. I still think luakit’s rendering is better than NetSurf and I love the customisability :D.

      Someone mentioned dwb on my twitter account the other day, perhaps its worth trying too. I’ll do an article on it when the opportunity arise.