added a couple of things
This commit is contained in:
parent
72367bb2b2
commit
c12228cac2
24
scripts/lfub
Executable file
24
scripts/lfub
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This is a wrapper script for lb that allows it to create image previews with
|
||||||
|
# ueberzug. This works in concert with the lf configuration file and the
|
||||||
|
# lf-cleaner script.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
exec 3>&-
|
||||||
|
rm "$FIFO_UEBERZUG"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
|
||||||
|
lf "$@"
|
||||||
|
else
|
||||||
|
[ ! -d "$HOME/.cache/lf" ] && mkdir -p "$HOME/.cache/lf"
|
||||||
|
export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$"
|
||||||
|
mkfifo "$FIFO_UEBERZUG"
|
||||||
|
ueberzug layer -s <"$FIFO_UEBERZUG" -p json &
|
||||||
|
exec 3>"$FIFO_UEBERZUG"
|
||||||
|
trap cleanup HUP INT QUIT TERM PWR EXIT
|
||||||
|
lf "$@" 3>&-
|
||||||
|
fi
|
||||||
13
scripts/opout
Executable file
13
scripts/opout
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# opout: "open output": A general handler for opening a file's intended output,
|
||||||
|
# usually the pdf of a compiled document. I find this useful especially
|
||||||
|
# running from vim.
|
||||||
|
|
||||||
|
basename="${1%.*}"
|
||||||
|
|
||||||
|
case "${*}" in
|
||||||
|
*.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid -f xdg-open "$basename".pdf >/dev/null 2>&1 ;;
|
||||||
|
*.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;;
|
||||||
|
*.sent) setsid -f sent "$1" >/dev/null 2>&1 ;;
|
||||||
|
esac
|
||||||
12
scripts/rotdir
Executable file
12
scripts/rotdir
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# When I open an image from the file manager in sxiv (the image viewer), I want
|
||||||
|
# to be able to press the next/previous keys to key through the rest of the
|
||||||
|
# images in the same directory. This script "rotates" the content of a
|
||||||
|
# directory based on the first chosen file, so that if I open the 15th image,
|
||||||
|
# if I press next, it will go to the 16th etc. Autistic, I know, but this is
|
||||||
|
# one of the reasons that sxiv is great for being able to read standard input.
|
||||||
|
|
||||||
|
[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
|
||||||
|
base="$(basename "$1")"
|
||||||
|
ls "$PWD" | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }'
|
||||||
Reference in New Issue
Block a user