aboutsummaryrefslogtreecommitdiff
path: root/conkerorrc
blob: 314e98a31b9220b7fd9cf56e7e980b717c361e7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// vim:ft=javascript
require("theme.js");
theme_load_paths.unshift("~/.conkeror/");
theme_unload("default");
theme_load("theme");

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

require("favicon.js");
require("new-tabs.js");
tab_bar_show_icon = true;
tab_bar_show_index = false;

require("clicks-in-new-buffer.js");

require("opensearch.js");
define_opensearch_webjump("?", "duckduckgo.xml");
define_opensearch_webjump("?g", "google.xml");
define_opensearch_webjump("?w", "wikipedia.xml");
define_opensearch_webjump("?e", "eBay.xml");

external_content_handlers.set("application/pdf", "okular");
external_content_handlers.set("video/*", "vlc");
editor_shell_command = "urxvt -e vi";

url_completion_use_history = true;
url_remoting_fn = load_url_in_new_buffer;
download_buffer_automatic_open_target = OPEN_NEW_BUFFER_BACKGROUND;

// Set zoom to 90% (this is normal zoom don't know why default seems to be 110% or so.
session_pref("layout.css.devPixelsPerPx", "0.9");

/////////////////////////////////////////////////////////////////////////////////
// reopening closed buffers
define_key(default_global_keymap, "A-W", "revive-buffer");

// Save origin kill_buffer command
var kill_buffer_original = kill_buffer_original || kill_buffer;

var killed_buffer_urls = [];
var killed_buffer_histories = [];

//  remember_killed_buffer
kill_buffer = function (buffer, force) {
    var hist = buffer.web_navigation.sessionHistory;

    if (buffer.display_uri_string && hist) {
        killed_buffer_histories.push(hist);
        killed_buffer_urls.push(buffer.display_uri_string);
    }

    kill_buffer_original(buffer,force);
};

interactive("revive-buffer",
    "Loads url from a previously killed buffer",
    function restore_killed_buffer (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);

            var window = I.window;
            var creator = buffer_creator(content_buffer);
            var idx = killed_buffer_urls.indexOf(url);

            // Create the buffer
            var buf = creator(window, null);

            // Recover the history
            buf.web_navigation.sessionHistory = killed_buffer_histories[idx];

            // This line may seem redundant, but it's necessary.
            var original_index = buf.web_navigation.sessionHistory.index;
            buf.web_navigation.gotoIndex(original_index);

            // Focus the new tab
            window.buffers.current = buf;

            // Remove revived from cemitery
            killed_buffer_urls.splice(idx,1);
            killed_buffer_histories.splice(idx,1);
        } else {
            I.window.minibuffer.message("No killed buffer urls");
        }
    });
/////////////////////////////////////////////////////////////////////////////////