Add all qutebrowser config files.

This commit is contained in:
CronyAkatsuki 2023-11-28 09:24:19 +01:00
parent c1f43386ae
commit f83803c938
5 changed files with 224 additions and 0 deletions

View file

@ -0,0 +1,73 @@
#!/usr/bin/env bash
# Qutebrowser userscript for interacting with buku
# requries buku and dmenu (with list patch)
get_bookmark() {
buku --nostdin -p -f5 | sed 's/\t/;/g' | column -t -s ';' | dmenu -p "$1 bookmark: " -i -l 10 | awk '{ print $1 }'
}
get_url() {
buku --nostdin -p "$1" -f10
}
get_title() {
buku --nostdin -p "$1" -f30
}
fifo() {
printf '%s\n' "$1" >>"$QUTE_FIFO"
}
add() {
buku --nostdin -a "$QUTE_URL"
$TERMINAL --class badd,badd -e buku -w -1
fifo "message-info 'Added current url to buku'"
}
open() {
bookmark=$(get_bookmark "Open")
[ -z "$bookmark" ] && fifo "message-info 'No Bookmark selected!!!'" && exit
if [ "$1" == "-t" ]; then
fifo "open -t $(get_url "$bookmark")"
fifo "message-info 'Opening bookmark $(get_title "$bookmark") in new tab.'"
else
fifo "open $(get_url "$bookmark")"
fifo "message-info 'Opening bookmark $(get_title "$bookmark").'"
fi
}
delete() {
bookmark=$(get_bookmark "Delete")
title=$(get_title "$bookmark")
buku --nostdin -d "$bookmark" --tacit
fifo "message-info 'Deleted bookmark $title.'"
}
edit() {
bookmark=$(get_bookmark "Edit")
fifo "message-info 'Editing bookmark $(get_title "$bookmark")'"
$TERMINAL --class badd,badd -e buku -w "$bookmark"
}
main() {
case "$1" in
"add")
add
exit
;;
"open")
open "$2"
exit
;;
"delete")
delete
exit
;;
"edit")
edit
;;
esac
}
main $@

View file

@ -0,0 +1,23 @@
#!/bin/sh
audio() {
printf "message-info 'Downloding audio for %s'" "$QUTE_URL" >>"$QUTE_FIFO"
yt-dlp -x -f bestaudio --external-downloader aria2c --external-downloader-args "-j 16 -s 16 -x 16 -k 5M" --audio-format vorbis -o "%(title)s.%(ext)s" "$QUTE_URL"
notify-send "QuteBrowser yt-dlp" "Finished downloading audio"
}
audio_video() {
printf "message-info 'Downloding audio+video for %s'" "$QUTE_URL" >>"$QUTE_FIFO"
yt-dlp --merge-output-format mp4 -f "bestvideo+bestaudio[ext=m4a]/best" --embed-thumbnail --external-downloader aria2c --external-downloader-args "-j 16 -s 16 -x 16 -k 5M" --add-metadata -o "%(title)s.%(ext)s" "$QUTE_URL"
notify-send "QuteBrowser yt-dlp" "Finished downloading audio+video"
}
case "$1" in
"audio")
audio
exit
;;
"audio+video")
audio_video
;;
esac