aboutsummaryrefslogtreecommitdiff
path: root/modules/terminal/hjem/programs/broot.nix
blob: d382cbef7bd78f3b0d5e725c959b67a9d00283d9 (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
  pkgs,
  config,
  lib,
  ...
}: let
  cfg = config.collinux.terminal.programs.broot;

  conf = {
    imports = [
      "skins/catppuccin-mocha.hjson"
    ];

    default_flags = "-g";
    icon_theme = "nerdfont";
    special_paths."~/.config".show = "always";

    verbs = [
      {
        name = "open-code";
        key = "enter";
        execution = "$EDITOR +{line} {file}";
        working_dir = "{root}";
        apply_to = "file";
        leave_broot = false;
      }
      {
        name = "lazygit";
        key = "ctrl-g";
        execution = "lazygit";
        working_dir = "{root}";
        apply_to = "any";
        leave_broot = false;
      }
      {
        name = "justfile";
        key = "ctrl-j";
        execution = "${pkgs.just}/bin/just --choose";
        working_dir = "{root}";
        apply_to = "any";
        leave_broot = false;
      }
      {
        name = "terminal";
        key = "ctrl-t";
        execution = "$SHELL";
        working_dir = "{root}";
        leave_broot = false;
      }
      {
        name = "home";
        key = "ctrl-h";
        cmd = ":input_clear;:focus ~";
      }
    ];
  };
in
  lib.mkIf cfg.enable {
    files =
      {
        ".config/broot/conf.hjson" = {
          generator = (pkgs.formats.json {}).generate "broot-conf.hjson";
          value = conf;
        };
      }
      // (lib.optionalAttrs config.collinux.terminal.shells.fish.enable {
        ".config/fish/conf.d/broot.fish".text = ''
          broot --print-shell-function fish | source
        '';
      })
      // (lib.optionalAttrs config.collinux.terminal.shells.bash.enable {
        ".config/bash/conf.d/broot.bash".text = ''
          eval "$(broot --print-shell-function bash)"
        '';
      });

    packages = [pkgs.broot];
  }