Skip to content
This repository has been archived by the owner on Mar 30, 2024. It is now read-only.

CIAvash/qutebrowser-userscripts

Repository files navigation

CIAvash::Qutebrowser::Userscripts

A collection of userscripts I wrote, and use in qutebrowser.

qutebrowser userscript dig url

Requirements

Clipboard

Selection/Completion

Rofi: used in select* userscripts

File Selection

Zenity: only used in open-file userscript

Programming Language

Raku - Right now regex is the slowest part of Raku, so the scripts doing any parsing will be slow

Module Manager

zef

Modules

zef install --deps-only --/test .

Features

Example configs to show the features

Open

# Open file with zenity
config.bind(',of', 'spawn --userscript open-file')

Hint: Follow

config.bind(',fd', 'hint links userscript open-domain')

Copy

# Copy title and URL of the page separated with newline
config.bind(',ytu', 'spawn --userscript yank title-url')
# Copy selected text and URL of the page separated with newline
config.bind(',ysu', 'spawn --userscript yank-text-url')
Copy: Hint
# Copy image URL
config.bind(',yiu', 'hint images userscript yank-url')
# Copy link text
config.bind(',ylt', 'hint links userscript yank-link-text')
config.bind(',rylt', 'hint --rapid links userscript yank-link-text')
# Copy link URL (pretty)
config.bind(',ylu', 'hint links userscript yank-url')
config.bind(',rylu', 'hint --rapid links userscript yank-url')
# Copy link's text and URL separated with newline
config.bind(',yla', 'hint links userscript yank-text-url')

Select with Rofi

Available actions:

  • Enter: Copy
  • Alt+1: Copy Separately (useful if you use a clipboard manager)
  • Alt+2: Open
  • Alt+3: Download
  • Shift+Enter: Select multiple items
  • Ctrl+Space: Set selected item as input text
  • Custom entry is allowed
config.bind(',sfu', 'spawn --userscript select Feeds')
config.bind(',sft', 'spawn --userscript select Feeds --with-title')
config.bind(',slu', 'spawn --userscript select Links')
config.bind(',slt', 'spawn --userscript select Links --with-title')
config.bind(',siu', 'spawn --userscript select Images')
config.bind(',sit', 'spawn --userscript select Images --with-title')
config.bind(',smu', 'spawn --userscript select MetaLinks')
config.bind(',smt', 'spawn --userscript select MetaLinks --with-title')
config.bind('<Alt-s>', 'spawn --userscript select', mode='command')
config.bind(',sa', 'spawn --userscript select-scroll-to-anchor')
Select: Hint
non_containers = ['a', 'button', 'img', 'svg', 'input', 'textarea', 'code', 'pre',
                  ''.join([f'h{n}' for n in range(1, 6)])]
c.hints.selectors['containers'] = [
    'body ' + ''.join([':not('+e+')' for e in non_containers])]

config.bind(',seu', 'hint containers userscript select-links')
config.bind(',set', 'hint containers userscript select-links-with-title')
Select: Dig (Get the URLs of all the segments a URL has)
config.bind(',sdd', 'spawn --userscript dig --domain')
config.bind(',sdu', 'spawn --userscript dig')
Select: Hint: Dig
config.bind(',sdlu', 'hint links userscript dig')
config.bind(',sdld', 'hint links userscript dig-domain')