Compare commits

..

4 commits

Author SHA1 Message Date
ab14c37aa7
vifm: Make compression mappings work in any mode 2023-01-10 00:15:04 +01:00
dac7e7deee
taskopen: Fix expansion using environment var 2023-01-10 00:14:40 +01:00
6cf34a5aee
beets: Add lyrics fetching 2023-01-10 00:14:00 +01:00
8912a09a39
scripts: Change nxsiv-rifle to uoeia
I rewrote and extended the nsxiv-rifle script recently, and this change
now: removes the old script, adds the new one as a submodule into the
repository and links a working binary into the path.

The new script is essentially still just an image grabber-and-opener,
but supports more image viewers, is a little more advanced and can for
example replace arbitrary parts of urls (and is documented a little more
nicely).

Make qutebrowser use new script and remove leftover references to
nsxiv-rifle. Qutebrowser also gets a third option of viewing images, now
there are:

,i -> open selected link in imageviewer
,I -> open current page in imageviewer
,<C-i> -> open selected image in imageviewer
2023-01-08 21:05:16 +01:00
9 changed files with 25 additions and 97 deletions

6
.gitmodules vendored
View file

@ -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"] [submodule "pass/.local/share/pass-pick"]
path = pass/.local/share/pass-pick path = pass/.local/share/pass-pick
url = https://git.martyoeh.me/Marty/pass-pick.git 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

View file

@ -79,6 +79,7 @@ plugins:
- inline - inline
- lastgenre - lastgenre
- lastimport - lastimport
- lyrics
- mbcollection - mbcollection
- mbsync - mbsync
- missing - missing
@ -92,7 +93,8 @@ edit:
ignore_fields: id path ignore_fields: id path
fetchart: fetchart:
sources: filesystem coverart discogs amazon albumart sources: filesystem coverart itunes discogs amazon albumart
store_source: yes
lastgenre: lastgenre:
auto: true auto: true
@ -109,5 +111,9 @@ lastgenre:
lastfm: lastfm:
user: schmitzkater user: schmitzkater
lyrics:
sources: musixmatch genius
fallback: ''
bandcamp: bandcamp:
art: true art: true

View file

@ -5,10 +5,10 @@ path_ext = /usr/share/taskopen/scripts
[Actions] [Actions]
note_custom_ext.regex = "^Note\\.(.*)" note_custom_ext.regex = "^Note\\.(.*)"
note_custom_ext.command = "$EDITOR ${XDG_DATA_HOME:-~/.local/share}/task/notes/$UUID.$LAST_MATCH" note_custom_ext.command = "$EDITOR ${XDG_DATA_HOME:-$HOME/.local/share}/task/notes/$UUID.$LAST_MATCH"
notes.regex = "^Note" notes.regex = "^Note"
notes.command = "$EDITOR ${XDG_DATA_HOME:-~/.local/share}/task/notes/$UUID.md" notes.command = "$EDITOR ${XDG_DATA_HOME:-$HOME/.local/share}/task/notes/$UUID.md"
links.regex = "^https?://" links.regex = "^https?://"
links.command = "xdg-open $FILE" links.command = "xdg-open $FILE"

View file

@ -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 # 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", "spawn umpv {url}")
config.bind(lleader + "m", "hint links spawn umpv {hint-url}") config.bind(lleader + "m", "hint links spawn umpv {hint-url}")
config.bind(lleader + "I", "spawn nsxiv-rifle {url}") config.bind(lleader + "I", "spawn uoeia -v imv {url}")
config.bind(lleader + "i", "hint links spawn nsxiv-rifle {hint-url}") config.bind(lleader + "i", "hint links spawn uoeia -v imv {hint-url}")
config.bind(lleader + "<Ctrl-i>", "hint images spawn uoeia -v imv {hint-url}")
# bind youtube-dl to download the current page/links # bind youtube-dl to download the current page/links
config.bind(lleader + "dM", "spawn vidl {url}") config.bind(lleader + "dM", "spawn vidl {url}")

View file

@ -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"

1
scripts/.local/bin/uoeia Symbolic link
View file

@ -0,0 +1 @@
../share/uoeia/uoeia

@ -0,0 +1 @@
Subproject commit 4a2c9d359b941b042c10a610609339a8d7ff3b1c

View file

@ -105,16 +105,10 @@ if exist imv-folder; then
imv "$@" imv "$@"
fi fi
} }
elif exist imv; then else
alias iv=imv for cmd in imv nsxiv vimiv sxiv feh; do
elif exist nsxiv; then if exist "$cmd"; then alias iv="$cmd"; break; fi
if exist nsxiv-rifle; then done
alias iv=nsxiv-rifle
else
alias iv=nsxiv
fi
elif exist sxiv; then
alias iv=sxiv
fi fi
# python # python

View file

@ -274,13 +274,13 @@ nnoremap zc zm
" external commands " external commands
" extract currently selected file(s) " extract currently selected file(s)
nnoremap xx :!atool -x %f<cr> noremap xx :!atool -x %f<cr>
" compress currently selected file(s) " compress currently selected file(s)
nnoremap xc :!atool -a %c:r.tar.gz %f<cr> noremap xc :!atool -a %c:r.tar.gz %f<cr>
" archive currently selected file(s) " archive currently selected file(s)
nnoremap xa :!atool -a %c:r.tar %f<cr> noremap xa :!atool -a %c:r.tar %f<cr>
" archive currently selected file(s) " archive currently selected file(s)
nnoremap xz :!atool -a %c:r.zip %f<cr> noremap xz :!atool -a %c:r.zip %f<cr>
" combine selected PDFs into single one (named output.pdf) " combine selected PDFs into single one (named output.pdf)
noremap gc :!pdftk %f cat output output.pdf noremap gc :!pdftk %f cat output output.pdf