Skip to content

Latest commit

 

History

History
510 lines (397 loc) · 16.9 KB

conkeror.org

File metadata and controls

510 lines (397 loc) · 16.9 KB

My browser config

images/conkeror.png

Appearance

  1. Set path for themes.
  2. Unload “Default” theme.
  3. Load theme conkeror-theme-zenburn.
theme_load_paths.unshift("~/.conkeror/themes/");
theme_unload("default");
theme_load("conkeror-theme-zenburn");

New buffers instead of new windows.

I need this for open URLs from GNU Emacs in Conkeror in a new buffer. See this link for more info.

url_remoting_fn = load_url_in_new_buffer;

Completion

I use completion system for - history, bookamrks, webjumps and the minibuffer.

url_completion_use_history = true;
url_completion_use_bookmarks = true;
url_completion_use_webjumps = true;
minibuffer_auto_complete_default = true;

Session and History settings

Enable auto save session and make it load automatically at startup.

require("session.js");
session_auto_save_auto_load = true;

Setup how long in days, history entries are kept before being automatically expired.

session_pref('browser.history_expire_days', 30);

Enabling the Password Manager

session_pref("signon.rememberSignons", true);
session_pref("signon.expireMasterPassword", false);
session_pref("signon.SignonFileName", "signons.txt");
Components.classes['@mozilla.org/login-manager;1']
    .getService(Components.interfaces.nsILoginManager);

Modeline

Widgets

I disabled only the clock widget, everything else is enabled.

require("mode-line.js");

remove_hook("mode_line_hook", mode_line_adder(clock_widget));

add_hook("mode_line_hook", mode_line_adder(buffer_icon_widget), true);
add_hook("mode_line_hook", mode_line_adder(loading_count_widget), true);
add_hook("mode_line_hook", mode_line_adder(buffer_count_widget), true);
add_hook("mode_line_hook", mode_line_adder(zoom_widget));
add_hook("mode_line_hook", mode_line_adder(downloads_status_widget));

Favicons

Activate the favicons in the modeline.

require("favicon.js");
add_hook("mode_line_hook", mode_line_adder(buffer_icon_widget), true);
read_buffer_show_icons = true;

Hinting

Displaying the url of a link in hints mode.

hints_display_url_panel = true;

Display information about the currently selected hint.

hints_minibuffer_annotation_mode(true);

Hinting

I want to use letters instead of numbers.

hint_digits="asdfghjkl";

Set default download directory

This sets the default download directory to ~/Downloads.

cwd = get_home_directory();
cwd = make_file("/home/ivo/Downloads");

Other

Don’t use a new window for downloads.

download_buffer_automatic_open_target=OPEN_NEW_BUFFER_BACKGROUND;

External programs for handling various mime types in conkeror

Automatically open pdf files with Xpdf.

content_handlers.set("application/pdf", content_handler_open_default_viewer);
external_content_handlers.set("application/pdf", "xpdf");

Automatically open documents with Libreoffice.

For a complete list checkout this TechNet article .

external_content_handlers.set(
      "application/vnd.ms-excel",
      "libreoffice"
);
external_content_handlers.set(
      "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
      "libreoffice"
);
external_content_handlers.set(
      "application/vnd.openxmlformats-officedocument.presentationml.presentation",
      "libreoffice"
);
external_content_handlers.set(
      "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
      "libreoffice"
);

Open mailto links with Emacs. Get the script from here.

set_protocol_handler("mailto", make_file("~/bin/mail/emacs-mailto-handler.sh"));

Open magnet links with Transmission.

set_protocol_handler("magnet", find_file_in_path("transmission-gtk"));

Automatically open torrent files with Transmission.

content_handlers.set("application/x-bittorrent", content_handler_open);
external_content_handlers.set("application/x-bittorrent", "transmission-gtk");

View source in emacs.

editor_shell_command="emacsclient -ca emacs";
view_source_use_external_editor = true;

Extensions

  1. Disable extension compatability checking.
  2. Allow installing extension from any source.
  3. Enable security updates.
session_pref('extensions.checkCompatibility', false);
session_pref("xpinstall.whitelist.required", false);
user_pref("extensions.checkUpdateSecurity", true);

Firebug

define_variable("firebug_url",
    "http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js");

function firebug (I) {
    var doc = I.buffer.document;
    var script = doc.createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', firebug_url);
    script.setAttribute('onload', 'firebug.init();');
    doc.body.appendChild(script);
}
    interactive("firebug", "open firebug lite", firebug);

Https-everywhere

if ('@eff.org/https-everywhere;1' in Cc) {
    interactive("https-everywhere-options-dialog",
                "Open the HTTPS Everywhere options dialog.",
                function (I) {
                    window_watcher.openWindow(
                        null, "chrome://https-everywhere/content/preferences.xul",
                        "", "chrome,titlebar,toolbar,centerscreen,resizable", null);
                });
}

Adblock-plus

require("adblockplus");

My webjumps

Arch linux

define_webjump("arch/forums", "http://bbs.archlinux.org");
define_webjump("arch/wiki", "http://wiki.archlinux.org/index.php?search=%s");
define_webjump("arch/aur", "http://aur.archlinux.org/packages.php?O=0&K=%s");
define_webjump("arch/packages",
               "https://www.archlinux.org/packages/?sort=&q=%s&limit=50",
               $alternative="https://packages.archlinux.org");

Questions

define_webjump("linux-questions","http://www.linuxquestions.org/questions/");
define_webjump("gmane", "http://gmane.org/find.php?list=%s");
define_webjump("hackernews", "http://searchyc.com/%s", $alternative = "http://news.ycombinator.com/");
define_webjump("stackoverflow",  "http://stackoverflow.com/search?q=%s", $alternative = "http://stackoverflow.com/");
define_webjump("superuser", "http://superuser.com/search?q=%s", $alternative = "http://superuser.com/");

Emacs

define_webjump("emacswiki",
   "http://www.google.com/cse?cx=004774160799092323420%3A6-ff2s0o6yi"+
       "&q=%s&sa=Search&siteurl=emacswiki.org%2F",
   $alternative="http://www.emacswiki.org/"); // emacswiki

define_webjump("marmalade", "http://marmalade-repo.org/packages?q=%s"); // emacs marmalade repo

Yandex

define_webjump("yandex", "http://yandex.com/yandsearch?text=%s"); // text
define_webjump("yandex.ru", "https://yandex.ru/yandsearch?text=%s"); // text ru
define_webjump("yimages", "http://images.yandex.com/yandsearch?text=%s"); // images
define_webjump("yimagesru", "http://images.yandex.ru/yandsearch?text=%s"); // images ru
define_webjump("ytrans", "http://translate.yandex.com/?lang=en-es&text=%s"); // translate en -> es

Kaldata

define_webjump("kaldata",
    "http://www.kaldata.com/forums/index.php?app=core&module=search&do=search&fromMainBar=1&search_term=%s");

Distrowatch (Search Distributions)

define_webjump("distrowatch", "http://distrowatch.com/table.php?distribution=%s");

DuckDuckGo

define_webjump("ddg", "http://duckduckgo.com/?q=%s");

Google

define_webjump("trans", "http://translate.google.com/translate_t#auto|en|%s");
define_webjump("imagesgoogle", "http://www.google.com/images?q=%s", $alternative = "http://www.google.com/imghp");

Popular

define_webjump("wordpress", "http://wordpress.org/search/%s");
define_webjump("youtube", "http://www.youtube.com/results?search_query=%s&search=Search");
define_webjump("deviantart", "http://browse.deviantart.com/?q=%s", $alternative="http://www.deviantart.com");
define_webjump("flickr", "http://www.flickr.com/search/?q=%s", $alternative="http://www.flickr.com");

GIT

define_webjump("github", "http://github.com/search?q=%s&type=Everything");
define_webjump("savannah", "https://savannah.gnu.org/search/?words=%s&type_of_search=soft");
define_webjump("gitorious", "http://gitorious.org/search?q=%s");

Wikipedia

require("page-modes/wikipedia.js");
wikipedia_webjumps_format = "wp-%s"; // controls the names of the webjumps.  default is "wikipedia-%s".
define_wikipedia_webjumps("en", "es", "bg"); // For English, Spain and Bulgarian.

Ebay

define_webjump("ebay", "http://search.ebay.es/search/search.dll?query=%s");

Lingvo

define_webjump("lingvo", "http://www.lingvo-online.ru/en/Translate/en-es/%s");

Remove unused webjumps

var unused_webjumps = ['answers', 'buildd','buildd-ports','clhs','cliki','clusty','creativecommons','debbugs','debfile','debpkg','debpopcon','debpts','debqa','freshmeat','kuro5hin','launchpad','lucky','ratpoisonwiki','sadelicious','scholar','sdelicious','slashdot','sourceforge','stumpwmwiki','ubuntubugs','ubuntufile','ubuntupkg','wiktionary','yahoo'];

for (var i=0; i<unused_webjumps.length; i++) {
    delete webjumps[unused_webjumps[i]];
}

Keyboard

Caps Lock

Override the state of caps lock for command bindings, and force typed characters to upper-case or lower-case based on whether shift was pressed with the character.

key_bindings_ignore_capslock = true;

Disable the arrow keys in conkeror (use Emacs alternatives instead).

undefine_key(content_buffer_normal_keymap, "up", "cmd_scrollLineUp");
undefine_key(content_buffer_normal_keymap, "down", "cmd_scrollLineDown");
undefine_key(content_buffer_normal_keymap, "left", "cmd_scrollLeft");
undefine_key(content_buffer_normal_keymap, "right", "cmd_scrollRight");

Enable eye-guide scrolling

require('eye-guide.js');
define_key(content_buffer_normal_keymap, "space", "eye-guide-scroll-down");
define_key(content_buffer_normal_keymap, "back_space", "eye-guide-scroll-up");

Functions

Disable gif animation on startup.

For some reasons I have disabled the gif animation on startup.

session_pref("image.animation_mode", "none");

I have a simple function to enable gif animation with f6 or typing M-x enable-gif-animation.

interactive("enable-gif-animation",
    "Enable gif animation",
    function (I) {
       session_pref("image.animation_mode", "normal");
    });
define_key(default_global_keymap, "f6", "enable-gif-animation");

Conkeror goto-buffer.

// - source http://puntoblogspot.blogspot.com.es/2013/08/conkeror-go-to-buffer.html
interactive("rgc-goto-buffer", "switches to buffer",
            function rgc_switch_to_buffer(I){
                var buff = yield I.minibuffer.read( $prompt = "number?:");
                switch_to_buffer(I.window, I.window.buffers.get_buffer(buff-1));
            }
);
define_key(content_buffer_normal_keymap, "M-g M-g", "rgc-goto-buffer");

Ask before closing the window.

add_hook("window_before_close_hook",
         function () {
             var w = get_recent_conkeror_window();
             var result = (w == null) ||
                 "y" == (yield w.minibuffer.read_single_character_option(
                     $prompt = "Quit Conkeror? (y/n)",
                     $options = ["y", "n"]));
             yield co_return(result);
         });

Restore killed buffer Url.

// I think by the time kill_buffer_hook runs the buffer is gone so I
// patch kill_buffer

var kill_buffer_original = kill_buffer_original || kill_buffer;

var killed_buffer_urls = [];

kill_buffer = function (buffer, force) {
    if (buffer.display_uri_string) {
        killed_buffer_urls.push(buffer.display_uri_string);
    }

    kill_buffer_original(buffer,force);
};

interactive("restore-killed-buffer-url", "Loads url from a previously killed buffer",
            function restore_killed_buffer_url (I) {
                if (killed_buffer_urls.length !== 0) {
                    var url = yield I.minibuffer.read(
                        $prompt = "Restore killed url:",
                        $completer = new all_word_completer($completions = killed_buffer_urls),
                        $default_completion = killed_buffer_urls[killed_buffer_urls.length - 1],
                        $auto_complete = "url",
                        $auto_complete_initial = true,
                        $auto_complete_delay = 0,
                        $require_match = true);

                    load_url_in_new_buffer(url);
                } else {
                    I.window.minibuffer.message("No killed buffer urls");
                }
            });

Clear conkeror history.

function history_clear () {
    var history = Cc["@mozilla.org/browser/nav-history-service;1"]
        .getService(Ci.nsIBrowserHistory);
    history.removeAllPages();
}

interactive("history-clear",
            "Clear the history.",
            history_clear);

Start Hardcore radio.

interactive("radio", "Start hardcore-radio", "follow-new-buffer",
           $browser_object = "http://www.hardcoreradio.nl/player/");
define_key(content_buffer_normal_keymap, "f1 r", "radio");

Go to the buffer that has radio (hardcore-radio).

interactive("to-radio-buffer", "Shortcut to the buffer that has radio",
            function (I) {
                var buffers = I.window.buffers.buffer_list;
                for (i in buffers) {
                    if (buffers[i].current_uri.spec.substr(0, 35) ==
                        'http://www.hardcoreradio.nl/player/') {
                        switch_to_buffer(I.window, buffers[i]);
                        return;
                    }
                }
            });
define_key(content_buffer_normal_keymap, "C-x r", "to-radio-buffer");

User agent switcher.

// source from https://github.com/technomancy/dotfiles/blob/master/.conkerorrc
var user_agents = { "conkeror": "Mozilla/5.0 (X11; Linux x86_64; rv:8.0.1) " +
                    "Gecko/20100101 conkeror/1.0pre",
                    "chromium": "Mozilla/5.0 (X11; U; Linux x86_64; en-US) " +
                    "AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63" +
                    "Safari/534.3",
                    "firefox": "Mozilla/5.0 (X11; Linux x86_64; rv:8.0.1) " +
                    "Gecko/20100101 Firefox/8.0.1",
                    "android": "Mozilla/5.0 (Linux; U; Android 2.2; en-us; " +
                    "Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like " +
                    "Gecko) Version/4.0 Mobile Safari/533.1"};
  var agent_completer = prefix_completer($completions = Object.keys(user_agents));
 interactive("user-agent", "Pick a user agent from the list of presets",
            function(I) {
                var ua = (yield I.window.minibuffer.read(
                    $prompt = "Agent:",
                    $completer = agent_completer));
                set_user_agent(user_agents[ua]);
            });