lf with sixels support
parent
7d0ff36a37
commit
c905a33643
|
@ -6,7 +6,6 @@ let
|
|||
rm = "${pkgs.coreutils-full}/bin/rm";
|
||||
mkdir = "${pkgs.coreutils-full}/bin/mkdir";
|
||||
mkfifo = "${pkgs.coreutils-full}/bin/mkfifo";
|
||||
ueberzug = "${pkgs.ueberzug}/bin/ueberzug";
|
||||
lfcache = "${config.home.homeDirectory}/.cache/lf";
|
||||
in pkgs.writeScriptBin "lf-wrapper" ''
|
||||
#!${shell}
|
||||
|
@ -176,20 +175,10 @@ in pkgs.writeScriptBin "lf-wrapper" ''
|
|||
*.nix=:\
|
||||
"
|
||||
|
||||
cleanup () {
|
||||
exec 3>&-
|
||||
rm "$FIFO_UEBERZUG"
|
||||
}
|
||||
|
||||
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
|
||||
${lf} "$@"
|
||||
else
|
||||
[ ! -d "${lfcache}" ] && ${mkdir} -p "${lfcache}"
|
||||
export FIFO_UEBERZUG="${lfcache}/ueberzug-''$''$"
|
||||
${mkfifo} "$FIFO_UEBERZUG"
|
||||
${ueberzug} layer -s <"$FIFO_UEBERZUG" -p json &
|
||||
exec 3>"$FIFO_UEBERZUG"
|
||||
trap cleanup HUP INT QUIT TERM PWR EXIT
|
||||
${lf} "$@"
|
||||
${lf} "$@" 3>&-
|
||||
fi
|
||||
''
|
||||
|
|
|
@ -1,31 +1,28 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
atool = "${pkgs.atool}/bin/atool";
|
||||
awk = "${pkgs.gawk}/bin/awk";
|
||||
bat = "${pkgs.bat}/bin/bat";
|
||||
chafa = "${pkgs.chafa}/bin/chafa";
|
||||
col = "${pkgs.util-linux}/bin/col";
|
||||
ffmpegthumbnailer = "${pkgs.ffmpegthumbnailer}/bin/ffmpegthumbnailer";
|
||||
file = "${pkgs.file}/bin/file";
|
||||
gpg = "${pkgs.gnupg}/bin/gpg";
|
||||
lfcache = "${config.home.homeDirectory}/.cache/lf";
|
||||
lynx = "${pkgs.lynx}/bin/lynx";
|
||||
man = "${pkgs.man}/bin/man";
|
||||
col = "${pkgs.util-linux}/bin/col";
|
||||
bat = "${pkgs.bat}/bin/bat";
|
||||
atool = "${pkgs.atool}/bin/atool";
|
||||
odt2txt = "${pkgs.odt2txt}/bin/odt2txt";
|
||||
gpg = "${pkgs.gnupg}/bin/gpg";
|
||||
mediainfo = "${pkgs.mediainfo}/bin/mediainfo";
|
||||
odt2txt = "${pkgs.odt2txt}/bin/odt2txt";
|
||||
pdftoppm = "${pkgs.poppler_utils}/bin/pdftoppm";
|
||||
printf = "${pkgs.coreutils-full}/bin/printf";
|
||||
lfcache = "${config.home.homeDirectory}/.cache/lf";
|
||||
stat = "${pkgs.coreutils-full}/bin/stat";
|
||||
readlink = "${pkgs.coreutils-full}/bin/readlink";
|
||||
sha256sum = "${pkgs.coreutils-full}/bin/sha256sum";
|
||||
awk = "${pkgs.gawk}/bin/awk";
|
||||
ffmpegthumbnailer = "${pkgs.ffmpegthumbnailer}/bin/ffmpegthumbnailer";
|
||||
pdftoppm = "${pkgs.poppler_utils}/bin/pdftoppm";
|
||||
stat = "${pkgs.coreutils-full}/bin/stat";
|
||||
in pkgs.writeShellScript "pv.sh" ''
|
||||
|
||||
image() {
|
||||
if [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && [ -n "$FIFO_UEBERZUG" ]; then
|
||||
${printf} '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$5" "$(($2-1))" "$(($3-1))" "$1" > "$FIFO_UEBERZUG"
|
||||
else
|
||||
${mediainfo} "$1"
|
||||
fi
|
||||
${chafa} "$1" -f sixel -s "$(($2-2))x$3" | sed 's/#/\n#/g'
|
||||
}
|
||||
|
||||
get_cache_file () {
|
||||
|
|
|
@ -1,6 +1,21 @@
|
|||
{ config, inputs, pkgs, stablePkgs, ... }:
|
||||
|
||||
{
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
# use lf fork with support for sixel graphics
|
||||
lf = super.lf.overrideAttrs (old: {
|
||||
src = super.fetchFromGitHub {
|
||||
owner = "horriblename";
|
||||
repo = "lf";
|
||||
rev = "8997e5b03772d5628ed6a490777048581d978674";
|
||||
sha256 = "rJq2Tv3py6HvRI1O2odTdGb1ksdijhO3FcJsPj5dm34=";
|
||||
};
|
||||
});
|
||||
})
|
||||
];
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
# programs.home-manager.enable = true;
|
||||
|
||||
|
|
Loading…
Reference in New Issue