diff --git a/.gitmodules b/.gitmodules index b458b74..7779f2e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ -[submodule "polybar/.local/share/pomo-app"] - path = polybar/.local/share/pomo-app - url = https://github.com/jsspencer/pomo.git [submodule "pass/.local/share/pass-pick"] path = pass/.local/share/pass-pick url = https://git.martyoeh.me/Marty/pass-pick.git +[submodule "scripts/.local/share/uoeia"] + path = scripts/.local/share/uoeia + url = https://git.martyoeh.me/Marty/uoeia.git diff --git a/qutebrowser/.config/qutebrowser/maps.py b/qutebrowser/.config/qutebrowser/maps.py index ada80d7..d527d1e 100644 --- a/qutebrowser/.config/qutebrowser/maps.py +++ b/qutebrowser/.config/qutebrowser/maps.py @@ -49,8 +49,9 @@ config.bind(leader + "tV", "set tabs.position left") # bind mpv to play the current page/links, using a single instance which queues the next link passed config.bind(lleader + "M", "spawn umpv {url}") config.bind(lleader + "m", "hint links spawn umpv {hint-url}") -config.bind(lleader + "I", "spawn nsxiv-rifle {url}") -config.bind(lleader + "i", "hint links spawn nsxiv-rifle {hint-url}") +config.bind(lleader + "I", "spawn uoeia -v imv {url}") +config.bind(lleader + "i", "hint links spawn uoeia -v imv {hint-url}") +config.bind(lleader + "", "hint images spawn uoeia -v imv {hint-url}") # bind youtube-dl to download the current page/links config.bind(lleader + "dM", "spawn vidl {url}") diff --git a/scripts/.local/bin/nsxiv-rifle b/scripts/.local/bin/nsxiv-rifle deleted file mode 100755 index a961295..0000000 --- a/scripts/.local/bin/nsxiv-rifle +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env sh -# -# Advanced nsxiv url opening script. -# -# Can open remote urls of individual images, galleries, and local files at the same time. -# Uses gallery-dl for remote gallery opening - so if gallery-dl can open it, so can nsxiv. -# -# Usage: simply add multiple urls/paths as arguments. -# nsxiv-rifle "https://linkto.my/image.png" my/local/relative-path.jpg /home/absolute.gif - -cache_dir="$(mktemp -d)" - -die() { - [ -n "$1" ] && printf '%s\n' "$*" >&2 - exit 1 -} - -cleanup() { - rm -f -- "$cache_dir"/* -} - -from_local() { - fpath="$(realpath -e "$1")" - ln -s "$fpath" "$cache_dir" -} - -# invokes single image downloading or gallery downloading depending on content type -from_remote() { - link="$(dereference "$1")" - if curl -sLI "$link" | grep -i '^Content-Type:' | grep -q image; then - get_single_image "$link" - else - get_gallery "$link" - fi -} - -get_gallery() { - command -v gallery-dl 1>/dev/null 2>&1 || return - gallery-dl -q -D "$cache_dir" "$1" -} - -get_single_image() { - pwd="$PWD" - cd "$cache_dir" && curl -sSLO "$1" - cd "$pwd" || exit 1 -} - -# unaliases urls which will not be downloaded correctly otherwise -dereference() { - # teddit - if echo "$1" | grep -qe "https\?://w\?w\?w\?\.\?teddit\.net.\+"; then - echo "$1" | sed -e 's|^.*pics/w:null_\(.\+\)$|https://i.redd.it/\1|' - else - echo "$1" - fi -} - -### main ### -command -v nsxiv 1>/dev/null 2>&1 || die "Requires nsxiv installed" - -[ -z "$1" ] && nsxiv -trap cleanup EXIT -[ -d "$cache_dir" ] || mkdir -p -- "$cache_dir" || die -im_number=1 -while [ -n "$1" ]; do - case "$1" in - *://*.*) from_remote "$1" ;; - *) from_local "$1" ;; - esac - im_number=$((im_number + 1)) - shift -done - -[ "$(find -L "$cache_dir" -type f -print | wc -l)" -ne 0 ] && - nsxiv -p "$cache_dir" diff --git a/scripts/.local/bin/uoeia b/scripts/.local/bin/uoeia new file mode 120000 index 0000000..03ba1d4 --- /dev/null +++ b/scripts/.local/bin/uoeia @@ -0,0 +1 @@ +../share/uoeia/uoeia \ No newline at end of file diff --git a/scripts/.local/share/uoeia b/scripts/.local/share/uoeia new file mode 160000 index 0000000..4a2c9d3 --- /dev/null +++ b/scripts/.local/share/uoeia @@ -0,0 +1 @@ +Subproject commit 4a2c9d359b941b042c10a610609339a8d7ff3b1c diff --git a/sh/.config/sh/alias b/sh/.config/sh/alias index 0aaa856..b67408e 100644 --- a/sh/.config/sh/alias +++ b/sh/.config/sh/alias @@ -105,16 +105,10 @@ if exist imv-folder; then imv "$@" fi } -elif exist imv; then - alias iv=imv -elif exist nsxiv; then - if exist nsxiv-rifle; then - alias iv=nsxiv-rifle - else - alias iv=nsxiv - fi -elif exist sxiv; then - alias iv=sxiv +else + for cmd in imv nsxiv vimiv sxiv feh; do + if exist "$cmd"; then alias iv="$cmd"; break; fi + done fi # python