From 8a31e9024a5161833fd791962cc4fa35745e154f Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 28 May 2019 11:10:03 +0200 Subject: [PATCH] Add wallabag article quickadd to qutebrowser Adds :wallabag-add command to qutebrowser to add current page to it as an article. Can optionally use ra (read-add) for the same functionality. --- .config/qutebrowser/config.py | 5 +++++ .local/share/qutebrowser/userscripts/wallabag_add.sh | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100755 .local/share/qutebrowser/userscripts/wallabag_add.sh diff --git a/.config/qutebrowser/config.py b/.config/qutebrowser/config.py index 79ccd94..056948c 100644 --- a/.config/qutebrowser/config.py +++ b/.config/qutebrowser/config.py @@ -75,6 +75,11 @@ c.aliases["q"] = "tab-close" # if we save sessions with w, load sessions with e (again, mimicks vim) c.aliases["e"] = "session-load" +# bookmarklet aliases: +# wallabag add current page, either with walla command, or ra +c.aliases["wallabag-add"] = "spawn --userscript wallabag_add.sh" +config.bind(leader + 'ra', 'wallabag-add', mode='normal') + # set stylesheets for the browser to use # leader - ss to remove all applied stylesheets config.bind(leader + 'ss', 'set content.user_stylesheets ""') diff --git a/.local/share/qutebrowser/userscripts/wallabag_add.sh b/.local/share/qutebrowser/userscripts/wallabag_add.sh new file mode 100755 index 0000000..ab4c707 --- /dev/null +++ b/.local/share/qutebrowser/userscripts/wallabag_add.sh @@ -0,0 +1,12 @@ +#! /usr/bin/bash + +# from swalladge: +# https://github.com/swalladge/dotfiles/blob/master/local/share/qutebrowser/userscripts/wallabag_add.sh + +# for wallabag v1.* +# `-w 0` disables auto line wrapping in base64 +# echo "open -t https://www.framabag.org/u/swalladge/?action=add&url='`echo -n "$QUTE_URL" | base64 -w 0`'" >> "$QUTE_FIFO" + + +# v2.* +echo "open https://read.martyoeh.me/bookmarklet?url=$QUTE_URL" >> "$QUTE_FIFO"