You probably have heard me worshiping Vimperator many times. Here is one more.

Note

In September, 2011, I switched to Pentadactyl. (2015-11-08T22:56:05Z)

For a long time, I had been struggling with browser’s about:blank or home (aka start) page. I need a page which is in dark, I couldn’t stand with bright color, they hurt my eyes. When I was using Chromium, I had to use theme. It’s inevitable on Chromium, you need to use a theme extension. I recall I could choose to use system color, but that seemed to bring other issue.

After I went back to Firefox for version 4 beta, I tried to find a solution. You could write a HTML page and set it as home page, it will be about:home. But, if you open a new tab, it’s about:blank. So, writing a dark blank home page won’t help. So, I changed the background color in Firefox preference dialog. But, again, I found many websites, actually lots of websites, have only specified either color or background-color in CSS, rather than set both or set none of them. That would be really a huge problem. I often saw black on dark background. I also tried to add styles in userChrome.css, but those I found on net, just didn’t work, probably not suitable for Firefox 4.

There is one solution I have known but never wanted to use, another add-on. There are add-ons for such task. But I would rather living with that bloody-eye-hurting white page than installing a new add-on. New add-on on Firefox? Not a chance to be installed by me.

Moments ago, somehow, I started to try PageLoad event in Vimperator. I have done that many times and also have tried to manipulate pages. No idea why I hadn’t tried before. Now I have the following codes to share,


" Set dark background
autocmd PageLoad about:blank js tabs.getTab(<tab>-1).linkedBrowser.contentDocument.body.style.backgroundColor = "#333"
" Reopen about:home when about:blank is loaded
autocmd PageLoad about:blank js tabs.getTab(<tab>-1).linkedBrowser.contentWindow.open('about:home')
" Reopen any page or URL when about:blank is read. Can use above and set home page to other page or URL
autocmd PageLoad about:blank js tabs.getTab(<tab>-1).linkedBrowser.contentWindow.open('file:///path/to/myhome.html')

Note

I am now using userContent.css to change about:blank background color. (2015-11-08T22:51:07Z)

Isn’t that wonderful? Vimperator saves me one more time. It is

You don’t really need to use Vimperator as we fans (of Vimperator and of Vim) do. You can make it use like normal Firefox—meaning you don’t have to press keys, but also be benefit from it.

Vimperator is awesome!