summaryrefslogtreecommitdiffstats
path: root/.scripts
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2019-03-09 12:17:15 -0500
committerLuke Smith <luke@lukesmith.xyz>2019-03-09 12:17:15 -0500
commitcca884b02e2cbf5634d6228f8fd5628d365e5bf9 (patch)
tree921caa25006c3f562e396dc4a257fc465e4d5525 /.scripts
parent84bf3956f042159d7b74508dbecd6ff9495794c5 (diff)
downloadeibhear-cca884b02e2cbf5634d6228f8fd5628d365e5bf9.tar.gz
eibhear-cca884b02e2cbf5634d6228f8fd5628d365e5bf9.tar.zst
eibhear-cca884b02e2cbf5634d6228f8fd5628d365e5bf9.zip
vifm default file manager w/ überzug
Diffstat (limited to '.scripts')
-rwxr-xr-x.scripts/tools/vifmimg13
-rwxr-xr-x.scripts/tools/vu15
2 files changed, 28 insertions, 0 deletions
diff --git a/.scripts/tools/vifmimg b/.scripts/tools/vifmimg
new file mode 100755
index 0000000..1569962
--- /dev/null
+++ b/.scripts/tools/vifmimg
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+[ -z "$FIFO_UEBERZUG" ] && exit
+
+readonly ID_PREVIEW="preview"
+
+if [ "$1" = "draw" ]; then
+ declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="${PWD}/$6") > "$FIFO_UEBERZUG"
+elif [ "$1" = "videopreview" ]; then
+ [ ! -f "/tmp/$6.png" ] && ffmpegthumbnailer -i "${PWD}/$6" -o "/tmp/$6.png" -s 0 -q 10 &&
+ declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="/tmp/$6.png") > "$FIFO_UEBERZUG"
+else
+ declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") > "$FIFO_UEBERZUG"
+fi
diff --git a/.scripts/tools/vu b/.scripts/tools/vu
new file mode 100755
index 0000000..778835a
--- /dev/null
+++ b/.scripts/tools/vu
@@ -0,0 +1,15 @@
+#!/usr/bin/env sh
+export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}"
+
+cleanup() {
+ rm "$FIFO_UEBERZUG" 2>/dev/null
+ pkill -P $$ 2>/dev/null
+}
+
+rm "$FIFO_UEBERZUG" 2>/dev/null
+mkfifo "$FIFO_UEBERZUG"
+trap cleanup EXIT
+tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash &
+
+vifm
+cleanup