57 lines
1.5 KiB
Nix
57 lines
1.5 KiB
Nix
{ pkgs, config, lib, ... }: lib.mkIf config.programs.lf.enable {
|
|
home = {
|
|
packages = with pkgs; [
|
|
chafa
|
|
ctpv
|
|
];
|
|
file = {
|
|
".config/lf/icons" = {
|
|
source = ../../../configs/lf/icons;
|
|
};
|
|
".config/lf/colors" = {
|
|
source = ../../../configs/lf/colors;
|
|
};
|
|
};
|
|
};
|
|
programs.lf = {
|
|
commands = {
|
|
get-mime-type = "%xdg-mime query filetype \"$f\"";
|
|
open = ''
|
|
''${{
|
|
case $(file --mime-type $f -b) in
|
|
text/*|application/json|inode/x-empty|application/octet-stream) $EDITOR "$f" ;;
|
|
image/svg+xml) display -- "$f" ;;
|
|
audio/*) mpv --audio-display=no "$f" ;;
|
|
video/*) setsid -f mpv "$f" -quiet >/dev/null 2>&1 ;;
|
|
image/vnd.djvu|application/pdf|application/pdf|application/epub*) setsid -f $BROWSER "$f" >/dev/null 2>&1 ;;
|
|
application/pgp-encrypted) $EDITOR "$f" ;;
|
|
*) for f in $fx; do setsid -f $OPENER "$f" >/dev/null 2>&1; done ;;
|
|
esac
|
|
}}'';
|
|
on-select = ''
|
|
&{{
|
|
lf -remote "send $id set statfmt \"$(lsd -ld --color=always "$f")\""
|
|
}}
|
|
'';
|
|
};
|
|
settings = {
|
|
icons = true;
|
|
period = 1;
|
|
info = "size";
|
|
dircounts = true;
|
|
sixel = true;
|
|
scrolloff = 5;
|
|
hidden = true;
|
|
previewer = "ctpv";
|
|
cleaner = "ctpvclear";
|
|
};
|
|
keybindings = {
|
|
"<enter>" = "open";
|
|
};
|
|
extraConfig = ''
|
|
&ctpv -s $id
|
|
&ctpvquit $id
|
|
'';
|
|
};
|
|
}
|