about summary refs log tree commit diff stats
path: root/modules/home/conf/lf/default.nix
blob: 7b604ed05f9aa320555b26c5a276f7d610caef8b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
  pkgs,
  sysLib,
  nixosConfig,
  shell_library,
  system,
  ...
}: let
  commands = import ./commands {inherit pkgs sysLib shell_library system;};
  keybindings = import ./keybindings {inherit nixosConfig;};
in {
  xdg.configFile."lf/icons".source = ./icons;
  xdg.configFile."lf/colors".source = ./colors;

  # TODO: add the systemd tempfile option here

  programs.lf = {
    enable = true;

    inherit commands keybindings;

    previewer = {
      keybinding = "i";
      source = "${pkgs.ctpv}/bin/ctpv";
    };
    settings = {
      # close the server, after the last client exits
      autoquit = true;

      # disable the cusor in the preview pane
      cursorpreviewfmt = "";

      # preview for directories
      # dirpreviews = true;

      # count things in directories
      dircounts = true;

      drawbox = true;

      # errorfmt = "\\033[1;91m==> ERROR:\\033[0m\\033[1;93m%s\\033[0m";
      errorfmt = "\\033[1;91m%s\\033[0m";
      hidden = true; # show hidden files
      icons = true;
      ifs = "\\n"; # internal field separator for shell commands
      #info = "size"; # show the size of a directory
      shell = "sh";
      shellopts = "-eu"; # e: exit on error; u: error for unset variables
    };
    # TODO: remove auto quit, if it has been added
    extraConfig = ''
      &${pkgs.ctpv}/bin/ctpv -s $id
      cmd on-quit %${pkgs.ctpv}/bin/ctpv -e $id
      set cleaner ${pkgs.ctpv}/bin/ctpvclear

      source ${nixosConfig.age.secrets.lf_cd_paths.path}
    '';
  };
}