Search for a lighter browser

Coz Chrome is a RAM monster

2 min read    20 Sep 2017    

This entry describes using a browser inside a terminal. [GNU/Linux based systems like ubuntu]

Why?

I use chrome for browsing, and I absolutely need my extensions to be fully active all the time. However, RAM hogging is an issue Chrome doesn’t manage well. Often, there have been instances when I had to browse the internet for a tiny thing, but opening chrome would spike the RAM, and the session only lasted for 2 minutes max. How can I browse the internet, without bringing in these spikes ?

How about a in-terminal web browser. Enter w3m. I know there are a lot of options - lynx, etc, but w3m made a lot of sense to me. w3m when used in xterm also showed images. I don’t need another thing from this. What all was needed, some time to configure the right colours for xterm, I wanted my browser to have a lighter colour scheme than the usual dark themes for my terminals and editors.

Installation

sudo apt-get install w3m w3m-img

Source: howtogeek

Config

You are supposed to write down your config in a file called ~/.XResources.

You can pick some config themes from here: dotshare, terminals.sexy

For now, you can use my choice of theme. Just copy paste this in .XResources.

! XTerm config for w3m ! @kaustubhhiware
! euphrasia

xterm*faceName: DejaVu Sans Mono Book
xterm*faceSize: 11

xterm.selectToClipboard: true
! open links on one click
xterm.urlLauncher: w3m
! special
xterm*foreground:   #1c2027
xterm*background:   #cfcfd9
xterm*cursorColor:  #1c2027
! black
xterm*color0:       #192033
xterm*color8:       #666666
! red
xterm*color1:       #a62a3e
xterm*color9:       #f04758
! green
xterm*color2:       #38912b
xterm*color10:      #93c724
! yellow
xterm*color3:       #b27d12
xterm*color11:      #ddb62b
! blue
xterm*color4:       #355c9a
xterm*color12:      #45a3e6
! magenta
xterm*color5:       #7c4f9f
xterm*color13:      #c953ef
! cyan
xterm*color6:       #258f8f
xterm*color14:      #60c6c8
! white
xterm*color7:       #77858c
xterm*color15:      #c0c0c0

.

You can find my .XResources file here: kaustubhhiware/dotfiles. Once you’ve edited your .XResources file, you need to activate it every time using: xrdb ~/.XResources

Now, what remained was invoking this light-web browser with mere clicks. Now, I have been using xfce as my Desktop environment, because of the freedom it offers me, so just head over to Keyboard Shortcuts, and add this shortcut.

xterm -maximized-e w3m 'https://google.com'

Let’s break it down, shall we?

xterm calls the application, -maximized is pretty self-explanatory,-e is used to run the command within xterm.

Now, we call upon our beloved w3m and mention which search engine to use. Google, I choose you!

Win + W points to the default browser, so the new shortcut assigned was Win + Shift + W.

Result ?

Screenshots here.

Usage

  • Exitting w3m is simple as pressing a q when no text field is active.
  • Going back one page: Shift + B
  • New tab: Shift + T
  • Change url: Shift + U
  • Shifting tabs: { & }
  • More can be found in the manual.

DISCLAIMER

“I loved w3m <3, but it doesn’t show the images properly.” Yeah buddy, that’s gonna happen. It doesn’t show all the pages properly, most websites look like the source code with missing css files, including imdb. But that’s not what w3m is for. It’s for fast browing through the terminal. Does it get the job done ? Yes. Then that is all I’m concerned about.

Not what you were hoping for? See this stackoverflow answer for more options.

Some rights reserved.

Leave a Comment