literate-dotfiles/docs/qutebrowser.html

787 lines
23 KiB
HTML
Raw Normal View History

2020-01-11 22:04:45 +01:00
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
2020-05-26 08:40:15 +02:00
<!-- 2020-05-26 mar. 08:39 -->
2020-01-11 22:04:45 +01:00
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Qutebrowser Configuration</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Dehaeze Thomas" />
2020-01-11 22:22:46 +01:00
<link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
<script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="./js/readtheorg.js"></script>
2020-01-11 22:04:45 +01:00
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="./index.html"> UP </a>
|
<a accesskey="H" href="./index.html"> HOME </a>
</div><div id="content">
<h1 class="title">Qutebrowser Configuration</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org22d9ea5">Import</a></li>
<li><a href="#org89786f6">General config</a></li>
<li><a href="#org870403a">Content</a></li>
2020-03-19 10:42:30 +01:00
<li><a href="#orgdefaa05">Editor</a></li>
2020-01-11 22:04:45 +01:00
<li><a href="#org409baa5">Downloads</a></li>
<li><a href="#orgdc50649">Fonts</a></li>
<li><a href="#orge859d77">Input</a></li>
<li><a href="#org6a05c89">New Instance Options</a></li>
<li><a href="#orgc336fd6">Spell Check</a></li>
<li><a href="#org1d64606">Status Bar</a></li>
<li><a href="#org7638343">Tabs</a></li>
2020-03-19 10:42:30 +01:00
<li><a href="#orge28bc93">Urls and Search Engines</a></li>
<li><a href="#orge8e8001">Normal Bindings</a></li>
<li><a href="#orga6ae0da">Custom Bindings</a></li>
2020-01-11 22:04:45 +01:00
<li><a href="#org3991a6c">Userscripts</a>
<ul>
2020-03-01 22:51:16 +01:00
<li><a href="#org6be4b76">Create a new password</a></li>
2020-05-26 08:40:15 +02:00
<li><a href="#orge348df2">Download Youtube Video</a></li>
<li><a href="#orgb8e61c0">Password_fill_rc</a></li>
2020-01-11 22:04:45 +01:00
<li><a href="#org58d6993">Org-Capture</a></li>
2020-05-26 08:40:15 +02:00
<li><a href="#org988c9e3">Org-Protocol-Capture-HTML</a></li>
2020-01-11 22:04:45 +01:00
<li><a href="#org63ffcb4">Add Url to Buku using Rofi</a></li>
2020-03-22 23:04:07 +01:00
<li><a href="#org0a503bf">Add Url to Buku without asking for information</a></li>
2020-05-26 08:40:15 +02:00
<li><a href="#orga1def86">Download with aria2c</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org22d9ea5" class="outline-2">
<h2 id="org22d9ea5">Import</h2>
<div class="outline-text-2" id="text-org22d9ea5">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">from qutebrowser.config.configfiles import ConfigAPI
from qutebrowser.config.config import ConfigContainer
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
import sys, os
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org89786f6" class="outline-2">
<h2 id="org89786f6">General config</h2>
<div class="outline-text-2" id="text-org89786f6">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">c.aliases = {'w': 'session-save', 'q': 'quit', 'wq': 'quit --save'}
c.auto_save.session = False
c.backend = 'webengine'
c.confirm_quit = ['downloads']
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org870403a" class="outline-2">
<h2 id="org870403a">Content</h2>
<div class="outline-text-2" id="text-org870403a">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">c.content.autoplay = False
c.content.notifications = False
c.content.geolocation = 'ask'
c.content.javascript.alert = True
c.content.javascript.can_access_clipboard = True
c.content.media_capture = 'ask'
c.content.pdfjs = False
c.content.proxy = 'system'
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2020-03-19 10:42:30 +01:00
<div id="outline-container-orgdefaa05" class="outline-2">
<h2 id="orgdefaa05">Editor</h2>
<div class="outline-text-2" id="text-orgdefaa05">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">c.editor.command = ['/usr/bin/termite', '--class="Floating"', '-e', 'nvim {}']
2020-03-19 10:42:30 +01:00
</pre>
</div>
</div>
</div>
2020-01-11 22:04:45 +01:00
<div id="outline-container-org409baa5" class="outline-2">
<h2 id="org409baa5">Downloads</h2>
<div class="outline-text-2" id="text-org409baa5">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">c.downloads.location.directory = '$HOME/Downloads/'
c.downloads.location.prompt = True
c.downloads.location.remember = True
c.downloads.location.suggestion = 'path'
c.downloads.position = 'bottom'
c.downloads.remove_finished = 10000
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-orgdc50649" class="outline-2">
<h2 id="orgdc50649">Fonts</h2>
<div class="outline-text-2" id="text-orgdc50649">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">c.fonts.default_family = ["Hack Nerd Font Mono", "DejaVu Sans Mono", "Monaco"]
c.fonts.prompts = '10pt monospace'
c.fonts.statusbar = '10pt monospace'
c.fonts.tabs = '10pt monospace'
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-orge859d77" class="outline-2">
<h2 id="orge859d77">Input</h2>
<div class="outline-text-2" id="text-orge859d77">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">c.input.insert_mode.auto_enter = True
c.input.insert_mode.auto_leave = True
c.input.insert_mode.auto_load = False
c.input.insert_mode.plugins = True
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org6a05c89" class="outline-2">
<h2 id="org6a05c89">New Instance Options</h2>
<div class="outline-text-2" id="text-org6a05c89">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">c.new_instance_open_target = 'tab'
c.new_instance_open_target_window = 'last-focused'
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc336fd6" class="outline-2">
<h2 id="orgc336fd6">Spell Check</h2>
<div class="outline-text-2" id="text-orgc336fd6">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">c.spellcheck.languages = ['en-US', 'fr-FR']
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org1d64606" class="outline-2">
<h2 id="org1d64606">Status Bar</h2>
<div class="outline-text-2" id="text-org1d64606">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python"># Hide the statusbar unless a message is shown.
c.statusbar.hide = False
c.statusbar.position = 'bottom'
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
# 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', 'progress']
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org7638343" class="outline-2">
<h2 id="org7638343">Tabs</h2>
<div class="outline-text-2" id="text-org7638343">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python"># Open new tabs (middleclick/ctrl+click) in the background.
c.tabs.background = True
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
# Mouse button with which to close tabs.
c.tabs.close_mouse_button = 'right'
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
# How to behave when the last tab is closed.
c.tabs.last_close = 'close'
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
# Switch between tabs using the mouse wheel.
c.tabs.mousewheel_switching = False
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
# 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'
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
# 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'
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
# Position of the tab bar.
c.tabs.position = 'left'
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
# Which tab to select when the focused tab is removed.
c.tabs.select_on_remove = 'next'
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
# Width (in pixels or as percentage of the window) of the tab bar if it's vertical.
c.tabs.width = 30
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
# Wrap when changing tabs.
c.tabs.wrap = False
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2020-03-19 10:42:30 +01:00
<div id="outline-container-orge28bc93" class="outline-2">
<h2 id="orge28bc93">Urls and Search Engines</h2>
<div class="outline-text-2" id="text-orge28bc93">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">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&amp;as_sdt=0%2C5&amp;q={}&amp;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://gen.lib.rus.ec/search.php?req={}',
'la': 'http://gen.lib.rus.ec/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={}&amp;submitsearch=',
'js': 'https://developer.mozilla.org/en-US/search?q={}',
'tf': 'https://translate.google.com/#view=home&amp;op=translate&amp;sl=en&amp;tl=fr&amp;text={}',
'te': 'https://translate.google.com/#view=home&amp;op=translate&amp;sl=fr&amp;tl=en&amp;text={}',
2020-01-11 22:04:45 +01:00
}
2020-03-19 10:42:30 +01:00
</pre>
</div>
2020-01-11 22:04:45 +01:00
2020-03-19 10:42:30 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">c.url.start_pages = ['qute://bookmarks']
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2020-03-19 10:42:30 +01:00
<div id="outline-container-orge8e8001" class="outline-2">
<h2 id="orge8e8001">Normal Bindings</h2>
<div class="outline-text-2" id="text-orge8e8001">
<p>
Zooming
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind('+', 'zoom-in')
config.bind('-', 'zoom-out')
config.bind('=', 'zoom')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
Inputs blocks
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind(';t', 'hint inputs')
config.bind('gi', 'hint inputs --first')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
Opening New Window
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind('&lt;Ctrl-N&gt;', 'open -w')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
History
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind('H', 'back')
config.bind('L', 'forward')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
Move tabs around
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind('d', 'tab-close')
config.bind('&lt;', 'tab-move -')
config.bind('&gt;', 'tab-move +')
config.bind('gO', 'tab-give') # Open current tab in a new window
config.bind('J', 'tab-next')
config.bind('K', 'tab-prev')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
Bookmarks and Quickmark
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind('M', 'bookmark-add')
config.bind('m', 'quickmark-save')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
Open New Pages/Tabs
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind('o', 'set-cmd-text -s :open')
config.bind('O', 'set-cmd-text -s :open -t')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
Open new page/tab with clipboard content
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind('pp', 'open -- {clipboard}')
config.bind('pP', 'open -t -- {clipboard}')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
Link Hinting
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind('f', 'hint')
config.bind('F', 'hint all tab')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
Yanking url
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind('yy', 'yank')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
Go to specific websites
</p>
2020-03-01 22:51:16 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind('gy', 'open -t https://www.youtube.com/feed/subscriptions')
config.bind('gf', 'open -t https://feedly.com/i/my')
config.bind('gr', 'open -t https://www.reddit.com/')
2020-03-19 10:42:30 +01:00
2020-05-26 08:40:15 +02:00
config.bind('gb', 'open qute://bookmarks')
config.bind('gh', 'open qute://history')
config.bind('gs', 'open qute://settings')
2020-03-01 22:51:16 +01:00
</pre>
</div>
</div>
</div>
2020-03-19 10:42:30 +01:00
<div id="outline-container-orga6ae0da" class="outline-2">
<h2 id="orga6ae0da">Custom Bindings</h2>
<div class="outline-text-2" id="text-orga6ae0da">
<p>
Create a Password for the current website
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind(',P', 'spawn --userscript ~/.config/qutebrowser/userscripts/add-passowrd.sh')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
2020-03-22 23:04:07 +01:00
Use Pass to fill password and username (configuration is done in <code>~/.config/qutebrowser/password_fill_rc</code>)
2020-03-19 10:42:30 +01:00
</p>
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind(',p', 'spawn --userscript password_fill')
2020-03-19 10:42:30 +01:00
</pre>
2020-01-11 22:04:45 +01:00
</div>
2020-03-19 10:42:30 +01:00
<p>
2020-03-22 23:04:07 +01:00
Open Youtube video using <code>mpv</code>
2020-03-19 10:42:30 +01:00
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind(',m', 'spawn --detach mpv --force-window yes {url}')
config.bind(',M', 'hint links spawn --detach mpv --force-window yes {hint-url}')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
2020-05-26 08:40:15 +02:00
Download Youtube video / entire playlist
2020-03-19 10:42:30 +01:00
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind(',v', 'spawn --userscript ~/.config/qutebrowser/userscripts/yt-download.sh {url}')
config.bind(',V', 'hint links spawn --userscript ~/.config/qutebrowser/userscripts/yt-download.sh {hint-url}')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
2020-03-22 23:04:07 +01:00
Add page to Bookmarks using <code>buku</code>
2020-03-19 10:42:30 +01:00
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind(',b', 'spawn --userscript ~/.config/qutebrowser/userscripts/buku-add.sh')
config.bind(',B', 'spawn --userscript ~/.config/qutebrowser/userscripts/buku-rofi.sh')
</pre>
</div>
<p>
Download with <code>aria2c</code>
</p>
<div class="org-src-container">
<pre class="src src-python">config.bind(',d', 'hint links spawn --userscript ~/.config/qutebrowser/userscripts/aria2c-add.sh {hint-url}')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
2020-03-22 23:04:07 +01:00
Open bookmark using <code>buku</code>
2020-03-19 10:42:30 +01:00
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind(',o', 'spawn ~/.local/bin/bukurun')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
Org Capture
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind(',r', 'spawn --userscript ~/.config/qutebrowser/userscripts/org-capture.sh')
config.bind(',R', 'hint links userscript ~/.config/qutebrowser/userscripts/org-capture.sh')
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-04-05 11:30:26 +02:00
<p>
Download a torrent
</p>
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind(',t', 'hint links spawn torrent-add {hint-url}')
2020-04-05 11:30:26 +02:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
Annotate with Hypothesis
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">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)})();")
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-19 10:42:30 +01:00
<p>
See Amazon price history using CamelCamelCamel
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-python">config.bind(',A', ":open -t https://fr.camelcamelcamel.com/search?sq={url}")
</pre>
</div>
<p>
Org Roam Entry for the current page
</p>
<div class="org-src-container">
<pre class="src src-python">config.bind(',R', "open javascript:void(location.href='org-protocol://roam-ref?template=r&amp;ref='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title))")
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org3991a6c" class="outline-2">
<h2 id="org3991a6c">Userscripts</h2>
<div class="outline-text-2" id="text-org3991a6c">
</div>
2020-05-26 08:40:15 +02:00
2020-03-01 22:51:16 +01:00
<div id="outline-container-org6be4b76" class="outline-3">
<h3 id="org6be4b76">Create a new password</h3>
<div class="outline-text-3" id="text-org6be4b76">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">url=$(echo "$QUTE_URL" | awk -F[/:] '{print $4}' | rofi -p "URL" -dmenu -lines 1)
username=$(echo -e "dehaeze.thomas@gmail.com\nthomas.dehaeze@esrf.fr\ntdehaeze" | rofi -p "Username" -dmenu -lines 5)
password=$(rofi -p "Password" -dmenu -password -lines 1)
2020-03-01 22:51:16 +01:00
2020-05-26 08:40:15 +02:00
if [ -z "$url" ] || [ -z "$username" ] || [ -z "$password" ]; then
dunstify --urgency=critical "Pass" "Failed to Add Password"
else
echo -e "$password\nlogin: $username\nurl: $QUTE_URL" &gt; /tmp/add-password.txt
pass insert --multiline "$url/$username" &lt; /tmp/add-password.txt;
rm /tmp/add-password.txt
dunstify "Pass " "Password Added"
fi
2020-03-01 22:51:16 +01:00
</pre>
</div>
</div>
</div>
2020-05-26 08:40:15 +02:00
<div id="outline-container-orge348df2" class="outline-3">
<h3 id="orge348df2">Download Youtube Video</h3>
<div class="outline-text-3" id="text-orge348df2">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">cd ~/Documents/to-watch/;
if [[ "$1" == *"list"* ]]; then
choice=$(echo -e "Video\nPlaylist" | rofi -dmenu -only-match -i)
fi
if [ -n "$choice" ] &amp;&amp; [ "$choice" = "Playlist" ]; then
dunstify --replace=19243 "Youtube " "Downloading Playlist...";
youtube-dl -i -f 'bestvideo[height&lt;=720]+bestaudio/best[height&lt;=720]' "$1" -o "%(playlist_title)s/%(playlist_index)s-%(title)s.%(ext)s" &amp;&amp; \
dunstify --replace=19243 "Youtube " "Downloaded" || \
dunstify --replace=19243 --urgency=critical "Youtube " "Failed to download"
else
dunstify --replace=19243 "Youtube " "Downloading Video...";
youtube-dl --no-playlist -f 'bestvideo[height&lt;=720]+bestaudio/best[height&lt;=720]' "$1" &amp;&amp; \
dunstify --replace=19243 "Youtube " "Downloaded" || \
dunstify --replace=19243 --urgency=critical "Youtube " "Failed to download"
fi
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb8e61c0" class="outline-3">
2020-05-26 08:40:15 +02:00
<h3 id="orgb8e61c0">Password_fill_rc</h3>
2020-01-11 22:04:45 +01:00
<div class="outline-text-3" id="text-orgb8e61c0">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash"># 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 &lt; &lt;(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=(
2020-01-11 22:04:45 +01:00
rofi -dmenu
2020-05-26 08:40:15 +02:00
-p "qutebrowser&gt; "
-filter "$queried_url"
-mesg $'Pick a password entry for &lt;b&gt;'"${QUTE_URL//&amp;/&amp;amp;}"'&lt;/b&gt;'
)
file=$( printf "%s\n" "${files[@]}" | "${MENU_COMMAND[@]}" )
}
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2020-03-01 22:51:16 +01:00
2020-01-11 22:04:45 +01:00
<div id="outline-container-org58d6993" class="outline-3">
<h3 id="org58d6993">Org-Capture</h3>
<div class="outline-text-3" id="text-org58d6993">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">readonly CAPTURE_SCRIPT=~/.config/qutebrowser/userscripts/org-protocol-capture-html.sh
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
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
</pre>
</div>
</div>
</div>
<div id="outline-container-org988c9e3" class="outline-3">
<h3 id="org988c9e3">Org-Protocol-Capture-HTML</h3>
<div class="outline-text-3" id="text-org988c9e3">
<p>
Defaults
</p>
<div class="org-src-container">
<pre class="src src-bash">heading="link"
template="pu"
url="https://google.com/"
</pre>
</div>
<p>
Functions
</p>
<div class="org-src-container">
<pre class="src src-bash">function debug {
if [[ -n $debug ]]
then
function debug {
echo "DEBUG: $@" &gt;&amp;2
}
debug "$@"
else
function debug {
true
}
fi
}
function die {
echo "$@" &gt;&amp;2
exit 1
}
function urlencode {
python -c "
from __future__ import print_function
try:
from urllib import quote # Python 2
except ImportError:
from urllib.parse import quote # Python 3
import sys
print(quote(sys.stdin.read()[:-1], safe=''))"
}
</pre>
</div>
<p>
Documentation
</p>
<div class="org-src-container">
<pre class="src src-bash">function usage {
cat &lt;&lt;EOF
$0 [OPTIONS] [HTML]
html | $0 [OPTIONS]
Send HTML to Emacs through org-protocol, passing it through Pandoc to
convert HTML to Org-mode. HTML may be passed as an argument or
through STDIN. If only URL is given, it will be downloaded and its
contents used.
Options:
-h, --heading HEADING Heading
-t, --template TEMPLATE org-capture template key (default: pu)
-u, --url URL URL
--debug Print debug info
--help I need somebody!
EOF
}
</pre>
</div>
<p>
Arguments
</p>
<div class="org-src-container">
<pre class="src src-bash">args=$(getopt -n "$0" -o dh:rt:u: -l debug,help,heading:,template:,url: -- "$@") \
|| die "Unable to parse args. Is getopt installed?"
eval set -- "$args"
while true
do
case "$1" in
-d|--debug)
debug=true
debug "Debugging on"
;;
--help)
usage
exit
;;
-h|--heading)
shift
heading="$1"
;;
-t|--template)
shift
template="$1"
;;
-u|--url)
shift
url="$1"
;;
--)
# Remaining args
shift
rest=("$@")
break
;;
esac
shift
done
debug "ARGS: $args"
debug "Remaining args: ${rest[@]}"
</pre>
</div>
<p>
Get HTML
</p>
<div class="org-src-container">
<pre class="src src-bash">if [[ -n $@ ]]
then
debug "Text from args"
body="$@"
fi
</pre>
</div>
<p>
URL-encode
</p>
<div class="org-src-container">
<pre class="src src-bash">heading=$(urlencode &lt;&lt;&lt;"$heading") || die "Unable to urlencode heading."
url=$(urlencode &lt;&lt;&lt;"$url") || die "Unable to urlencode URL."
body=$(urlencode &lt;&lt;&lt;"$body") || die "Unable to urlencode text."
</pre>
</div>
<p>
Send to Emacs
</p>
<div class="org-src-container">
<pre class="src src-bash">emacsclient "org-protocol://capture?template=$template&amp;url=$url&amp;title=$heading&amp;body=$body"
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2020-03-01 22:51:16 +01:00
2020-01-11 22:04:45 +01:00
<div id="outline-container-org63ffcb4" class="outline-3">
<h3 id="org63ffcb4">Add Url to Buku using Rofi</h3>
<div class="outline-text-3" id="text-org63ffcb4">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">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 -multi-select -p "Tags" -dmenu | tr "\n" "," | sed 's/\s*,\s*$//')
2020-01-11 22:04:45 +01:00
2020-05-26 08:40:15 +02:00
buku --add "$QUTE_URL" --tag "$tags" --title "$title" &amp;&amp; \
dunstify "Buku" "Bookmark Added" || \
dunstify --urgency=critical "Buku" " Bookmark Added"
2020-03-22 23:04:07 +01:00
</pre>
</div>
</div>
</div>
<div id="outline-container-org0a503bf" class="outline-3">
<h3 id="org0a503bf">Add Url to Buku without asking for information</h3>
<div class="outline-text-3" id="text-org0a503bf">
<div class="org-src-container">
2020-05-26 08:40:15 +02:00
<pre class="src src-bash">buku --add $QUTE_URL --title "$QUTE_TITLE" &amp;&amp; dunstify "Buku" "📑 Bookmark Added"
</pre>
</div>
</div>
</div>
<div id="outline-container-orga1def86" class="outline-3">
<h3 id="orga1def86">Download with aria2c</h3>
<div class="outline-text-3" id="text-orga1def86">
<div class="org-src-container">
<pre class="src src-bash">aria2p add "$1"
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
2020-05-26 08:40:15 +02:00
<p class="date">Created: 2020-05-26 mar. 08:39</p>
2020-01-11 22:04:45 +01:00
</div>
</body>
</html>