summaryrefslogtreecommitdiff
path: root/modules/common/sessionizer2.nix
blob: 5f159df835aaa5356103d1005bcc8713de32466f (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
{
  pkgs,
  config,
  lib,
  tsunamiLib,
  std,
  ...
}: let
  inherit (tsunamiLib) scriptPath filePath;
  cfg = config.tsunami.sessionizer2;
in {
  options.tsunami.sessionizer2 = {
    enable = lib.mkOption {
      type = lib.types.bool;
      default = true;
    };
  };

  config = lib.mkIf cfg.enable {
    tsunami.keys.leader = [
      {
        name = "New Session";
        key = "C-n";
        exec = "run-shell ${scriptPath "sessions-menu"}";
      }
    ];

    tsunami.files = {
      "broot_sessionizer2_launcher" = std.serde.toTOML {
        imports = ["~/.config/broot/conf.hjson"]; # inherit from user's config
        verbs = [
          {
            invocation = "tmux-window";
            external = ["tmux" "new-window" "-c" "#{?@default-path,#{@default-path},#{pane_current_path}}" "$EDITOR '{file}'"];
            key = "enter";
            apply_to = "file";
            leave_broot = false;
          }
          {
            invocation = "tmux-window";
            external = ["tmux" "new-window" "-c" "#{?@default-path,#{@default-path},#{pane_current_path}}" "$EDITOR '{file}'"];
            key = "enter";
            apply_to = "file";
            leave_broot = false;
          }
        ];
      };
    };
  };
}