welcome: please sign in
location: HideScrollbars

A common customization that people make in order to maximize usable screen space is to disable scrollbars. Unfortunately the Mozilla platform does not make this easy for us, so the subject is complex enough to warrant its own short article. Broadly, there are two ways to get rid of scrollbars, externally at the system level, or internally at the Conkeror level. The external method is the recommended way, so we will discuss that first.

1. Method 1, External

We can kill Conkeror's scrollbars at the system level by making a small GTK2 theme with scrollbars of zero width. We can then run Conkeror with this theme in effect by a small change to the way we launch Conkeror. This method eliminates all scrollbars, including those that would normally be in content frames, iframes, or editing areas.

First, make a file ~/.gtkrc-2.0.conkeror with the following contents:

## uncomment the next line to also load your normal .gtkrc-2.0
#include "/home/YOU/.gtkrc-2.0"

style "noscrollbars" {
widget "MozillaGtkWidget.*" style "noscrollbars"

Then, launch Conkeror like this:

GTK2_RC_FILES=~/.gtkrc-2.0.conkeror conkeror

Note, if you don't use any other Mozilla-based programs, or don't mind losing scrollbars in all of them, you can put the GTK2 theme snippet above directly in your ~/.gtkrc-2.0, and not bother with the GTK2_RC_FILES environment variable.

2. Method 2, Internal

Alternately, Conkeror can also be configured internally to disable scrollbars. This method will only disable top-level scrollbars, but it is known to have several problems, namely that it breaks automatic scrolling during isearch and also breaks functionality of mouse scroll wheels. There is a partial fix for these problems, detailed below.

To disable scrollbars by this method, put the following in your rc:

function disable_scrollbars (buffer) {
    buffer.top_frame.scrollbars.visible = false;
add_hook("create_buffer_late_hook", disable_scrollbars);

The problem with isearch failing to scroll can be worked around by the following additional code. It turns scrollbars back on for the duration of the isearch session. Care has been taken to write the code in a way that shouldn't break things with repeated evaluation, but if you read it carefully you will see why there would otherwise be that risk.

var old_isearch_start = (old_isearch_start || isearch_start);
isearch_start = function (window, direction) {
    window.buffers.current.browser.contentWindow.scrollbars.visible = true;
    old_isearch_start(window, direction);

var old_isearch_session_destroy = (old_isearch_session_destroy ||
isearch_session.prototype.destroy = function () {
    this.minibuffer.window.buffers.current.browser.contentWindow.scrollbars.visible = false;

Conkeror.org: HideScrollbars (last edited 2011-12-30 00:12:58 by retroj)