summaryrefslogtreecommitdiff
path: root/.config/qutebrowser/misc/userscripts/taskadd
diff options
context:
space:
mode:
authorVito Graffagnino <vito@graffagnino.xyz>2020-09-08 18:10:49 +0100
committerVito Graffagnino <vito@graffagnino.xyz>2020-09-08 18:10:49 +0100
commit3b0142cedcde39e4c2097ecd916a870a3ced5ec6 (patch)
tree2116c49a845dfc0945778f2aa3e2118d72be428b /.config/qutebrowser/misc/userscripts/taskadd
parent8cc927e930d5b6aafe3e9862a61e81705479a1b4 (diff)
Added the relevent parts of the .config directory. Alss add ssh config
Diffstat (limited to '.config/qutebrowser/misc/userscripts/taskadd')
-rwxr-xr-x.config/qutebrowser/misc/userscripts/taskadd34
1 files changed, 34 insertions, 0 deletions
diff --git a/.config/qutebrowser/misc/userscripts/taskadd b/.config/qutebrowser/misc/userscripts/taskadd
new file mode 100755
index 0000000..36e1c2c
--- /dev/null
+++ b/.config/qutebrowser/misc/userscripts/taskadd
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+#
+# Behavior:
+# Userscript for qutebrowser which adds a task to taskwarrior.
+# If run as a command (:spawn --userscript taskadd), it creates a new task
+# with the description equal to the current page title and annotates it with
+# the current page url. Additional arguments are passed along so you can add
+# mods to the task (e.g. priority, due date, tags).
+#
+# Example:
+# :spawn --userscript taskadd due:eod pri:H
+#
+# To enable passing along extra args, I suggest using a mapping like:
+# :bind <somekey> set-cmd-text -s :spawn --userscript taskadd
+#
+# If run from hint mode, it uses the selected hint text as the description
+# and the selected hint url as the annotation.
+#
+# Ryan Roden-Corrent (rcorre), 2016
+# Any feedback is welcome!
+#
+# For more info on Taskwarrior, see http://taskwarrior.org/
+
+# use either the current page title or the hint text as the task description
+[[ $QUTE_MODE == 'hints' ]] && title=$QUTE_SELECTED_TEXT || title=$QUTE_TITLE
+
+# try to add the task and grab the output
+if msg="$(task add "$title" "$*" 2>&1)"; then
+ # annotate the new task with the url, send the output back to the browser
+ task +LATEST annotate "$QUTE_URL"
+ echo "message-info '$(echo "$msg" | head -n 1)'" >> "$QUTE_FIFO"
+else
+ echo "message-error '$(echo "$msg" | head -n 1)'" >> "$QUTE_FIFO"
+fi