2019-01-31 09:41:03 +01:00
|
|
|
#+TITLE: Qutebrowser Configuration
|
2019-05-16 21:13:08 +02:00
|
|
|
:DRAWER:
|
2020-01-11 22:04:28 +01:00
|
|
|
#+STARTUP: overview
|
|
|
|
|
|
|
|
#+LANGUAGE: en
|
|
|
|
#+EMAIL: dehaeze.thomas@gmail.com
|
|
|
|
#+AUTHOR: Dehaeze Thomas
|
|
|
|
|
|
|
|
#+HTML_LINK_HOME: ./index.html
|
|
|
|
#+HTML_LINK_UP: ./index.html
|
|
|
|
|
2020-01-11 22:24:51 +01:00
|
|
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
|
|
|
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.min.js"></script>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/bootstrap.min.js"></script>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/readtheorg.js"></script>
|
2020-01-11 22:04:28 +01:00
|
|
|
|
2019-01-31 09:41:03 +01:00
|
|
|
#+PROPERTY: header-args+ :comments none
|
|
|
|
#+PROPERTY: header-args+ :mkdirp yes
|
|
|
|
#+PROPERTY: header-args+ :tangle ~/.config/qutebrowser/config.py
|
2019-05-16 21:13:08 +02:00
|
|
|
:END:
|
|
|
|
|
|
|
|
* Import
|
2020-03-19 10:05:55 +01:00
|
|
|
#+begin_src python
|
|
|
|
from qutebrowser.config.configfiles import ConfigAPI
|
|
|
|
from qutebrowser.config.config import ConfigContainer
|
2019-05-16 21:13:08 +02:00
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
import sys, os
|
2019-05-16 21:13:08 +02:00
|
|
|
#+end_src
|
2019-01-31 09:41:03 +01:00
|
|
|
|
|
|
|
* General config
|
2020-03-19 10:05:55 +01:00
|
|
|
#+begin_src python
|
|
|
|
c.aliases = {'w': 'session-save', 'q': 'quit', 'wq': 'quit --save'}
|
|
|
|
c.auto_save.session = False
|
|
|
|
c.backend = 'webengine'
|
|
|
|
c.confirm_quit = ['downloads']
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Content
|
2020-03-19 10:05:55 +01:00
|
|
|
#+begin_src python
|
2019-02-03 17:54:43 +01:00
|
|
|
c.content.autoplay = False
|
2019-12-30 17:22:22 +01:00
|
|
|
c.content.notifications = False
|
2019-02-03 17:54:43 +01:00
|
|
|
c.content.geolocation = 'ask'
|
|
|
|
c.content.javascript.alert = True
|
|
|
|
c.content.javascript.can_access_clipboard = True
|
|
|
|
c.content.media_capture = 'ask'
|
2020-03-16 12:15:10 +01:00
|
|
|
c.content.pdfjs = False
|
2019-02-03 17:54:43 +01:00
|
|
|
c.content.proxy = 'system'
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
* Editor
|
|
|
|
#+begin_src python
|
2020-03-21 17:42:18 +01:00
|
|
|
c.editor.command = ['/usr/bin/termite', '--class="Floating"', '-e', 'nvim {}']
|
2020-03-19 10:05:55 +01:00
|
|
|
#+end_src
|
|
|
|
|
2019-01-31 09:41:03 +01:00
|
|
|
* Downloads
|
2020-03-19 10:05:55 +01:00
|
|
|
#+begin_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
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Fonts
|
2020-03-19 10:05:55 +01:00
|
|
|
#+begin_src python
|
2020-03-01 18:56:33 +01:00
|
|
|
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'
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Input
|
2020-03-19 10:05:55 +01:00
|
|
|
#+begin_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
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* New Instance Options
|
2020-03-19 10:05:55 +01:00
|
|
|
#+begin_src python
|
|
|
|
c.new_instance_open_target = 'tab'
|
|
|
|
c.new_instance_open_target_window = 'last-focused'
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Spell Check
|
2020-03-19 10:05:55 +01:00
|
|
|
#+begin_src python
|
2019-01-31 09:41:03 +01:00
|
|
|
c.spellcheck.languages = ['en-US', 'fr-FR']
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Status Bar
|
2020-03-19 10:05:55 +01:00
|
|
|
#+begin_src python
|
|
|
|
# Hide the statusbar unless a message is shown.
|
|
|
|
c.statusbar.hide = False
|
|
|
|
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', 'progress']
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Tabs
|
2020-03-19 10:05:55 +01:00
|
|
|
#+begin_src python
|
|
|
|
# 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 last tab is closed.
|
|
|
|
c.tabs.last_close = 'close'
|
|
|
|
|
|
|
|
# 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'
|
|
|
|
|
|
|
|
# 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'
|
|
|
|
|
|
|
|
# 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
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
* Urls and Search Engines
|
|
|
|
#+begin_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&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=',
|
|
|
|
}
|
2020-03-19 10:11:18 +01:00
|
|
|
#+end_src
|
2020-03-19 10:05:55 +01:00
|
|
|
|
2020-03-19 10:11:18 +01:00
|
|
|
#+begin_src python
|
|
|
|
c.url.start_pages = ['qute://bookmarks']
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
* Normal Bindings
|
|
|
|
Zooming
|
|
|
|
#+begin_src python
|
|
|
|
config.bind('+', 'zoom-in')
|
|
|
|
config.bind('-', 'zoom-out')
|
|
|
|
config.bind('=', 'zoom')
|
|
|
|
#+end_src
|
2019-03-05 22:07:30 +01:00
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Inputs blocks
|
|
|
|
#+begin_src python
|
|
|
|
config.bind(';t', 'hint inputs')
|
|
|
|
config.bind('gi', 'hint inputs --first')
|
2019-03-05 22:07:30 +01:00
|
|
|
#+end_src
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Opening New Window
|
|
|
|
#+begin_src python
|
|
|
|
config.bind('<Ctrl-N>', 'open -w')
|
|
|
|
#+end_src
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
History
|
|
|
|
#+begin_src python
|
|
|
|
config.bind('H', 'back')
|
|
|
|
config.bind('L', 'forward')
|
|
|
|
#+end_src
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Move tabs around
|
|
|
|
#+begin_src python
|
|
|
|
config.bind('d', 'tab-close')
|
|
|
|
config.bind('<', 'tab-move -')
|
|
|
|
config.bind('>', 'tab-move +')
|
|
|
|
config.bind('gO', 'tab-give') # Open current tab in a new window
|
|
|
|
config.bind('J', 'tab-next')
|
|
|
|
config.bind('K', 'tab-prev')
|
|
|
|
#+end_src
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Bookmarks and Quickmark
|
|
|
|
#+begin_src python
|
|
|
|
config.bind('M', 'bookmark-add')
|
|
|
|
config.bind('m', 'quickmark-save')
|
|
|
|
#+end_src
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Open New Pages/Tabs
|
|
|
|
#+begin_src python
|
|
|
|
config.bind('o', 'set-cmd-text -s :open')
|
|
|
|
config.bind('O', 'set-cmd-text -s :open -t')
|
|
|
|
#+end_src
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Open new page/tab with clipboard content
|
|
|
|
#+begin_src python
|
|
|
|
config.bind('pp', 'open -- {clipboard}')
|
|
|
|
config.bind('pP', 'open -t -- {clipboard}')
|
|
|
|
#+end_src
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Link Hinting
|
|
|
|
#+begin_src python
|
|
|
|
config.bind('f', 'hint')
|
|
|
|
config.bind('F', 'hint all tab')
|
|
|
|
#+end_src
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Yanking url
|
|
|
|
#+begin_src python
|
|
|
|
config.bind('yy', 'yank')
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Go to specific websites
|
|
|
|
#+begin_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:11:18 +01:00
|
|
|
config.bind('gb', 'open qute://bookmarks')
|
2020-03-19 10:05:55 +01:00
|
|
|
config.bind('gh', 'open qute://history')
|
|
|
|
config.bind('gs', 'open qute://settings')
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
* Custom Bindings
|
|
|
|
Create a Password for the current website
|
|
|
|
#+begin_src python
|
2020-03-01 18:56:33 +01:00
|
|
|
config.bind(',P', 'spawn --userscript ~/.config/qutebrowser/userscripts/add-passowrd.sh')
|
|
|
|
#+end_src
|
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Use Pass to fill password and username (configuration is done in =~/.config/qutebrowser/password_fill_rc=).
|
|
|
|
#+begin_src python
|
2019-03-05 22:07:30 +01:00
|
|
|
config.bind(',p', 'spawn --userscript password_fill')
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Open Youtube video using MPV
|
|
|
|
#+begin_src python
|
2019-05-16 21:13:08 +02:00
|
|
|
config.bind(',m', 'spawn --detach mpv --force-window yes {url}')
|
|
|
|
config.bind(',M', 'hint links spawn --detach mpv --force-window yes {hint-url}')
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Cast Youtube to Chromecast
|
|
|
|
#+begin_src python
|
2019-05-16 21:13:08 +02:00
|
|
|
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}')
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
2019-01-31 12:05:45 +01:00
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Add url to refile.org
|
|
|
|
#+begin_src python
|
2019-05-16 21:13:08 +02:00
|
|
|
config.bind(',r', 'spawn --userscript ~/.config/qutebrowser/userscripts/add-to-orgmode-refile.sh')
|
2019-01-31 12:05:45 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Add page to Bookmarks
|
|
|
|
#+begin_src python
|
2019-03-05 22:07:30 +01:00
|
|
|
config.bind(',b', 'spawn buku -a {url}')
|
2019-12-15 10:57:51 +01:00
|
|
|
config.bind(',B', 'spawn --userscript ~/.config/qutebrowser/userscripts/buku-rofi.sh')
|
2019-03-05 22:07:30 +01:00
|
|
|
#+end_src
|
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Open bookmark using buku
|
|
|
|
#+begin_src python
|
2019-05-16 21:13:08 +02:00
|
|
|
config.bind(',o', 'spawn ~/bin/bukurun')
|
2019-03-05 22:07:30 +01:00
|
|
|
#+end_src
|
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Org Capture
|
|
|
|
#+begin_src python
|
2019-12-15 10:57:51 +01:00
|
|
|
config.bind(',r', 'spawn --userscript ~/.config/qutebrowser/userscripts/org-capture.sh')
|
|
|
|
config.bind(',R', 'hint links userscript ~/.config/qutebrowser/userscripts/org-capture.sh')
|
|
|
|
#+end_src
|
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
Annotate with Hypothesis
|
|
|
|
#+begin_src python
|
2019-12-01 17:15:03 +01:00
|
|
|
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)})();")
|
|
|
|
#+end_src
|
2019-12-15 10:57:51 +01:00
|
|
|
|
2020-03-19 10:05:55 +01:00
|
|
|
See Amazon price history using CamelCamelCamel
|
|
|
|
#+begin_src python
|
|
|
|
config.bind(',A', ":open -t https://fr.camelcamelcamel.com/search?sq={url}")
|
2019-12-29 15:11:49 +01:00
|
|
|
#+end_src
|
|
|
|
|
2019-01-31 12:05:45 +01:00
|
|
|
* Userscripts
|
2020-03-01 18:56:33 +01:00
|
|
|
** Create a new password
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/qutebrowser/userscripts/add-passowrd.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+begin_src bash
|
|
|
|
url=$(echo "$QUTE_URL" | awk -F[/:] '{print $4}' | rofi -p "URL" -dmenu -lines 1)
|
|
|
|
username=$(echo "dehaeze.thomas@gmail.com\nthomas.dehaeze@esrf.fr\ntdehaeze" | rofi -p "Username" -dmenu -lines 5)
|
|
|
|
password=$(rofi -p "Password" -dmenu -password -lines 1)
|
|
|
|
|
|
|
|
echo "$password\nlogin: $username\nurl: $QUTE_URL" > /tmp/add-password.txt
|
|
|
|
|
|
|
|
pass insert --multiline "$url/$username" < /tmp/add-password.txt
|
|
|
|
|
|
|
|
rm /tmp/add-password.txt
|
|
|
|
#+end_src
|
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
** Cast Youtube to Chromecast
|
2019-12-15 10:57:51 +01:00
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/qutebrowser/userscripts/cast.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
2019-05-16 21:13:08 +02:00
|
|
|
|
|
|
|
#+begin_src bash
|
|
|
|
youtube-dl -o - $1 | castnow --quiet -
|
|
|
|
#+end_src
|
|
|
|
|
2019-03-05 22:07:30 +01:00
|
|
|
** Add url to refile.org
|
2019-12-15 10:57:51 +01:00
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/qutebrowser/userscripts/add-to-orgmode-refile.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
2019-01-31 12:05:45 +01:00
|
|
|
|
|
|
|
Add the date and time of add to properties.
|
|
|
|
#+begin_src bash
|
2019-05-16 21:13:08 +02:00
|
|
|
echo "* TODO $QUTE_TITLE" >> ~/Dropbox/org/refile.org
|
|
|
|
echo "$QUTE_URL" >> ~/Dropbox/org/refile.org
|
|
|
|
echo "message-info 'Added to refile.org'" >> "$QUTE_FIFO"
|
2019-01-31 12:05:45 +01:00
|
|
|
#+end_src
|
2019-05-16 21:13:08 +02:00
|
|
|
|
2019-04-08 17:50:44 +02:00
|
|
|
** Password_fill_rc
|
2019-12-15 10:57:51 +01:00
|
|
|
:PROPERTIES:
|
|
|
|
:header-args+: :tangle ~/.config/qutebrowser/password_fill_rc
|
|
|
|
:END:
|
|
|
|
|
2019-04-08 17:50:44 +02:00
|
|
|
#+begin_src bash
|
|
|
|
# Show all password fields in the menu
|
|
|
|
query_entries() {
|
|
|
|
# safe queried url for choose_entry
|
2019-12-15 10:57:51 +01:00
|
|
|
# the subdomains are removed
|
|
|
|
export queried_url=$(expr match ".$1" '.*\.\(.*\..*\)')
|
2019-04-08 17:50:44 +02:00
|
|
|
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//&/&}"'</b>'
|
|
|
|
)
|
|
|
|
file=$( printf "%s\n" "${files[@]}" | "${MENU_COMMAND[@]}" )
|
|
|
|
}
|
|
|
|
#+end_src
|
2020-03-01 18:56:33 +01:00
|
|
|
|
2019-12-15 10:57:51 +01:00
|
|
|
** Org-Capture
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/qutebrowser/userscripts/org-capture.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+begin_src bash
|
|
|
|
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
|
|
|
|
#+end_src
|
2020-03-01 18:56:33 +01:00
|
|
|
|
2019-12-15 10:57:51 +01:00
|
|
|
** Add Url to Buku using Rofi
|
|
|
|
:PROPERTIES:
|
|
|
|
:header-args: :tangle ~/.config/qutebrowser/userscripts/buku-rofi.sh
|
|
|
|
:header-args+: :comments both :mkdirp yes
|
|
|
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
|
|
|
:END:
|
|
|
|
|
|
|
|
#+begin_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 -p "Tags" -dmenu)
|
|
|
|
|
|
|
|
buku --add "$QUTE_URL" --tag "$tags" --title "$title"
|
|
|
|
#+end_src
|