/krabby

A keyboard interface to the web, inspired by Kakoune

Primary LanguageHTMLThe UnlicenseUnlicense

Platform Browser IRC Plugins

Krabby is a web extension (for Chrome, Firefox and surf) for keyboard-based navigation, inspired by Kakoune.

The main differences with existing extensions are: multiple selections, keyboard layout agnostic, SOV (subject–object–verb) constructs and simple interaction with external programs. It is also quite usable with the mouse.

TL;DR

WebExtensionKeyboard interfaceSubject–object–verb orderMultiple selectionsKakoune-inspired

Run the following in your terminal, then follow the onscreen instructions.

git clone https://github.com/alexherbo2/krabby
cd krabby
make install [static=no] [extensions=yes] [interactive=yes]

After installing, try to accomplish the following examples.

Opening links in a paragraph

Navigate to https://tuppervim.org and type:

f{hint}s[alt+a][alt+I][ctrl+enter][alt+x]

Explanation

  • f enters hint mode,
  • {hint} is a placeholder for you to select a link,
  • s creates a selection out of the active element,
  • Alt + a expands the region,
  • Alt + I selects all links,
  • Control + Enter opens selected links in the background.
  • Optionally, Alt + x will undo the operation (closing right tabs).
Play videos with mpv

Navigate to https://youtube.com/results?search_query=Berserk+AMV and type:

F{hint}{hint}<page-down>{hint}<escape>m

Explanation

  • F enters hint mode (lock),
  • {hint} is a placeholder for you to select 2 links,
  • Page Down scrolls one page down,
  • {hint} is a placeholder for you to select another link,
  • Escape leaves hint mode.
  • Finally, m opens the selection with mpv.

If you want to play around without installing, a live demo is available here.

Features

  • Subject–object–verb order. Learn more at Differences with Vi(m).
  • Keyboard layout agnostic. Maps to physical keys, but displays with the US layout.
  • Multiple selections as a central way of interacting
  • Powerful selection manipulation primitives
  • Link hints
  • External editor support. Open your favorite editor on text inputs.
  • Tab search
  • Contextual commands
  • Contextual help
  • Simple interaction with external programs
  • Usable with the mouse. You can for example create a selection by grabbing a link with the mouse and s to create the selection. Or create multiple selections by clicking on hints with F. If you hold Control or Command, you can even make selections with the mouse selection area.
  • Limited scope. Krabby is not Vim, nor Kakoune. Krabby is trying to be a navigation tool and some concepts from code editors don’t translate well. For example, there is no concept of mode in Krabby, but a system of contexts.
  • Composability. Composability is better than extensibility. Krabby tries hard to provide features that interact well with each other. For example, f and y are two building blocks to focus a link and yank its URL. Depending on the context, y will yank the page or a link URL.
  • Modular (think Emacs). Krabby is divided into multiple small projects. At its core Krabby just holds the configuration and grabs its functionalities from other projects.
  • Chrome, Firefox and surf support. It has also been tested on Opera, Vivaldi and Brave.

Demos

Download 3-gatsu no Lion episodes from HorribleSubs

Download 3-gatsu no Lion episodes from HorribleSubs YouTube Play Button · Download 3-gatsu no Lion episodes from HorribleSubs

Commands

  • f → Focus link
    • Input: o
  • s → Select active element
  • Alt + a → Select parent elements (2 times)
  • Alt + i → Select child elements (2 times)
  • Enter → Open link
  • Alt + i → Select child elements
  • Alt + k → Keep selections that match the given RegExp
    • Input: 720p
  • Alt + I → Select links
  • Alt + k → Keep selections that match the given RegExp
    • Input: Magnet
  • Alt + Shift + Enter → Open link in the associated application
Extract from Wikipedia the list of cities and towns in Russia

Extract from Wikipedia the list of cities and towns in Russia YouTube Play Button · Extract from Wikipedia the list of cities and towns in Russia

Commands

  • f → Focus link
    • Input: a, l
  • s → Select active element
  • Alt + a → Select parent elements (3 times)
  • S → Select elements that match the specified group of selectors
    • Input: tr td:first-child
  • Alt + I → Select links
  • Alt + y → Copy link text
Quickly move around a document with no table of contents

Quickly move around a document with no table of contents YouTube Play Button · Quickly move around a document with no table of contents

Commands

  • % → Select document
  • S → Select elements that match the specified group of selectors
    • Input: h1, h2, h3
  • ( → Focus previous selection
Tab search with dmenu

Tab search with dmenu YouTube Play Button · Tab search with dmenu

Commands

  • q → Tab search with dmenu
Playing videos in picture-in-picture mode

Playing videos in picture-in-picture mode YouTube Play Button · Playing videos in picture-in-picture mode

Commands

  • p → Toggle picture-in-picture mode
Opening links in a paragraph

Opening links in a paragraph YouTube Play Button · Opening links in a paragraph

Commands

  • f → Focus link
    • Input: e
  • s → Select active element
  • Alt + a → Select parent elements
  • Alt + I → Select links
  • Control + Enter → Open link in new tab
Play videos with mpv

Play videos with mpv YouTube Play Button · Play videos with mpv

Commands

  • f → Focus link
    • Input: a, w
  • s → Select active element
  • Alt + a → Select parent elements (3 times)
  • Alt + I → Select links
  • Alt + m → Play with mpv in reverse order
Copy selection with Pandoc

Copy selection with Pandoc YouTube Play Button · Copy selection with Pandoc

Commands

  • f → Focus link
    • Input: s
  • s → Select active element
  • Alt + a → Select parent elements (4 times)
  • Y → Copy selection, using an HTML filter
Copy multiple links

Copy multiple links YouTube Play Button · Copy multiple links

Commands

  • f → Focus link
    • Input: s
  • s → Select active element
  • Alt + a → Select parent elements (3 times)
  • Alt + i → Select child elements
  • Alt + ] → Select last child elements
  • Alt + ( → Select previous sibling elements
  • Alt + I → Select links
  • y → Copy link address
  • Y → Copy link address and text

See krabby-resources for all available demos.

Dependencies

Extensions

  • Commands (Chrome API to perform browser actions)
  • Shell (Chrome API to execute external commands)
  • Editor (Open an external editor to edit text inputs)
  • dmenu (Tab search with dmenu)

Installation

Run the following in your terminal, then follow the onscreen instructions.

make install [static=no] [extensions=yes] [interactive=yes]

Supported platforms

Browser compatibility

Web browser Support Engine Notes
Chrome Blink
Chromium Blink
Firefox Gecko Only developer or unbranded version
surf WebKit Limited support (does not have WebExtension features, such as native messaging)
Edge ? Blink
Opera Blink
Safari WebKit
Vivaldi Blink
Brave Blink

Credits

References