qutebrowser: Improve shaarli/wallabag bookmarkers

Both bookmarkers can now either send the current page ("s for sending to
shaarli; "w to send to wallabag) or send any link on the current page
(;s for shaarli, ;w for wallabag).

Both have been adapted to the same format, both can be sent a link as an
argument as well (./wallabag_add.sh 'myawesome.blog/entry').
This commit is contained in:
Marty Oehme 2023-08-08 11:54:44 +02:00
parent b58bd2767d
commit f09a75820e
Signed by: Marty
GPG Key ID: EDBF2ED917B2EF6A
3 changed files with 37 additions and 7 deletions

View File

@ -67,8 +67,9 @@ config.bind(lleader + "dp", "save-to-pdf", mode="normal")
config.bind("gD", "recent-downloads", mode="normal")
config.bind('"w', "add-wallabag", mode="normal") # add current page to wallabag
config.bind(";w", "hint links run add-wallabag") # add link to wallabag
config.bind(';w', "hint links userscript wallabag_add.sh") # add link to wallabag
config.bind('"s', "add-shaarli", mode="normal")
config.bind(';s', "hint links userscript shaarli_add.sh")
config.bind('"a', "send-to-archive", mode="normal")

View File

@ -1,4 +1,27 @@
#! /usr/bin/bash
#! /usr/bin/env bash
#
# Send current page/link to a shaarli instance.
#
# Can be used for sending the current page via:
# :spawn --userscript shaarli_add.sh
# for sending an arbitrary page passed as argument:
# :spawn --userscript shaarli_add.sh https://myinterestingpage.com
# or for sending a hinted link:
# :hint links userscript shaarli_add.sh
#
# Configure your shaarli instance with this:
SHAARLI_INSTANCE="https://links.martyoeh.me"
# send page to shaarli instance and open the 'post' page to edit it
if [ "$#" -gt 0 ]; then
BM="$SHAARLI_INSTANCE/?post=$*"
else
BM="$SHAARLI_INSTANCE/?post=$QUTE_URL"
fi
if [ -n "$QUTE_FIFO" ]; then
echo "open -t -r $BM" >>"$QUTE_FIFO"
else
xdg-open "$BM"
fi
# send current page to my personal shaarli instance and open the 'post' page to edit it
echo "open https://links.martyoeh.me/?post=$QUTE_URL" >>"$QUTE_FIFO"

View File

@ -1,4 +1,4 @@
#! /usr/bin/bash
#! /usr/bin/env bash
#
# Send current page/link to a wallabag instance.
#
@ -14,7 +14,13 @@ WALLABAG_INSTANCE="https://read.martyoeh.me"
# only works for wallabag v2.*
if [ "$#" -gt 0 ]; then
echo "open -b -r $WALLABAG_INSTANCE/bookmarklet?url=$*" >>"$QUTE_FIFO"
BM="$WALLABAG_INSTANCE/bookmarklet?url=$*"
else
echo "open -b -r $WALLABAG_INSTANCE/bookmarklet?url=$QUTE_URL" >>"$QUTE_FIFO"
BM="$WALLABAG_INSTANCE/bookmarklet?url=$QUTE_URL"
fi
if [ -n "$QUTE_FIFO" ]; then
echo "open -b -r $BM" >>"$QUTE_FIFO"
else
xdg-open "$BM"
fi