diff options
| -rwxr-xr-x | ar/.config/lf/cleaner | 4 | ||||
| -rwxr-xr-x | ar/.config/lf/scope | 4 | ||||
| -rwxr-xr-x | ar/.local/bin/fzffiles | 9 | ||||
| -rwxr-xr-x | ar/.local/bin/lfub | 12 | ||||
| -rwxr-xr-x | ar/.local/bin/unewsboat | 16 |
5 files changed, 18 insertions, 27 deletions
diff --git a/ar/.config/lf/cleaner b/ar/.config/lf/cleaner index c1ff854..a380dcd 100755 --- a/ar/.config/lf/cleaner +++ b/ar/.config/lf/cleaner @@ -1,5 +1,5 @@ #!/bin/sh -if [ -n "$FIFO_UEBERZUG" ]; then - printf '{"action": "remove", "identifier": "PREVIEW"}\n' >"$FIFO_UEBERZUG" +if [ -n "$FIFO_UEBERZUGPP" ]; then + printf '{"action": "remove", "identifier": "PREVIEW"}\n' >"$FIFO_UEBERZUGPP" fi diff --git a/ar/.config/lf/scope b/ar/.config/lf/scope index b270fe8..fc26f5e 100755 --- a/ar/.config/lf/scope +++ b/ar/.config/lf/scope @@ -7,8 +7,8 @@ IFS="$(printf '%b_' '\n')" IFS="${IFS%_}" image() { - if [ -f "$1" ] && [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1; then - printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$(($5 + 1))" "$(($2 - 1))" "$(($3 - 2))" "$1" >"$FIFO_UEBERZUG" + if [ -f "$1" ] && [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzugpp >/dev/null 2>&1; then + printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$(($5 + 1))" "$(($2 - 1))" "$(($3 - 2))" "$1" >"$FIFO_UEBERZUGPP" mediainfo --Output="Video;%Duration/String%" "$6" else mediainfo "$6" diff --git a/ar/.local/bin/fzffiles b/ar/.local/bin/fzffiles index 5dd97bc..d092596 100755 --- a/ar/.local/bin/fzffiles +++ b/ar/.local/bin/fzffiles @@ -10,7 +10,14 @@ IFS=' # Get the list of selected files with key bindings for specific paths files=$(fzf-tmux \ --header "^a pwd ^b public ^d .dotfiles ^f configs ^g git ^h home ^k desktop ^r scripts ^s suckless ^u staged files ^v private ^/ help" \ - --preview 'if [ -d {} ]; then exa --color=always --long --all --header --icons --git {}; elif [ -L {} ]; then file -h {}; else bat --color=always --style=header,grid --line-range=:500 {}; fi' \ + --preview "target=\$(readlink -f {}) && + if [ -d \"\$target\" ]; then + exa --color=always --long --all --header --icons --git \"\$target\" + elif [ -f \"\$target\" ]; then + bat --color=always --style=header,grid --line-range=:500 \"\$target\" + else + file -h {} + fi" \ --reverse \ --query="$1" \ --multi \ diff --git a/ar/.local/bin/lfub b/ar/.local/bin/lfub index b743989..c999412 100755 --- a/ar/.local/bin/lfub +++ b/ar/.local/bin/lfub @@ -1,24 +1,24 @@ #!/bin/sh # This is a wrapper script for lf that allows it to create image previews with -# ueberzug. This works in concert with the lf configuration file and the +# ueberzugpp. This works in concert with the lf configuration file and the # lf-cleaner script. set -e cleanup() { exec 3>&- - rm "$FIFO_UEBERZUG" + rm "$FIFO_UEBERZUGPP" } 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 -p json <"$FIFO_UEBERZUG" & - exec 3>"$FIFO_UEBERZUG" + export FIFO_UEBERZUGPP="$HOME/.cache/lf/ueberzugpp-$$" + mkfifo "$FIFO_UEBERZUGPP" + ueberzugpp layer -s -p json <"$FIFO_UEBERZUGPP" & + exec 3>"$FIFO_UEBERZUGPP" trap cleanup HUP INT QUIT TERM PWR EXIT lf "$@" 3>&- fi diff --git a/ar/.local/bin/unewsboat b/ar/.local/bin/unewsboat deleted file mode 100755 index 547fae2..0000000 --- a/ar/.local/bin/unewsboat +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}" - -function 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 & - -newsboat "$@" -cleanup |
