update theme

This commit is contained in:
2023-10-13 12:30:13 +02:00
parent 9346aee86d
commit f8070f6e51
37 changed files with 3017 additions and 3364 deletions

View File

@@ -23,7 +23,7 @@ config.load_autoconfig(True)
c.aliases = {'w': 'session-save', 'q': 'quit', 'wq': 'quit --save'}
c.auto_save.session = False
c.backend = 'webengine'
c.confirm_quit = ['downloads']
c.confirm_quit = ['downloads', 'multiple-tabs']
#+END_SRC
#+begin_src python
@@ -42,7 +42,6 @@ c.content.autoplay = False
c.content.notifications.enabled = False
c.content.geolocation = 'ask'
c.content.javascript.alert = True
c.content.javascript.can_access_clipboard = True
c.content.pdfjs = False
c.content.proxy = 'system'
c.content.blocking.method = 'both'
@@ -180,8 +179,8 @@ c.url.searchengines = {
'sm': 'https://www.openstreetmap.org/search?query={}',
'am': 'https://www.amazon.fr/s?k={}',
'md': 'https://fr.mathworks.com/help/search.html?qdoc={}&submitsearch=',
'tf': 'https://translate.google.com/#view=home&op=translate&sl=en&tl=fr&text={}',
'te': 'https://translate.google.com/#view=home&op=translate&sl=fr&tl=en&text={}',
'tf': 'https://www.deepl.com/en/translator#en/fr/{}',
'te': 'https://www.deepl.com/en/translator#fr/en/{}',
'lb': 'https://www.leboncoin.fr/recherche?text={}',
}
#+end_src
@@ -234,8 +233,8 @@ config.bind('m', 'quickmark-save')
Open New Pages/Tabs
#+begin_src python
config.bind('o', 'set-cmd-text -s :open')
config.bind('O', 'set-cmd-text -s :open -t')
config.bind('o', 'cmd-set-text -s :open')
config.bind('O', 'cmd-set-text -s :open -t')
#+end_src
Open new page/tab with clipboard content
@@ -370,12 +369,6 @@ c.aliases['Download_AES'] = 'spawn --userscript aes-download.sh'
config.bind(',E', 'Download_AES')
#+end_src
Download a torrent
#+begin_src python
c.aliases['Download_Torrent_Homelab'] = 'hint links spawn torrent-add {hint-url}'
config.bind(',t', 'Download_Torrent_Homelab')
#+end_src
See Amazon price history using CamelCamelCamel
#+begin_src python
c.aliases['CamelCamelCamel'] = 'open -t https://fr.camelcamelcamel.com/search?sq={url}'
@@ -406,17 +399,17 @@ config.bind(',q', 'QRcode')
** Create a new password
#+begin_src bash :tangle ~/.config/qutebrowser/userscripts/add-passowrd.sh
url=$(echo "$QUTE_URL" | awk -F[/:] '{print $4}' | rofi -p "URL" -dmenu -lines 1)
url=$(echo "$QUTE_URL" | awk -F[/:] '{print $4}' | rofi -i -p "URL" -dmenu -lines 1)
username=$(echo -e "dehaeze.thomas@gmail.com\nthomas.dehaeze@esrf.fr\ntdehaeze" | rofi -p "Username" -dmenu -lines 5)
password=$(rofi -p "Password" -dmenu -password -lines 1)
if [ -z "$url" ] || [ -z "$username" ] || [ -z "$password" ]; then
notify-send --hint=string:x-dunst-stack-tag:0vRM5AMP --urgency=critical "Pass" "Failed to Add Password"
dunstify --urgency=critical "Pass" "Failed to Add Password"
else
echo -e "$password\nlogin: $username\nurl: $QUTE_URL" > /tmp/add-password.txt
pass insert --multiline "$url/$username" < /tmp/add-password.txt;
rm /tmp/add-password.txt
notify-send --hint=string:x-dunst-stack-tag:0vRM5AMP "Pass " "Password Added"
dunstify "Pass " "Password Added"
fi
#+end_src
@@ -429,15 +422,15 @@ if [[ "$1" == *"list"* ]]; then
fi
if [ -n "$choice" ] && [ "$choice" = "Playlist" ]; then
notify-send --hint=string:x-dunst-stack-tag:iOGRwrDG "Youtube " "Downloading Playlist...";
dunstify --replace=19243 "Youtube " "Downloading Playlist...";
youtube-dl -i -f 'bestvideo[height<=720]+bestaudio/best[height<=720]' "$1" -o "%(playlist_title)s/%(playlist_index)s-%(title)s.%(ext)s" && \
notify-send --hint=string:x-dunst-stack-tag:iOGRwrDG "Youtube " "Downloaded" || \
notify-send --hint=string:x-dunst-stack-tag:iOGRwrDG --urgency=critical "Youtube " "Failed to download"
dunstify --replace=19243 "Youtube " "Downloaded" || \
dunstify --replace=19243 --urgency=critical "Youtube " "Failed to download"
else
notify-send --hint=string:x-dunst-stack-tag:iOGRwrDG "Youtube " "Downloading Video...";
dunstify --replace=19243 "Youtube " "Downloading Video...";
youtube-dl --no-playlist -f 'bestvideo[height<=720]+bestaudio/best[height<=720]' "$1" && \
notify-send --hint=string:x-dunst-stack-tag:iOGRwrDG "Youtube " "Downloaded" || \
notify-send --hint=string:x-dunst-stack-tag:iOGRwrDG --urgency=critical "Youtube " "Failed to download"
dunstify --replace=19243 "Youtube " "Downloaded" || \
dunstify --replace=19243 --urgency=critical "Youtube " "Failed to download"
fi
#+end_src
@@ -620,7 +613,7 @@ if [[ -z "${LINKDING_TOKEN}" ]]; then
LINKDING_TOKEN=$(pass nas/linkding_token)
fi
curl -H "Authorization: Token ${LINKDING_TOKEN}" ${LINKDING_URL}/api/bookmarks/ | jq '.results[] | "\(.title) - \(.url) - [#\((.tag_names | join(", #")))]"' -r | rofi -dmenu -no-custom | grep -Eo 'https?://[^ ]+' | head -1 | xargs -I {} echo "open -t {}" >> "$QUTE_FIFO"
curl -H "Authorization: Token ${LINKDING_TOKEN}" ${LINKDING_URL}/api/bookmarks/ | jq '.results[] | "\(.title) - \(.url) - [#\((.tag_names | join(", #")))]"' -r | rofi -dmenu -i -no-custom | grep -Eo 'https?://[^ ]+' | head -1 | xargs -I {} echo "open -t {}" >> "$QUTE_FIFO"
#+end_src
** Add Url to Linkding
@@ -641,8 +634,8 @@ new_tags=$(rofi -p "New tags" -dmenu)
formated_tags=$(echo $existing_tags $new_tags | sed -E 's/(\w+)/"\1"/g;s/\s/,/g')
curl -H "Authorization: Token ${LINKDING_TOKEN}" -H "Content-Type: application/json" -d "{\"url\": \"$QUTE_URL\", \"title\": \"$title\", \"tag_names\": [$formated_tags]}" ${LINKDING_URL}/api/bookmarks/ && \
notify-send --hint=string:x-dunst-stack-tag:l3gV75RD "Linkding" " Bookmark Added" || \
notify-send --hint=string:x-dunst-stack-tag:l3gV75RD --urgency=critical "Linkding" "Failed"
dunstify "Linkding" " Bookmark Added" || \
dunstify --urgency=critical "Linkding" "Failed"
#+end_src
** Add Url to Buku using Rofi
@@ -651,28 +644,28 @@ title=$(echo "$QUTE_TITLE" | rofi -p "Title" -dmenu -lines 1)
tags=$(buku -t --nc --np | sed -e 's/\s*[[:digit:]]*\.\s*\(.*\)\s*([[:digit:]]*)\s*/\1/' -e '/^\s*$/d' | sort | uniq | rofi -multi-select -p "Tags" -dmenu | tr "\n" "," | sed 's/\s*,\s*$//')
buku --add "$QUTE_URL" --tag "$tags" --title "$title" && \
notify-send --hint=string:x-dunst-stack-tag:E3TueNZ0 "Buku" "Bookmark Added" || \
notify-send --hint=string:x-dunst-stack-tag:E3TueNZ0 --urgency=critical "Buku" " Bookmark Added"
dunstify "Buku" "Bookmark Added" || \
dunstify --urgency=critical "Buku" " Bookmark Added"
#+end_src
** Add Url to Buku without asking for information
#+begin_src bash :tangle ~/.config/qutebrowser/userscripts/buku-add.sh
buku --add $QUTE_URL --title "$QUTE_TITLE" && \
notify-send "Buku" "📑 Bookmark Added"
dunstify "Buku" "📑 Bookmark Added"
#+end_src
** Download with aria2c
#+begin_src bash :tangle ~/.config/qutebrowser/userscripts/aria2c-add.sh
aria2p add "$1" && \
notify-send --hint=string:x-dunst-stack-tag:2SGClDoI "Aria2" "Download Started" || \
notify-send --hint=string:x-dunst-stack-tag:2SGClDoI "Aria2" "Error"
dunstify "Aria2" "Download Started" || \
dunstify "Aria2" "Error"
#+end_src
** Download with aria2c on the Homelab
#+begin_src bash :tangle ~/.config/qutebrowser/userscripts/aria2c-add-homelab.sh
dl-add $(echo "$1" | sed 's/\&af=.*$//g') && \
notify-send --hint=string:x-dunst-stack-tag:2SGClDoI "Aria2" "Download Started" || \
notify-send --hint=string:x-dunst-stack-tag:2SGClDoI "Aria2" "Error"
dunstify "Aria2" "Download Started" || \
dunstify "Aria2" "Error"
#+end_src
** Save to PNG
@@ -680,19 +673,19 @@ dl-add $(echo "$1" | sed 's/\&af=.*$//g') && \
filename=$(rofi -p "filename" -dmenu -lines 1)
if [ -n "filename" ]; then
cd ~/Pictures/ && \
firefox -P default -headless --screenshot "$filename.png" "$QUTE_URL" && \
notify-send "Screenshot" "Taken successfully"
cd ~/Cloud/pictures/screenshots/ && \
firefox-developer-edition -P default -headless --screenshot "$filename.png" "$QUTE_URL" && \
dunstify "Screenshot" "Taken successfully"
fi
#+end_src
** Get OTP number
#+begin_src bash :tangle ~/.config/qutebrowser/userscripts/get-otp.sh
passname=$(ls ~/.password-store/totp-* | xargs -n 1 basename | sed -e 's/\..*$//' | rofi -p "TOPT" -dmenu)
passname=$(ls ~/.local/share/pass/totp-* | xargs -n 1 basename | sed -e 's/\..*$//' | rofi -p "TOPT" -dmenu)
if [ -n "$passname" ]; then
pass otp $passname | xsel -ib && \
notify-send 'OTP' 'copied to clipboard.' &
dunstify 'OTP' 'copied to clipboard.' &
fi
#+end_src
@@ -701,12 +694,12 @@ fi
m3u8_path=`curl -L -s "$QUTE_URL" | pcregrep -o1 "file = \"\/(.*aes.*mp4)\""`
if [ -z "$m3u8_path" ]; then
notify-send --hint=string:x-dunst-stack-tag:ng4iXDxP --urgency=critical "Qutebrowser" "No m3u8 playlist found"
dunstify --urgency=critical "Qutebrowser" "No m3u8 playlist found"
else
notify-send --hint=string:x-dunst-stack-tag:ng4iXDxP "Qutebrowser" "Downloads..." && \
dunstify "Qutebrowser" "Downloads..." && \
cd ~/Downloads/ && \
ffmpeg -user_agent "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0" -referer "$QUTE_URL" -i "https://cdn2.digitellinc.com/play/_definst_/mp4:$m3u8_path/playlist.m3u8" -c copy "$QUTE_TITLE.mp4" && \
notify-send --hint=string:x-dunst-stack-tag:ng4iXDxP "Qutebrowser" "$QUTE_TITLE Downloaded"
dunstify "Qutebrowser" "$QUTE_TITLE Downloaded"
fi
#+end_src
@@ -714,3 +707,27 @@ fi
#+begin_src bash :tangle ~/.config/qutebrowser/userscripts/url-to-qrcode.sh
qrencode -o /tmp/qrcode.png "$1" && sxiv /tmp/qrcode.png
#+end_src
* Greasemonkey Scripts
** Skip Youtube ads
https://github.com/qutebrowser/qutebrowser/issues/6480
#+begin_src javascript :tangle ~/.local/share/qutebrowser/greasemonkey/youtube-adblock.user.js
// ==UserScript==
// @name Auto Skip YouTube Ads
// @version 1.0.0
// @description Speed up and skip YouTube ads automatically
// @author jso8910
// @match *://*.youtube.com/*
// @exclude *://*.youtube.com/subscribe_embed?*
// ==/UserScript==
setInterval(() => {
const btn = document.querySelector('.videoAdUiSkipButton,.ytp-ad-skip-button')
if (btn) {
btn.click()
}
const ad = [...document.querySelectorAll('.ad-showing')][0];
if (ad) {
document.querySelector('video').playbackRate = 10;
}
}, 50)
#+end_src