From 42987c2d64b549df26de8f724590f01d1bec0ae1 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 11 Mar 2022 18:32:19 -0500 Subject: [PATCH] lf cleanup --- .local/bin/lf-cleaner => .config/lf/cleaner | 0 .config/lf/lfrc | 31 ++++++++++++++++----- .gtkrc-2.0 | 1 + .local/bin/lf-select | 9 ------ .local/bin/lfub | 2 +- 5 files changed, 26 insertions(+), 17 deletions(-) rename .local/bin/lf-cleaner => .config/lf/cleaner (100%) create mode 120000 .gtkrc-2.0 delete mode 100755 .local/bin/lf-select diff --git a/.local/bin/lf-cleaner b/.config/lf/cleaner similarity index 100% rename from .local/bin/lf-cleaner rename to .config/lf/cleaner diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 3ea7f58..63ea24f 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -1,18 +1,29 @@ # Luke's lf settings + +# Note on Image Previews +# For those wanting image previews, like this system, there are four steps to +# set it up. These are done automatically for LARBS users, but I will state +# them here for others doing it manually. +# +# 1. ueberzug must be installed. +# 2. The scope file (~/.config/lf/scope for me), must have a command similar to +# mine to generate ueberzug images. +# 3. A `set cleaner` line as below is a cleaner script. +# 4. lf should be started through a wrapper script (~/.local/bin/lfup for me) +# that creates the environment for ueberzug. This command can be be aliased +# in your shellrc (`alias lf="lfub") or if set to a binding, should be +# called directly instead of normal lf. + # Basic vars -set shell bash set shellopts '-eu' set ifs "\n" set scrolloff 10 set icons set period 1 set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml" -set ratios 1:2:3 -set cleaner ~/.local/bin/lf-cleaner - -# Vars that depend on environmental variables -$lf -remote "send $id set previewer ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope" +set cleaner '~/.config/lf/cleaner' +set previewer '~/.config/lf/scope' # cmds/functions cmd open ${{ @@ -22,7 +33,13 @@ cmd open ${{ text/*|application/json|inode/x-empty) $EDITOR $fx;; image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; image/svg+xml) display -- $f ;; - image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | setsid -f sxiv -aio 2>/dev/null | lf-select & ;; + image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | + setsid -f sxiv -aio 2>/dev/null | while read -r file; do + [ -z "$file" ] && continue + lf -remote "send select \"$file\"" + lf -remote "send toggle" + done & + ;; audio/*) mpv --audio-display=no $f ;; video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; diff --git a/.gtkrc-2.0 b/.gtkrc-2.0 new file mode 120000 index 0000000..20593d7 --- /dev/null +++ b/.gtkrc-2.0 @@ -0,0 +1 @@ +.config/gtk-2.0/gtkrc-2.0 \ No newline at end of file diff --git a/.local/bin/lf-select b/.local/bin/lf-select deleted file mode 100755 index 3b2a17a..0000000 --- a/.local/bin/lf-select +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Reads file names from stdin and selects them in lf. - -while read -r file; do - [ -z "$file" ] && continue - lf -remote "send select \"$file\"" - lf -remote "send toggle" -done diff --git a/.local/bin/lfub b/.local/bin/lfub index 2cf470a..9012f50 100755 --- a/.local/bin/lfub +++ b/.local/bin/lfub @@ -19,6 +19,6 @@ else mkfifo "$FIFO_UEBERZUG" ueberzug layer -s <"$FIFO_UEBERZUG" -p json & exec 3>"$FIFO_UEBERZUG" - trap cleanup EXIT + trap cleanup HUP INT QUIT TERM PWR EXIT lf "$@" 3>&- fi