From 85e0d80e74c8cba2c853b9a19add5c227fc85d9c Mon Sep 17 00:00:00 2001 From: Phantop Date: Fri, 6 Oct 2023 16:19:49 -0400 Subject: [PATCH] bin: croptop --- bin/croptop | 27 +++++++++++++++++++++++++++ fish/functions/ytflux.fish | 2 +- qutebrowser/config.py | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100755 bin/croptop diff --git a/bin/croptop b/bin/croptop new file mode 100755 index 0000000..a5cd1d3 --- /dev/null +++ b/bin/croptop @@ -0,0 +1,27 @@ +#!/usr/bin/env sh +set -e # exit on failure +IFS=$(printf '\n\t') # smarter ifs + +jxl=0 +if file "$1" | grep 'JPEG XL'; then + jxl="$1" + out=$(mktemp --suffix=.jpg) + djxl "$1" "$out" + shift + set -- "$out" "$@" +fi + +test "$RATIOW" || RATIOW=16 +test "$RATIOH" || RATIOH=9 +imagew=$(identify -format %w "$1") +des_ratio=$(printf '3 k %u %u / p' "$RATIOW" "$RATIOH" | dc) + +des_height=$(printf '1 k %u %f / p' "$imagew" "$des_ratio" | dc | cut -d. -f1) +outfile="$(dirname "$1")/tran_$(basename "$1")" + +jpegtran -crop "$imagew"x"$des_height" -outfile "$outfile" "$1" + +if [ "$jxl" != 0 ]; then + cjxl -e 8 "$outfile" "tran_$jxl" + rm "$outfile" "$1" +fi diff --git a/fish/functions/ytflux.fish b/fish/functions/ytflux.fish index 1aa6365..02e14fc 100644 --- a/fish/functions/ytflux.fish +++ b/fish/functions/ytflux.fish @@ -1,5 +1,5 @@ function ytflux set cat 3 - eval curl (cat ~/.miniflux)/entries?status=unread\&category_id=$cat | jq .entries[].url | xargs yt-dlp + eval curl (cat ~/.miniflux)/entries?status=unread\&category_id=$cat | jq .entries[].url | xargs yt-dlp & eval curl -X PUT (cat ~/.miniflux)/categories/$cat/mark-all-as-read end diff --git a/qutebrowser/config.py b/qutebrowser/config.py index ffe1ab9..5998369 100644 --- a/qutebrowser/config.py +++ b/qutebrowser/config.py @@ -15,7 +15,7 @@ c.url.searchengines['s'] = 'farside.link/searxng/search?q={}' c.url.searchengines['x'] = 'aldeid.com/wiki/X86-assembly/Instructions/{}' c.url.searchengines['y'] = 'farside.link/invidious/search?q={}' c.url.searchengines['z'] = 'zeldawiki.wiki/wiki/{}' -c.url.searchengines['DEFAULT'] = c.url.searchengines['4'] +c.url.searchengines['DEFAULT'] = c.url.searchengines['s'] c.url.start_pages = c.url.default_page = 'minifocs.fly.dev' config.source('adblock.py')