Module follow

Link hinting for luakit

Link hints allow interacting with web pages without the use of a mouse. When follow mode is entered, all clickable elements are highlighted and labeled with a short number. Typing either an element number or part of the element text will "follow" that hint, issuing a mouse click. This is most commonly used to click links without using the mouse and focus text input boxes. In addition, the ex-follow mode offers several variations on this behavior. For example, instead of clicking, the URI of a followed link can be copied into the clipboard. Another example would be hinting all images on the page, and opening the followed image in a new tab.

Using a custom character set for hint labels

If you prefer to use letters instead of numbers for hint labels (useful if you use a non-qwerty keyboard layout), this can be done by replacing the select.label_maker function:

-- Use "asdfqwerzxcv" for generating labels
local select = require "select"
select.label_maker = function (s)
    return s.sort(s.reverse(s.charset("asdfqwerzxcv")))
end

Note: this requires modifying the select module because the actual link hinting interface is implemented in the select module; the follow module provides the follow and ex-follow user interface on top of that.

Matching only hint labels, not element text

If you prefer not to match element text, and wish to select hints only by their label, this can be done by specifying the pattern_maker:

-- Match only hint label text
follow.pattern_maker = follow.pattern_styles.match_label

Ignoring element text case

To ignore element text case when filtering hints, set the following option:

-- Uncomment if you want to ignore case when matching
follow.ignore_case = true

Fields

follow.ignore_delay

Type: number
Read-write
Duration to ignore keypresses after following a hint. 200ms by default.

After each follow ignore all keys pressed by the user to prevent the accidental activation of other key bindings.

follow.stylesheet

Type: string
Read-write
CSS applied to the follow mode overlay.

follow.pattern_styles

Type: {[string]=function}
Read-only
Table of functions used to select a hint matching style.

follow.pattern_maker

Type: function
Read-write
Hint matching style functions.

follow.ignore_case

Type: boolean
Read-write
Whether text case should be ignored in follow mode. True by default.

follow.selectors

Type: {[string]=string}
Read-write
Element selectors used to filter elements to follow.

Attribution

Authors

Copyright