UP | HOME

Qutebrowser Configuration

Table of Contents

Import

from qutebrowser.config.configfiles import ConfigAPI
from qutebrowser.config.config import ConfigContainer

import sys, os

General config

# This is here so configs done via the GUI are still loaded.
# Remove it to not load settings done via the GUI.
# config.load_autoconfig()

# Aliases for commands. The keys of the given dictionary are the
c.aliases = {'w': 'session-save', 'q': 'quit', 'wq': 'quit --save'}

# Time interval (in milliseconds) between auto-saves of config/cookies/etc.
c.auto_save.interval = 15000

# Always restore open sites when qutebrowser is reopened.
c.auto_save.session = False

# Backend to use to display websites
c.backend = 'webengine'

# Require a confirmation before quitting the application.
# Valid values:
#   - always: Always show a confirmation.
#   - multiple-tabs: Show a confirmation if multiple tabs are opened.
#   - downloads: Show a confirmation if downloads are running
#   - never: Never show a confirmation.
c.confirm_quit = ['downloads']

Content

# Automatically start playing `<video>` elements
c.content.autoplay = False

c.content.notifications = False

# Allow websites to request geolocations.
c.content.geolocation = 'ask'

# Show javascript alerts.
c.content.javascript.alert = True

# Allow JavaScript to read from or write to the clipboard
c.content.javascript.can_access_clipboard = True

# Allow websites to record audio/video.
c.content.media_capture = 'ask'

# Allow pdf.js to view PDF files in the browser
c.content.pdfjs = False

# Proxy to use. In addition to the listed values, you can use a
# `socks://...` or `http://...` URL.
# Valid values:
#   - system: Use the system wide proxy.
#   - none: Don't use any proxy
c.content.proxy = 'system'

Downloads

# Directory to save downloads to
c.downloads.location.directory = '$HOME/Downloads/'

# Prompt the user for the download location
c.downloads.location.prompt = True

# Remember the last used download directory.
c.downloads.location.remember = True

# What to display in the download filename input.
# Valid values:
#   - path: Show only the download path.
#   - filename: Show only download filename.
#   - both: Show download path and filename.
c.downloads.location.suggestion = 'path'

# Where to show the downloaded files.
c.downloads.position = 'bottom'

# Duration (in milliseconds) to wait before removing finished downloads
c.downloads.remove_finished = 10000

Fonts

# Default monospace fonts
c.fonts.monospace = '"Hack Nerd Font Mono" "xos4 Terminus", Terminus, Monospace, "DejaVu Sans Mono", Monaco, "Bitstream Vera Sans Mono", "Andale Mono", "Courier New", Courier, "Liberation Mono", monospace, Fixed, Consolas, Terminal'

# Font used for prompts.
c.fonts.prompts = '10pt monospace'

# Font used in the statusbar.
c.fonts.statusbar = '10pt monospace'

# Font used in the tab bar.
c.fonts.tabs = '10pt monospace'

Hints

# When a hint can be automatically followed without pressing Enter.
# Valid values:
#   - always: Auto-follow whenever there is only a single hint on a page.
#   - unique-match: Auto-follow whenever there is a unique non-empty match in either the hint string (word mode) or filter (number mode).
#   - full-match: Follow the hint when the user typed the whole hint (letter, word or number mode) or the element's text (only in number mode).
#   - never: The user will always need to press Enter to follow a hint.
# c.hints.auto_follow = 'unique-match'

# Duration (in milliseconds) to ignore normal-mode key bindings after a
# successful auto-follow.
# c.hints.auto_follow_timeout = 0

# CSS border value for hints.
# c.hints.border = '1px solid #E3BE23'

# Characters used for hint strings.
# c.hints.chars = 'asdfghjkl'

# Dictionary file to be used by the word hints.
# c.hints.dictionary = '/usr/share/dict/words'

# Which implementation to use to find elements to hint.
# Valid values:
#   - javascript: Better but slower
#   - python: Slightly worse but faster
# c.hints.find_implementation = 'python'

# Hide unmatched hints in rapid mode.
# c.hints.hide_unmatched_rapid_hints = True

# Minimum number of characters used for hint strings.
# c.hints.min_chars = 1

# Mode to use for hints.
# Valid values:
#   - number: Use numeric hints. (In this mode you can also type letters from the hinted element to filter and reduce the number of elements that are hinted.)
#   - letter: Use the characters in the `hints.chars` setting.
#   - word: Use hints words based on the html elements and the extra words.
# c.hints.mode = 'letter'

# Comma-separated list of regular expressions to use for 'next' links.
# c.hints.next_regexes = ['\\bnext\\b', '\\bmore\\b', '\\bnewer\\b', '\\b[>→≫]\\b', '\\b(>>|»)\\b', '\\bcontinue\\b']

# Comma-separated list of regular expressions to use for 'prev' links.
# c.hints.prev_regexes = ['\\bprev(ious)?\\b', '\\bback\\b', '\\bolder\\b', '\\b[<←≪]\\b', '\\b(<<|«)\\b']

# Scatter hint key chains (like Vimium) or not (like dwb). Ignored for
# number hints.
# c.hints.scatter = True

# Make characters in hint strings uppercase.
# c.hints.uppercase = False

Input

# Enter insert mode if an editable element is clicked.
c.input.insert_mode.auto_enter = True

# Leave insert mode if a non-editable element is clicked.
c.input.insert_mode.auto_leave = True

# Automatically enter insert mode if an editable element is focused
# after loading the page.
c.input.insert_mode.auto_load = False

# Switch to insert mode when clicking flash and other plugins.
# c.input.insert_mode.plugins = False

# Include hyperlinks in the keyboard focus chain when tabbing.
# c.input.links_included_in_focus_chain = True

# Timeout (in milliseconds) for partially typed key bindings. If the
# current input forms only partial matches, the keystring will be
# cleared after this time.
# c.input.partial_timeout = 5000

# Enable Opera-like mouse rocker gestures. This disables the context
# menu.
# c.input.rocker_gestures = False

# Enable spatial navigation. Spatial navigation consists in the ability
# to navigate between focusable elements in a Web page, such as
# hyperlinks and form controls, by using Left, Right, Up and Down arrow
# keys. For example, if the user presses the Right key, heuristics
# determine whether there is an element he might be trying to reach
# towards the right and which element he probably wants.
# c.input.spatial_navigation = False

Keyhint

# Keychains that shouldn't be shown in the keyhint dialog. Globs are
# supported, so `;*` will blacklist all keychains starting with `;`. Use
# `*` to disable keyhints.
# c.keyhint.blacklist = []

# Time (in milliseconds) from pressing a key to seeing the keyhint
# dialog.
# c.keyhint.delay = 500

# Rounding radius (in pixels) for the edges of the keyhint dialog.
# c.keyhint.radius = 6

Messages

# Duration (in milliseconds) to show messages in the statusbar for. Set
# to 0 to never clear messages.
# c.messages.timeout = 2000

New Instance Options

# How to open links in an existing instance if a new one is launched.
# This happens when e.g. opening a link from a terminal. See
# `new_instance_open_target_window` to customize in which window the
# link is opened in.
# Valid values:
#   - tab: Open a new tab in the existing window and activate the window.
#   - tab-bg: Open a new background tab in the existing window and activate the window.
#   - tab-silent: Open a new tab in the existing window without activating the window.
#   - tab-bg-silent: Open a new background tab in the existing window without activating the window.
#   - window: Open in a new window.
# c.new_instance_open_target = 'tab'

# Which window to choose when opening links as new tabs. When
# `new_instance_open_target` is not set to `window`, this is ignored.
# Valid values:
#   - first-opened: Open new tabs in the first (oldest) opened window.
#   - last-opened: Open new tabs in the last (newest) opened window.
#   - last-focused: Open new tabs in the most recently focused window.
#   - last-visible: Open new tabs in the most recently visible window.
# c.new_instance_open_target_window = 'last-focused'

Prompt

# Show a filebrowser in upload/download prompts.
# c.prompt.filebrowser = True

# Rounding radius (in pixels) for the edges of prompts.
# c.prompt.radius = 8

Qt

# Additional arguments to pass to Qt, without leading `--`. With
# QtWebEngine, some Chromium arguments (see
# https://peter.sh/experiments/chromium-command-line-switches/ for a
# list) will work.
# c.qt.args = []

# Force a Qt platform to use. This sets the `QT_QPA_PLATFORM`
# environment variable and is useful to force using the XCB plugin when
# running QtWebEngine on Wayland.
# c.qt.force_platform = None

# Force software rendering for QtWebEngine. This is needed for
# QtWebEngine to work with Nouveau drivers and can be useful in other
# scenarios related to graphic issues.
# Valid values:
#   - software-opengl: Tell LibGL to use a software implementation of GL (`LIBGL_ALWAYS_SOFTWARE` / `QT_XCB_FORCE_SOFTWARE_OPENGL`)
#   - qt-quick: Tell Qt Quick to use a software renderer instead of OpenGL. (`QT_QUICK_BACKEND=software`)
#   - chromium: Tell Chromium to disable GPU support and use Skia software rendering instead. (`--disable-gpu`)
#   - none: Don't force software rendering.
# c.qt.force_software_rendering = 'none'

# Turn on Qt HighDPI scaling. This is equivalent to setting
# QT_AUTO_SCREEN_SCALE_FACTOR=1 in the environment. It's off by default
# as it can cause issues with some bitmap fonts. As an alternative to
# this, it's possible to set font sizes and the `zoom.default` setting.
# c.qt.highdpi = False

# When to use Chromium's low-end device mode. This improves the RAM
# usage of renderer processes, at the expense of performance.
# Valid values:
#   - always: Always use low-end device mode.
#   - auto: Decide automatically (uses low-end mode with < 1 GB available RAM).
#   - never: Never use low-end device mode.
# c.qt.low_end_device_mode = 'auto'

# Which Chromium process model to use. Alternative process models use
# less resources, but decrease security and robustness. See the
# following pages for more details:    -
# https://www.chromium.org/developers/design-documents/process-models
# - https://doc.qt.io/qt-5/qtwebengine-features.html#process-models
# Valid values:
#   - process-per-site-instance: Pages from separate sites are put into separate processes and separate visits to the same site are also isolated.
#   - process-per-site: Pages from separate sites are put into separate processes. Unlike Process per Site Instance, all visits to the same site will share an OS process. The benefit of this model is reduced memory consumption, because more web pages will share processes. The drawbacks include reduced security, robustness, and responsiveness.
#   - single-process: Run all tabs in a single process. This should be used for debugging purposes only, and it disables `:open --private`.
# c.qt.process_model = 'process-per-site-instance'

Scrolling

# When to show the scrollbar.
# Valid values:
#   - always: Always show the scrollbar.
#   - never: Never show the scrollbar.
#   - when-searching: Show the scrollbar when searching for text in the webpage. With the QtWebKit backend, this is equal to `never`.
# c.scrolling.bar = 'when-searching'

# Enable smooth scrolling for web pages. Note smooth scrolling does not
# work with the `:scroll-px` command.
# c.scrolling.smooth = False

Search

# When to find text on a page case-insensitively.
# Valid values:
#   - always: Search case-insensitively.
#   - never: Search case-sensitively.
#   - smart: Search case-sensitively if there are capital characters.
# c.search.ignore_case = 'smart'

# Find text on a page incrementally, renewing the search for each typed
# character.
# c.search.incremental = True

Session

# Name of the session to save by default. If this is set to null, the
# session which was last loaded is saved.
# c.session.default_name = None

# Load a restored tab as soon as it takes focus.
# c.session.lazy_restore = False

Spell Check

Languages to use for spell checking. You can check for available languages and install dictionaries using scripts/dictcli.py. Run the script with -h/–help for instructions. Valid values:

  • af-ZA: Afrikaans (South Africa)
  • bg-BG: Bulgarian (Bulgaria)
  • ca-ES: Catalan (Spain)
  • cs-CZ: Czech (Czech Republic)
  • da-DK: Danish (Denmark)
  • de-DE: German (Germany)
  • el-GR: Greek (Greece)
  • en-AU: English (Australia)
  • en-CA: English (Canada)
  • en-GB: English (United Kingdom)
  • en-US: English (United States)
  • es-ES: Spanish (Spain)
  • et-EE: Estonian (Estonia)
  • fa-IR: Farsi (Iran)
  • fo-FO: Faroese (Faroe Islands)
  • fr-FR: French (France)
  • he-IL: Hebrew (Israel)
  • hi-IN: Hindi (India)
  • hr-HR: Croatian (Croatia)
  • hu-HU: Hungarian (Hungary)
  • id-ID: Indonesian (Indonesia)
  • it-IT: Italian (Italy)
  • ko: Korean
  • lt-LT: Lithuanian (Lithuania)
  • lv-LV: Latvian (Latvia)
  • nb-NO: Norwegian (Norway)
  • nl-NL: Dutch (Netherlands)
  • pl-PL: Polish (Poland)
  • pt-BR: Portuguese (Brazil)
  • pt-PT: Portuguese (Portugal)
  • ro-RO: Romanian (Romania)
  • ru-RU: Russian (Russia)
  • sh: Serbo-Croatian
  • sk-SK: Slovak (Slovakia)
  • sl-SI: Slovenian (Slovenia)
  • sq: Albanian
  • sr: Serbian
  • sv-SE: Swedish (Sweden)
  • ta-IN: Tamil (India)
  • tg-TG: Tajik (Tajikistan)
  • tr-TR: Turkish (Turkey)
  • uk-UA: Ukrainian (Ukraine)
  • vi-VN: Vietnamese (Viet Nam)
c.spellcheck.languages = ['en-US', 'fr-FR']

Status Bar

# Hide the statusbar unless a message is shown.
# c.statusbar.hide = False

# Padding (in pixels) for the statusbar.
# c.statusbar.padding = {'top': 1, 'bottom': 1, 'left': 0, 'right': 0}

# Position of the status bar.
# Valid values:
#   - top
#   - bottom
# c.statusbar.position = 'bottom'

# List of widgets displayed in the statusbar.
# Valid values:
#   - url: Current page URL.
#   - scroll: Percentage of the current page position like `10%`.
#   - scroll_raw: Raw percentage of the current page position like `10`.
#   - history: Display an arrow when possible to go back/forward in history.
#   - tabs: Current active tab, e.g. `2`.
#   - keypress: Display pressed keys when composing a vi command.
#   - progress: Progress bar for the current page loading.
# c.statusbar.widgets = ['keypress', 'url', 'scroll', 'history', 'tabs', 'progress']

Tabs

# Open new tabs (middleclick/ctrl+click) in the background.
c.tabs.background = True

# Mouse button with which to close tabs.
c.tabs.close_mouse_button = 'right'

# How to behave when the close mouse button is pressed on the tab bar.
# Valid values:
#   - new-tab: Open a new tab.
#   - close-current: Close the current tab.
#   - close-last: Close the last tab.
#   - ignore: Don't do anything.
# c.tabs.close_mouse_button_on_bar = 'new-tab'

# Width (in pixels) of the progress indicator (0 to disable).
# c.tabs.indicator.width = 3

# How to behave when the last tab is closed.
# Valid values:
#   - ignore: Don't do anything.
#   - blank: Load a blank page.
#   - startpage: Load the start page.
#   - default-page: Load the default page.
#   - close: Close the window.
c.tabs.last_close = 'close'

# When switching tabs, what input mode is applied.
# Valid values:
#   - persist: Retain the current mode.
#   - restore: Restore previously saved mode.
#   - normal: Always revert to normal mode.
# c.tabs.mode_on_change = 'normal'

# Switch between tabs using the mouse wheel.
c.tabs.mousewheel_switching = False

# Position of new tabs opened from another tab.
# Valid values:
#   - prev: Before the current tab.
#   - next: After the current tab.
#   - first: At the beginning.
#   - last: At the end.
# c.tabs.new_position.related = 'next'

# Position of new tabs which aren't opened from another tab.
# Valid values:
#   - prev: Before the current tab.
#   - next: After the current tab.
#   - first: At the beginning.
#   - last: At the end.
# c.tabs.new_position.unrelated = 'last'

# Padding (in pixels) around text for tabs.
# c.tabs.padding = {'top': 0, 'bottom': 0, 'left': 5, 'right': 5}

# Shrink pinned tabs down to their contents.
# c.tabs.pinned.shrink = True

# Position of the tab bar.
c.tabs.position = 'left'

# Which tab to select when the focused tab is removed.
c.tabs.select_on_remove = 'next'

# Format to use for the tab title. The following placeholders are
# defined:  * `{perc}`: Percentage as a string like `[10%]`. *
# `{perc_raw}`: Raw percentage, e.g. `10`. * `{title}`: Title of the
# current web page. * `{title_sep}`: The string ` - ` if a title is set,
# empty otherwise. * `{index}`: Index of this tab. * `{id}`: Internal
# tab ID of this tab. * `{scroll_pos}`: Page scroll position. *
# `{host}`: Host of the current web page. * `{backend}`: Either
# ''webkit'' or ''webengine'' * `{private}`: Indicates when private mode
# is enabled. * `{current_url}`: URL of the current web page. *
# `{protocol}`: Protocol (http/https/...) of the current web page. *
# `{audio}`: Indicator for audio/mute status.
# c.tabs.title.format = '{audio}{index}: {title}'

# Width (in pixels or as percentage of the window) of the tab bar if it's vertical.
c.tabs.width = 30

# Wrap when changing tabs.
c.tabs.wrap = False

Urls

# What search to start when something else than a URL is entered.
# Valid values:
#   - naive: Use simple/naive check.
#   - dns: Use DNS requests (might be slow!).
#   - never: Never search automatically.
# c.url.auto_search = 'naive'

# URL segments where `:navigate increment/decrement` will search for a
# number.
# Valid values:
#   - host
#   - port
#   - path
#   - query
#   - anchor
# c.url.incdec_segments = ['path', 'query']

# Search engines which can be used via the address bar. Maps a search
# engine name (such as `DEFAULT`, or `ddg`) to a URL with a `{}`
# placeholder. The placeholder will be replaced by the search term, use
# `{{` and `}}` for literal `{`/`}` signs. The search engine named
# `DEFAULT` is used when `url.auto_search` is turned on and something
# else than a URL was entered to be opened. Other search engines can be
# used by prepending the search engine name to the search term, e.g.
# `:open google qutebrowser`.
c.url.searchengines = {
    'DEFAULT': 'https://www.duckduckgo.org/?q={}',
    'aw': 'https://wiki.archlinux.org/?search={}',
    'wi': 'https://en.wikipedia.org/wiki/Special:Search?search={}',
    'go': 'https://www.google.com/search?q={}',
    'gc': 'https://scholar.google.fr/scholar?hl=fr&as_sdt=0%2C5&q={}&btnG=',
    'gm': 'https://www.google.com/maps/search/{}/',
    'yt': 'https://www.youtube.com/results?search_query={}',
    'gh': 'https://github.com/search?q={}',
    're': 'https://www.reddit.com/search?q={}',
    'lb': 'http://188.240.208.184/search.php?req={}',
    'la': 'http://188.240.208.184/scimag/index.php?s={}',
    'sm': 'https://www.openstreetmap.org/search?query={}',
    'am': 'https://www.amazon.fr/s?k={}',
    'md': 'https://fr.mathworks.com/help/search.html?qdoc={}&submitsearch=',
}

# Page(s) to open at the start.
c.url.start_pages = ['https://start.duckduckgo.com']

Window

# Hide the window decoration.  This setting requires a restart on
# Wayland.
# c.window.hide_decoration = False

# Format to use for the window title. The same placeholders like for
# `tabs.title.format` are defined.
# c.window.title_format = '{perc}{title}{title_sep}qutebrowser'

Bindings

Normal Mode

# config.bind("'", 'enter-mode jump_mark')

# config.bind('+', 'zoom-in')
# config.bind('-', 'zoom-out')

# config.bind('.', 'repeat-command')
# config.bind('/', 'set-cmd-text /')
# config.bind(':', 'set-cmd-text :')

# config.bind(';I', 'hint images tab')
# config.bind(';O', 'hint links fill :open -t -r {hint-url}')
# config.bind(';R', 'hint --rapid links window')
# config.bind(';Y', 'hint links yank-primary')
# config.bind(';b', 'hint all tab-bg')
# config.bind(';d', 'hint links download')
# config.bind(';f', 'hint all tab-fg')
# config.bind(';h', 'hint all hover')
# config.bind(';i', 'hint images')
# config.bind(';o', 'hint links fill :open {hint-url}')
# config.bind(';r', 'hint --rapid links tab-bg')
# config.bind(';t', 'hint inputs')
# config.bind(';y', 'hint links yank')

# config.bind('<Alt-1>', 'tab-focus 1')
# config.bind('<Alt-2>', 'tab-focus 2')
# config.bind('<Alt-3>', 'tab-focus 3')
# config.bind('<Alt-4>', 'tab-focus 4')
# config.bind('<Alt-5>', 'tab-focus 5')
# config.bind('<Alt-6>', 'tab-focus 6')
# config.bind('<Alt-7>', 'tab-focus 7')
# config.bind('<Alt-8>', 'tab-focus 8')
# config.bind('<Alt-9>', 'tab-focus -1')
# config.bind('<Alt-m>', 'tab-mute')

# config.bind('<Ctrl-A>', 'navigate increment')

# config.bind('<Ctrl-Alt-p>', 'print')

# config.bind('<Ctrl-B>', 'scroll-page 0 -1')
# config.bind('<Ctrl-D>', 'scroll-page 0 0.5')
# config.bind('<Ctrl-F5>', 'reload -f')
# config.bind('<Ctrl-F>', 'scroll-page 0 1')
# config.bind('<Ctrl-N>', 'open -w')
# config.bind('<Ctrl-PgDown>', 'tab-next')
# config.bind('<Ctrl-PgUp>', 'tab-prev')
# config.bind('<Ctrl-Q>', 'quit')
# config.bind('<Ctrl-Return>', 'follow-selected -t')
# config.bind('<Ctrl-Shift-N>', 'open -p')
# config.bind('<Ctrl-Shift-T>', 'undo')
# config.bind('<Ctrl-Shift-Tab>', 'nop')
# config.bind('<Ctrl-Shift-W>', 'close')
# config.bind('<Ctrl-T>', 'open -t')
# config.bind('<Ctrl-Tab>', 'tab-focus last')
# config.bind('<Ctrl-U>', 'scroll-page 0 -0.5')
# config.bind('<Ctrl-V>', 'enter-mode passthrough')
# config.bind('<Ctrl-W>', 'tab-close')
# config.bind('<Ctrl-X>', 'navigate decrement')
# config.bind('<Ctrl-^>', 'tab-focus last')
# config.bind('<Ctrl-h>', 'home')
# config.bind('<Ctrl-p>', 'tab-pin')
# config.bind('<Ctrl-s>', 'stop')
# config.bind('<Escape>', 'clear-keychain ;; search ;; fullscreen --leave')
# config.bind('<F11>', 'fullscreen')
# config.bind('<F5>', 'reload')
# config.bind('<Return>', 'follow-selected')
# config.bind('<back>', 'back')
# config.bind('<forward>', 'forward')
# config.bind('=', 'zoom')
# config.bind('?', 'set-cmd-text ?')
# config.bind('@', 'run-macro')
# config.bind('B', 'set-cmd-text -s :quickmark-load -t')
# config.bind('D', 'tab-close -o')
# config.bind('F', 'hint all tab')
# config.bind('G', 'scroll-to-perc')
# config.bind('H', 'back')
# config.bind('J', 'tab-next')
# config.bind('K', 'tab-prev')
# config.bind('L', 'forward')
# config.bind('M', 'bookmark-add')
# config.bind('N', 'search-prev')
# config.bind('O', 'set-cmd-text -s :open -t')
# config.bind('PP', 'open -t -- {primary}')
# config.bind('Pp', 'open -t -- {clipboard}')
# config.bind('R', 'reload -f')
# config.bind('Sb', 'open qute://bookmarks#bookmarks')
# config.bind('Sh', 'open qute://history')
# config.bind('Sq', 'open qute://bookmarks')
# config.bind('Ss', 'open qute://settings')
# config.bind('T', 'tab-focus')
# config.bind('ZQ', 'quit')
# config.bind('ZZ', 'quit --save')
# config.bind('[[', 'navigate prev')
# config.bind(']]', 'navigate next')
# config.bind('`', 'enter-mode set_mark')
# config.bind('ad', 'download-cancel')
# config.bind('b', 'set-cmd-text -s :quickmark-load')
# config.bind('cd', 'download-clear')
# config.bind('co', 'tab-only')
# config.bind('d', 'tab-close')
# config.bind('f', 'hint')
# config.bind('g$', 'tab-focus -1')
# config.bind('g0', 'tab-focus 1')
# config.bind('gB', 'set-cmd-text -s :bookmark-load -t')
# config.bind('gC', 'tab-clone')
# config.bind('gD', 'tab-give')
# config.bind('gO', 'set-cmd-text :open -t -r {url:pretty}')
# config.bind('gU', 'navigate up -t')
# config.bind('g^', 'tab-focus 1')
# config.bind('ga', 'open -t')
# config.bind('gb', 'set-cmd-text -s :bookmark-load')
# config.bind('gd', 'download')
# config.bind('gf', 'view-source')
# config.bind('gg', 'scroll-to-perc 0')
# config.bind('gi', 'hint inputs --first')
# config.bind('gl', 'tab-move -')
# config.bind('gm', 'tab-move')
# config.bind('go', 'set-cmd-text :open {url:pretty}')
# config.bind('gr', 'tab-move +')
# config.bind('gt', 'set-cmd-text -s :buffer')
# config.bind('gu', 'navigate up')

# Move tabs around
config.bind('gK', 'tab-move -')
config.bind('gJ', 'tab-move +')

# config.bind('h', 'scroll left')
# config.bind('i', 'enter-mode insert')
# config.bind('j', 'scroll down')
# config.bind('k', 'scroll up')
# config.bind('l', 'scroll right')
# config.bind('m', 'quickmark-save')
# config.bind('n', 'search-next')
# config.bind('o', 'set-cmd-text -s :open')
# config.bind('pP', 'open -- {primary}')
# config.bind('pp', 'open -- {clipboard}')
# config.bind('q', 'record-macro')
# config.bind('r', 'reload')
# config.bind('sf', 'save')
# config.bind('sk', 'set-cmd-text -s :bind')
# config.bind('sl', 'set-cmd-text -s :set -t')
# config.bind('ss', 'set-cmd-text -s :set')
# config.bind('tIH', 'config-cycle -p -u *://*.{url:host}/* content.images ;; reload')
# config.bind('tIh', 'config-cycle -p -u *://{url:host}/* content.images ;; reload')
# config.bind('tIu', 'config-cycle -p -u {url} content.images ;; reload')
# config.bind('tPH', 'config-cycle -p -u *://*.{url:host}/* content.plugins ;; reload')
# config.bind('tPh', 'config-cycle -p -u *://{url:host}/* content.plugins ;; reload')
# config.bind('tPu', 'config-cycle -p -u {url} content.plugins ;; reload')
# config.bind('tSH', 'config-cycle -p -u *://*.{url:host}/* content.javascript.enabled ;; reload')
# config.bind('tSh', 'config-cycle -p -u *://{url:host}/* content.javascript.enabled ;; reload')
# config.bind('tSu', 'config-cycle -p -u {url} content.javascript.enabled ;; reload')
# config.bind('th', 'back -t')
# config.bind('tiH', 'config-cycle -p -t -u *://*.{url:host}/* content.images ;; reload')
# config.bind('tih', 'config-cycle -p -t -u *://{url:host}/* content.images ;; reload')
# config.bind('tiu', 'config-cycle -p -t -u {url} content.images ;; reload')
# config.bind('tl', 'forward -t')
# config.bind('tpH', 'config-cycle -p -t -u *://*.{url:host}/* content.plugins ;; reload')
# config.bind('tph', 'config-cycle -p -t -u *://{url:host}/* content.plugins ;; reload')
# config.bind('tpu', 'config-cycle -p -t -u {url} content.plugins ;; reload')
# config.bind('tsH', 'config-cycle -p -t -u *://*.{url:host}/* content.javascript.enabled ;; reload')
# config.bind('tsh', 'config-cycle -p -t -u *://{url:host}/* content.javascript.enabled ;; reload')
# config.bind('tsu', 'config-cycle -p -t -u {url} content.javascript.enabled ;; reload')
# config.bind('u', 'undo')
# config.bind('v', 'enter-mode caret')
# config.bind('wB', 'set-cmd-text -s :bookmark-load -w')
# config.bind('wO', 'set-cmd-text :open -w {url:pretty}')
# config.bind('wP', 'open -w -- {primary}')
# config.bind('wb', 'set-cmd-text -s :quickmark-load -w')
# config.bind('wf', 'hint all window')
# config.bind('wh', 'back -w')
# config.bind('wi', 'inspector')
# config.bind('wl', 'forward -w')
# config.bind('wo', 'set-cmd-text -s :open -w')
# config.bind('wp', 'open -w -- {clipboard}')
# config.bind('xO', 'set-cmd-text :open -b -r {url:pretty}')
# config.bind('xo', 'set-cmd-text -s :open -b')
# config.bind('yD', 'yank domain -s')
# config.bind('yP', 'yank pretty-url -s')
# config.bind('yT', 'yank title -s')
# config.bind('yY', 'yank -s')
# config.bind('yd', 'yank domain')
# config.bind('yp', 'yank pretty-url')
# config.bind('yt', 'yank title')
# config.bind('yy', 'yank')
# config.bind('{{', 'navigate prev -t')
# config.bind('}}', 'navigate next -t')

Go to specific websites

config.bind('gy', 'open -o https://www.youtube.com/feed/subscriptions')
config.bind('gr', 'open -o https://www.reddit.com/')

Caret mode

# config.bind('$', 'move-to-end-of-line', mode='caret')
# config.bind('0', 'move-to-start-of-line', mode='caret')
# config.bind('<Ctrl-Space>', 'drop-selection', mode='caret')
# config.bind('<Escape>', 'leave-mode', mode='caret')
# config.bind('<Return>', 'yank selection', mode='caret')
# config.bind('<Space>', 'toggle-selection', mode='caret')
# config.bind('G', 'move-to-end-of-document', mode='caret')
# config.bind('H', 'scroll left', mode='caret')
# config.bind('J', 'scroll down', mode='caret')
# config.bind('K', 'scroll up', mode='caret')
# config.bind('L', 'scroll right', mode='caret')
# config.bind('Y', 'yank selection -s', mode='caret')
# config.bind('[', 'move-to-start-of-prev-block', mode='caret')
# config.bind(']', 'move-to-start-of-next-block', mode='caret')
# config.bind('b', 'move-to-prev-word', mode='caret')
# config.bind('c', 'enter-mode normal', mode='caret')
# config.bind('e', 'move-to-end-of-word', mode='caret')
# config.bind('gg', 'move-to-start-of-document', mode='caret')
# config.bind('h', 'move-to-prev-char', mode='caret')
# config.bind('j', 'move-to-next-line', mode='caret')
# config.bind('k', 'move-to-prev-line', mode='caret')
# config.bind('l', 'move-to-next-char', mode='caret')
# config.bind('v', 'toggle-selection', mode='caret')
# config.bind('w', 'move-to-next-word', mode='caret')
# config.bind('y', 'yank selection', mode='caret')
# config.bind('{', 'move-to-end-of-prev-block', mode='caret')
# config.bind('}', 'move-to-end-of-next-block', mode='caret')

Bindings for command mode

# config.bind('<Alt-B>', 'rl-backward-word', mode='command')
# config.bind('<Alt-Backspace>', 'rl-backward-kill-word', mode='command')
# config.bind('<Alt-D>', 'rl-kill-word', mode='command')
# config.bind('<Alt-F>', 'rl-forward-word', mode='command')
# config.bind('<Ctrl-?>', 'rl-delete-char', mode='command')
# config.bind('<Ctrl-A>', 'rl-beginning-of-line', mode='command')
# config.bind('<Ctrl-B>', 'rl-backward-char', mode='command')
# config.bind('<Ctrl-C>', 'completion-item-yank', mode='command')
# config.bind('<Ctrl-D>', 'completion-item-del', mode='command')
# config.bind('<Ctrl-E>', 'rl-end-of-line', mode='command')
# config.bind('<Ctrl-F>', 'rl-forward-char', mode='command')
# config.bind('<Ctrl-H>', 'rl-backward-delete-char', mode='command')
# config.bind('<Ctrl-K>', 'rl-kill-line', mode='command')
# config.bind('<Ctrl-N>', 'command-history-next', mode='command')
# config.bind('<Ctrl-P>', 'command-history-prev', mode='command')
# config.bind('<Ctrl-Return>', 'command-accept --rapid', mode='command')
# config.bind('<Ctrl-Shift-C>', 'completion-item-yank --sel', mode='command')
# config.bind('<Ctrl-Shift-Tab>', 'completion-item-focus prev-category', mode='command')
# config.bind('<Ctrl-Tab>', 'completion-item-focus next-category', mode='command')
# config.bind('<Ctrl-U>', 'rl-unix-line-discard', mode='command')
# config.bind('<Ctrl-W>', 'rl-unix-word-rubout', mode='command')
# config.bind('<Ctrl-Y>', 'rl-yank', mode='command')
# config.bind('<Down>', 'completion-item-focus --history next', mode='command')
# config.bind('<Escape>', 'leave-mode', mode='command')
# config.bind('<Return>', 'command-accept', mode='command')
# config.bind('<Shift-Delete>', 'completion-item-del', mode='command')
# config.bind('<Shift-Tab>', 'completion-item-focus prev', mode='command')
# config.bind('<Tab>', 'completion-item-focus next', mode='command')
# config.bind('<Up>', 'completion-item-focus --history prev', mode='command')

Bindings for hint mode

# config.bind('<Ctrl-B>', 'hint all tab-bg', mode='hint')
# config.bind('<Ctrl-F>', 'hint links', mode='hint')
# config.bind('<Ctrl-R>', 'hint --rapid links tab-bg', mode='hint')
# config.bind('<Escape>', 'leave-mode', mode='hint')
# config.bind('<Return>', 'follow-hint', mode='hint')

Bindings for insert mode

# config.bind('<Ctrl-E>', 'open-editor', mode='insert')
# config.bind('<Escape>', 'leave-mode', mode='insert')
# config.bind('<Shift-Ins>', 'insert-text {primary}', mode='insert')

Bindings for passthrough mode

# config.bind('<Shift-Escape>', 'leave-mode', mode='passthrough')

Bindings for prompt mode

# config.bind('<Alt-B>', 'rl-backward-word', mode='prompt')
# config.bind('<Alt-Backspace>', 'rl-backward-kill-word', mode='prompt')
# config.bind('<Alt-D>', 'rl-kill-word', mode='prompt')
# config.bind('<Alt-F>', 'rl-forward-word', mode='prompt')
# config.bind('<Alt-Shift-Y>', 'prompt-yank --sel', mode='prompt')
# config.bind('<Alt-Y>', 'prompt-yank', mode='prompt')
# config.bind('<Ctrl-?>', 'rl-delete-char', mode='prompt')
# config.bind('<Ctrl-A>', 'rl-beginning-of-line', mode='prompt')
# config.bind('<Ctrl-B>', 'rl-backward-char', mode='prompt')
# config.bind('<Ctrl-E>', 'rl-end-of-line', mode='prompt')
# config.bind('<Ctrl-F>', 'rl-forward-char', mode='prompt')
# config.bind('<Ctrl-H>', 'rl-backward-delete-char', mode='prompt')
# config.bind('<Ctrl-K>', 'rl-kill-line', mode='prompt')
# config.bind('<Ctrl-P>', 'prompt-open-download --pdfjs', mode='prompt')
# config.bind('<Ctrl-U>', 'rl-unix-line-discard', mode='prompt')
# config.bind('<Ctrl-W>', 'rl-unix-word-rubout', mode='prompt')
# config.bind('<Ctrl-X>', 'prompt-open-download', mode='prompt')
# config.bind('<Ctrl-Y>', 'rl-yank', mode='prompt')
# config.bind('<Down>', 'prompt-item-focus next', mode='prompt')
# config.bind('<Escape>', 'leave-mode', mode='prompt')
# config.bind('<Return>', 'prompt-accept', mode='prompt')
# config.bind('<Shift-Tab>', 'prompt-item-focus prev', mode='prompt')
# config.bind('<Tab>', 'prompt-item-focus next', mode='prompt')
# config.bind('<Up>', 'prompt-item-focus prev', mode='prompt')

Bindings for register mode

# config.bind('<Escape>', 'leave-mode', mode='register')

Bindings for yesno mode

# config.bind('<Alt-Shift-Y>', 'prompt-yank --sel', mode='yesno')
# config.bind('<Alt-Y>', 'prompt-yank', mode='yesno')
# config.bind('<Escape>', 'leave-mode', mode='yesno')
# config.bind('<Return>', 'prompt-accept', mode='yesno')
# config.bind('n', 'prompt-accept no', mode='yesno')
# config.bind('y', 'prompt-accept yes', mode='yesno')

Custom Bindings

Use Pass to fill password and username (configuration is done in ~/.config/qutebrowser/password_fill_rc).

config.bind(',p', 'spawn --userscript password_fill')
# config.bind(',P', 'spawn --userscript qute-bitwarden')

Open Youtube video using MPV

config.bind(',m', 'spawn --detach mpv --force-window yes {url}')
config.bind(',M', 'hint links spawn --detach mpv --force-window yes {hint-url}')

Cast Youtube to Chromecast

config.bind(',c', 'spawn --userscript ~/.config/qutebrowser/userscripts/cast.sh {url}')
config.bind(',C', 'hint links spawn --userscript ~/.config/qutebrowser/userscripts/cast.sh {hint-url}')

Add url to refile.org

config.bind(',r', 'spawn --userscript ~/.config/qutebrowser/userscripts/add-to-orgmode-refile.sh')

Add page to Bookmarks

config.bind(',b', 'spawn buku -a {url}')
config.bind(',B', 'spawn --userscript ~/.config/qutebrowser/userscripts/buku-rofi.sh')

Open bookmark using buku

config.bind(',o', 'spawn ~/bin/bukurun')

Org Capture

config.bind(',r', 'spawn --userscript ~/.config/qutebrowser/userscripts/org-capture.sh')
config.bind(',R', 'hint links userscript ~/.config/qutebrowser/userscripts/org-capture.sh')
# config.bind(",c", "spawn --userscript org-store-link")
# config.bind(";c", "hint links userscript org-store-link")
# config.bind(",w", "spawn --userscript org-capture-web")
# config.bind(";w", "hint links userscript org-capture-web")

Annotate with Hypothesis

config.bind(',a', "jseval javascript:(function(){window.hypothesisConfig=function(){return{showHighlights:true,appType:'bookmarklet'};};var d=document,s=d.createElement('script');s.setAttribute('src','https://hypothes.is/embed.js');d.body.appendChild(s)})();")

See price in CamelCamelCamel

config.bind(',P', ":open -t https://fr.camelcamelcamel.com/search?sq={url}")

Userscripts

Cast Youtube to Chromecast

youtube-dl -o - $1 | castnow --quiet -

Add url to refile.org

Add the date and time of add to properties.

echo "* TODO $QUTE_TITLE" >> ~/Dropbox/org/refile.org
echo "$QUTE_URL" >> ~/Dropbox/org/refile.org
echo "message-info 'Added to refile.org'" >> "$QUTE_FIFO"

Passwordfillrc

# Show all password fields in the menu
query_entries() {
    # safe queried url for choose_entry
    # the subdomains are removed
    export queried_url=$(expr match ".$1" '.*\.\(.*\..*\)')
    mapfile -t files < <(find -L "$PREFIX" -iname '*.gpg' -printf '%P\n' |sed 's,\.gpg$,,')
}

# Even if there is only one entry, always show a menu
# for user confirmation.
choose_entry() {
    MENU_COMMAND=(
        rofi -dmenu
            -p "qutebrowser> "
            -filter "$queried_url"
            -mesg $'Pick a password entry for <b>'"${QUTE_URL//&/&amp;}"'</b>'
    )
    file=$( printf "%s\n" "${files[@]}" | "${MENU_COMMAND[@]}" )
}

Org-Capture

readonly CAPTURE_SCRIPT=~/scripts/org-protocol-capture-html.sh

if [[ "$QUTE_MODE" = "hints" ]]; then
    # if we start with hints, we juste want to capture the URL
    $CAPTURE_SCRIPT --template "pu" --url "${QUTE_URL}"
elif [[ -n "$QUTE_SELECTED_TEXT" ]]; then
    # if text is selected, we want to capture the text
    $CAPTURE_SCRIPT --template "pt" --heading "${QUTE_TITLE}" --url "${QUTE_URL}" "${QUTE_SELECTED_TEXT}"
else
    # if no text is selected, we want to capture the url
    $CAPTURE_SCRIPT --template "pu" --heading "${QUTE_TITLE}" --url "${QUTE_URL}"
fi

Add Url to Buku using Rofi

title=$(echo "$QUTE_TITLE" | rofi -p "Title" -dmenu -lines 1)
tags=$(buku -t --nc --np | sed -e 's/\s*[[:digit:]]*\.\s*\(.*\)\s*([[:digit:]]*)\s*/\1/' -e '/^\s*$/d' | sort | uniq | rofi -p "Tags" -dmenu)

buku --add "$QUTE_URL" --tag "$tags" --title "$title"

Author: Dehaeze Thomas

Created: 2020-01-11 sam. 22:00