Add org-capture

This commit is contained in:
Thomas Dehaeze 2019-12-15 10:57:51 +01:00
parent 981e8519b7
commit 6df342a9c9

View File

@ -548,6 +548,7 @@ c.url.searchengines = {
'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={}&submitsearch=',
}
@ -894,6 +895,7 @@ c.url.start_pages = ['https://start.duckduckgo.com']
*** Use Pass to fill password and username (configuration is done in =~/.config/qutebrowser/password_fill_rc=).
#+BEGIN_SRC conf
config.bind(',p', 'spawn --userscript password_fill')
# config.bind(',P', 'spawn --userscript qute-bitwarden')
#+END_SRC
*** Open Youtube video using MPV
@ -916,6 +918,7 @@ c.url.start_pages = ['https://start.duckduckgo.com']
*** Add page to Bookmarks
#+begin_src conf
config.bind(',b', 'spawn buku -a {url}')
config.bind(',B', 'spawn --userscript ~/.config/qutebrowser/userscripts/buku-rofi.sh')
#+end_src
*** Open bookmark using buku
@ -923,29 +926,40 @@ c.url.start_pages = ['https://start.duckduckgo.com']
config.bind(',o', 'spawn ~/bin/bukurun')
#+end_src
*** Org Capture
#+begin_src conf
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")
#+end_src
*** Annotate with Hypothesis
#+begin_src conf
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
* Userscripts
** Cast Youtube to Chromecast
:PROPERTIES:
:header-args: :tangle ~/.config/qutebrowser/userscripts/cast.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
:PROPERTIES:
:header-args: :tangle ~/.config/qutebrowser/userscripts/cast.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
youtube-dl -o - $1 | castnow --quiet -
#+end_src
** Add url to refile.org
: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:
: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:
Add the date and time of add to properties.
#+begin_src bash
@ -955,14 +969,16 @@ Add the date and time of add to properties.
#+end_src
** Password_fill_rc
:PROPERTIES:
:header-args+: :tangle ~/.config/qutebrowser/password_fill_rc
:END:
:PROPERTIES:
:header-args+: :tangle ~/.config/qutebrowser/password_fill_rc
:END:
#+begin_src bash
# Show all password fields in the menu
query_entries() {
# safe queried url for choose_entry
export queried_url="$1"
# the subdomains are removed
export queried_url=$(expr match ".$1" '.*\.\(.*\..*\)')
mapfile -t files < <(find -L "$PREFIX" -iname '*.gpg' -printf '%P\n' |sed 's,\.gpg$,,')
}
@ -978,3 +994,37 @@ Add the date and time of add to properties.
file=$( printf "%s\n" "${files[@]}" | "${MENU_COMMAND[@]}" )
}
#+end_src
** 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
** 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