refactor: rename home modules/general cleanup

This commit is contained in:
ooks-io 2024-01-26 13:43:14 +13:00
parent 16dd61d968
commit 653640b484
86 changed files with 230 additions and 322 deletions

View file

@ -0,0 +1,28 @@
{ lib, ... }:
{
imports = [
./lf #configuration still needs some work
# ./ranger
];
options.homeModules.console.fileManager = {
lf = {
enable = lib.mkEnableOption "Enable lf file manager";
default = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Set lf as the default terminal file manager";
};
};
ranger = {
enable = lib.mkEnableOption "Enable ranger file manager";
default = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Set ranger as the default terminal file manager";
};
};
};
}

View file

@ -0,0 +1,65 @@
{ pkgs, lib, config, ... }:
#TODO - mkif wayland for previewer
# - manage previewer dependencies better
# - ripdrag support
# - color parity with eza
let
cfg = config.homeModules.console.fileManager.lf;
in
{
config = lib.mkIf cfg.enable {
home.sessionVariables.TERMFILEMANAGER = lib.mkIf cfg.default "lf";
xdg.configFile."lf/icons".source = ./icons;
programs.lf = {
enable = true;
settings = {
hidden = true;
ignorecase = true;
drawbox = true;
icons = true;
};
previewer = {
keybinding = "i";
source = "${pkgs.ctpv}/bin/ctpv";
};
commands = {
fzf-lf = ''
''${{
res="$(find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune -o -print 2> /dev/null | sed 1d | cut -b3- | fzf +m)"
if [ -d "$res" ] ; then
cmd="cd"
elif [ -f "$res" ] ; then
cmd="select"
else
exit 0
fi
lf -remote "send $id $cmd \"$res\""
}}
'';
mkdir = ''
''${{
printf "Directory Name: "
read DIR
mkdir $DIR
}}
'';
};
keybindings = {
c = "mkdir";
"<a-f>" = "fzf-lf";
};
extraConfig = ''
&${pkgs.ctpv}/bin/ctpv -s $id
cmd on-quit %${pkgs.ctpv}/bin/ctpv -e $id
set cleaner ${pkgs.ctpv}/bin/ctpvclear
set sixel true
'';
};
home.packages = with pkgs; [ chafa ctpv glow ];
};
}