[qutebrowser] Add send-url userscript to replicate Firefox tab send

This commit is contained in:
Sebastian Schulze 2022-01-18 21:09:49 +01:00
parent da1d9f4800
commit 73731bf14f
No known key found for this signature in database
GPG Key ID: F6BA63C6A7D3044E
2 changed files with 37 additions and 0 deletions

View File

@ -43,6 +43,8 @@ config.bind(',gca', 'quickmark-load calendar')
config.bind(',vu', 'spawn umpv {url}')
config.bind(',vf', 'hint links spawn umpv {hint-url}')
config.bind(',vF', 'hint --rapid links spawn umpv {hint-url}')
config.bind(',su', 'spawn -u send-url')
config.bind(',sp', 'spawn -u send-url baschtfon')
config.bind('<z><l>', 'spawn --userscript qute-pass --mode gopass --username-target secret --username-pattern "user: (.+)"')
config.bind('<z><u><l>', 'spawn --userscript qute-pass --mode gopass --username-target secret --username-pattern "user: (.+)" --username-only')

View File

@ -0,0 +1,35 @@
#!/usr/bin/env bash
# Qutebrowser "send-url" userscript
#
# This script replicates the "Send tab to device" feature of Firefox in a more
# comfortable way: I don't need to manually pick the device which I want to send
# the URL to. If I don't select anything, it will just pick the "other" computer.
# Sending urls to my phone works simply via Pushover which was already configured.
#
# See, ma? No Mozilla sync necessary.
set -eo pipefail
source ~/.config/environment.d/10-bascht.conf
export SSH_AUTH_SOCK
TARGET_HOST="${1:-pierogi}"
# TARGET_HOST="pierogi"
if [[ $(hostname) == "${TARGET_HOST}" ]]; then
TARGET_HOST="apfelstrudel"
fi
notify-send "Sending Tab '${QUTE_TITLE}' to ${TARGET_HOST}" "${QUTE_URL}"
if [[ "${TARGET_HOST}" == "baschtfon" ]]; then
curl -s \
--form-string "token=$(gopass show tools/pushover-api baschtfon)" \
--form-string "user=$(gopass show tools/pushover-api user)" \
--form-string "message=${QUTE_TITLE}" \
--form-string "url=${QUTE_URL}" \
https://api.pushover.net/1/messages.json
else
exec waypipe ssh "${TARGET_HOST}" browser "${QUTE_URL}"
fi;