Contents
1. Overview
Page modes, in the spirit of Emacs major modes and GreaseMonkey scripts, allow site-specific functionality to be implemented in Conkeror.
2. Loading, Activating, Deactivating
When we talk about page modes, there are three terms that we would do well not to confuse: loading, activating, and enabling.
- Loading
Loading a page-mode means evaluating the module that contains a page-mode, usually by calling require on its file.
- Activating
Activating a page-mode means calling page_mode_activate on a loaded page-mode, thus causing it to auto-enable when we visit a covered site. The opposite of activating is deactivating, which is calling page_mode_deactivate on a loaded page-mode to prevent it from auto-enabling.
- Enabling
- Enabling a page-mode is when you turn a page-mode on, to have an effect on the current buffer. Activated page-modes are enabled automatically when a covered page is visited.
Some page-modes are loaded by default, and some page-modes, when loaded, are auto-activated. To deactivate a loaded page-mode, call page_mode_deactivate on it, like this:
page_mode_deactivate(xkcd_mode);
To activate a loaded page-mode, call page_mode_activate on it, like this:
page_mode_activate(xkcd_mode);
To load a non-default page-mode, call require on its module name, like this:
require("duckduckgo");To find out how to prevent a default page-mode from being loaded, see Modules.
3. Note About Key Bindings
Some page modes bind keys that override important Conkeror bindings like f and g. When such a page mode is in effect, you can still access shadowed bindings by using the prefix key C-z. For example, to call the follow command when gmail-mode is in effect, press C-z f.
4. Modes
4.1. DuckDuckGo
This page-mode provides most of DuckDuckGo's keyboard shortcuts, but by means of Conkeror's input system, so that they do not conflict with Conkeror's keys, and can easily be customized. To use this mode correctly, make sure you have DuckDuckGo's keyboard shortcuts disabled; this can be done either through the Settings panel on DuckDuckGo, or by passing the query variable kk=-1 in the url. The built-in DuckDuckGo webjump does this automatically.
require("duckduckgo");
4.1.1. Keymaps
- duckduckgo_keymap
down, j
duckduckgo-down
up, k
duckduckgo-up
/
duckduckgo-focus-search
r
duckduckgo-related-topics
m
duckduckgo-main-results
!
duckduckgo-bang-dropdown
d
duckduckgo-domain-search
- duckduckgo_anchor_keymap
return
duckduckgo-follow-current
- duckduckgo_select_keymap
return
duckduckgo-follow-current
4.2. Gmail Mode
See GMail.
4.3. Google Search Results Mode
This mode sets the default browser-objects of the follow commands to operate on the main search results links.
Optionally, this mode can bind the keys 1 through 9 to follow corresponding links to pages of search results. To bind those keys, put the following in your rc:
google_search_bind_number_shortcuts();
4.4. Google Calendar Mode
Google Calendar mode sets up a number of fallthrough keys to allow you to use Google Calendar's keyboard shortcuts.
4.5. Google Maps Mode
Google maps adds a few keyboard shortcuts for manipulating the map:
'C-b' is google-maps-pan-left: Pan the map left.
'C-f' is google-maps-pan-right: Pan the map right.
'C-p' is google-maps-pan-up: Pan the map up.
'C-n' is google-maps-pan-down: Pan the map down.
'C-c +' is google-maps-zoom-in: Zoom in on the map.
'C-c -' is google-maps-zoom-out: Zoom out of the map.
Note: In Conkeror versions older than 2011-09-23 (including version 0.9.4 and earlier), '+' and '-' were bound to zoom the map instead of the keys listed above.
4.6. Google Reader Mode
Google Reader mode sets up a number of fallthrough keys to allow you to use Google Reader' keyboard shortcuts.
4.7. Reddit Mode
The reddit mode provides a 'cursor', represented by highlighting a specific reddit entry in green, which can be moved up and down to interact with reddit items.
'j' is reddit-next-link: Move the 'cursor' to the next reddit entry.
'k' is reddit-prev-link: Move the 'cursor' to the previous reddit entry.
'h' is reddit-open-comments: Open the comments-page associated with the currently selected link.
',' is reddit-vote-up: Vote the currently selected link up.
'.' is reddit-vote-down: Vote the currently selected link down.
To open the current link, you can use return (open in current buffer) or o (open in new buffer). The copy command (bound to c by default) copies the URL of the linked article.
The reddit mode uses reddit_keymap.
4.7.1. Variables
- reddit_end_behavior
Controls what action is taken by the commands reddit-next-link and reddit-prev-link at the last or first link, respectively. The value is given as a string. Supported values are stop, wrap, and page. The default is stop, which results in a null-op. wrap causes the highlight bar to wrap to the other end of the list. page will make the commands go to the next (or previous) page of links.
4.8. StackOverflow Mode
This mode should work on any StackExchange site but is loaded by default for stackoverflow, serverfault, superuser and meta.stackoverflow. It provides a way to vote on questions, bound by default to V
4.9. Twitter Mode
Twitter mode sets up a number of fallthrough keys to allow you to use Twitter's keyboard shortcuts.
Twitter mode is not enabled by default. To use it, include it in your rc:
require("page-modes/twitter.js");
4.10. YouTube, Google Video, DailyMotion Modes
These modes facilitate downloading and running external programs on the embedded videos from these websites. Conkeror has a built-in "media" browser object class that is selected by the "e" prefix key. This browser object class uses a "media scraper", which by default just looks for URLs matching certain patterns in the webpage HTML source code, in order to prepare a list of embedded media files from which the user can choose using the completion mechanism. These page modes override the default media scraper with a more sophisticated one that works correctly on those sites. Furthermore, they set the media browser object class to be the default browser object class for the save, shell-command, and shell-command-url commands. As a result, for example, the save command invoked without a prefix while one of these page modes is enabled will automatically choose the embedded flash video file as the target to download.
4.11. XKCD Mode
The XKCD mode has local settings to make follow-next and follow-previous work for browsing the comics. Additionally, it can put the TITLE attribute of the comic in the page below the image. To enable that feature, put the following in your rc:
xkcd_add_title = true;
4.12. Wikipedia
Some of the information in this section may be outdated.
Quick walk-through: require("page-modes/wikipedia.js");
4.12.1. The didyoumean? module
For people not that great with spelling, there's the wikipedia-didyoumean.js module. The module works by checking whether the user is at the "article not found" page on any Wikipedia and looks for the "did you mean" box. If the "did you mean" tip is available, it immediately follows the tip. This works infinitely, so it will keep following the tip until it gets to an article that exists or until no more tips are available. If there are no tips available, but the search matched the text in any article on Wikipedia, it immediately goes to that article.
Example:
- The user tries to access an article on "hahahoho".
- There is no such article, but the didyoumean tip asks "Did you mean: hahaha", so Conkeror tries to access "hahaha".
- There is no such article, and no didyoumean tip. The first match in the search results is "Haha".
- Conkeror goes to "Haha".
To use this functionality, add this to your rc file:
require("wikipedia-didyoumean.js");This works quite well in conjunction with the Wikipedia webjumps. Writing e.g. "en bruse sprengstien" jumps all the way to the English Wikipedia article on Bruce Springsteen.