You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to make the lfrun work with quit-on-cd which mentions a trick to cd to the current directory when quitting.
But for some reason its not working as expected.
If I run regular lf it exits and cds to expected directory but when I do lfrun it doesn't
Minimal ~/.config/lf/lfrc
set cleaner ~/.config/lf/cleaner
set previewer ~/.config/lf/preview
set shell bash
set shellopts '-eu'
set ifs "\n"
cmd quit-and-cd &{{
pwd > $LF_CD_FILE
notify-send "quit-and-cd" "$LF_CD_FILE\n$(cat $LF_CD_FILE)"
lf -remote "send $id quit"
}}
map Q quit-and-cd
Modified ~/.local/bin/lfrun
#!/bin/bashset -e
cleanup() {
exec3>&-
command rm "$FIFO_UEBERZUG"
}
lf() {
# https://github.com/gokcehan/lf/wiki/Tips#cd-to-current-directory-on-quitexport LF_CD_FILE=/var/tmp/.lfcd-$$command lf $@if [ -s"$LF_CD_FILE" ];thenlocal DIR="$(realpath "$(cat "$LF_CD_FILE")")"if [ "$DIR"!="$PWD" ];thenecho"cd to $DIR"cd"$DIR"ficommand rm "$LF_CD_FILE"fiunset LF_CD_FILE
}
if [ -n"$SSH_CLIENT" ] || [ -n"$SSH_TTY" ];then
lf "$@"else
[ !-d"$HOME/.cache/lf" ] && mkdir --parents "$HOME/.cache/lf"export FIFO_UEBERZUG="$HOME/.cache/lf/ueberzug-$$"
mkfifo "$FIFO_UEBERZUG"
ueberzug layer -s -p json <"$FIFO_UEBERZUG"&exec3>"$FIFO_UEBERZUG"# trap cleanup HUP INT QUIT TERM PWR EXIT # Also tried this onetrap cleanup HUP INT QUIT TERM PWR EXIT
lf "$@"3>&-
fi
The text was updated successfully, but these errors were encountered:
I was trying to make the lfrun work with quit-on-cd which mentions a trick to cd to the current directory when quitting.
But for some reason its not working as expected.
If I run regular lf it exits and cds to expected directory but when I do lfrun it doesn't
Minimal
~/.config/lf/lfrc
Modified
~/.local/bin/lfrun
The text was updated successfully, but these errors were encountered: