mirror of
https://github.com/Swarsel/hint-selectors.git
synced 2026-11-05 11:11:36 +01:00
Community database for "link hints" in keyboard-based browsing
- TypeScript 86.8%
- Nix 13.2%
| .github/workflows | ||
| integrations/glide | ||
| schema | ||
| scripts | ||
| sites | ||
| src | ||
| test | ||
| .gitignore | ||
| .prettierrc.json | ||
| CONTRIBUTING.md | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
hint-selectors
A community "database" of CSS selectors for "hints" in keyboard-based browsing :)
Format
Every domain is handled by a sites/<domain>.json file that holds all rules for it and its subdomains:
{
"domain": "github.com",
"rules": [
{ "include": "[class*=\"TreeView-item-content-text\"]" },
{ "exclude": "footer" },
{
"match": ["*://github.com/*/issues*"],
"sets": { "primary": "[data-listview-item-title-container] a" }
}
]
}
include: hinted in addition to the default hintable elementsexclude: removed from the default hintable elements and fromincludesets.primary: hinted exclusively, the main links of a pagematch: optional match patterns limiting a rule to some pages
Usage
Currently only the Glide browser is supported, but contributions for Tridactyl, qutebrowser, ... etc. are very welcome :)
Glide
You need hint-selectors.glide.ts. Then:
glide.include("hint-selectors.glide.ts").then(() => glide.g.hint_selectors!.setup());
Configuration
By default, f and F show the default hints plus the site's include.
setup can be customized:
keys.include: keys showing the default hints plusincludeminusexclude+ optional hint actionkeys.primary: key hinting only theprimaryset, unbound by defaulthint: receives{ selector?, include?, exclude?, action? }, to route through your own hint functionextra: local rules, keyed by domainremote: fetch updates instead of only using only the bundled data (off by default)
For example, it might look something like:
setup({
keys: {
include: [{ key: "f" }, { key: "F", action: "newtab-click" }],
primary: "c",
},
hint: ({ selector, include, action }) => start_hints({ selector, include, action }),
extra: {
"about.example": [{ include: ".clickable-row" }],
},
remote: {
url: "https://raw.githubusercontent.com/Swarsel/hint-selectors/dist/selectors.json",
refresh_hours: 24,
},
});