about summary refs log tree commit diff
path: root/nixos/modules/config/vte.nix
blob: e0b48c3fb4a8b158c4a6a1689fb9badfd021cfba (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
{ config, pkgs, lib, ... }:

with lib;

let

  vteInitSnippet = ''
    # Show current working directory in VTE terminals window title.
    # Supports both bash and zsh, requires interactive shell.
    . ${pkgs.vte.override { gtkVersion = null; }}/etc/profile.d/vte.sh
  '';

in

{

  meta = {
    maintainers = teams.gnome.members;
  };

  options = {

    programs.bash.vteIntegration = mkOption {
      default = false;
      type = types.bool;
      description = ''
        Whether to enable Bash integration for VTE terminals.
        This allows it to preserve the current directory of the shell
        across terminals.
      '';
    };

    programs.zsh.vteIntegration = mkOption {
      default = false;
      type = types.bool;
      description = ''
        Whether to enable Zsh integration for VTE terminals.
        This allows it to preserve the current directory of the shell
        across terminals.
      '';
    };

  };

  config = mkMerge [
    (mkIf config.programs.bash.vteIntegration {
      programs.bash.interactiveShellInit = mkBefore vteInitSnippet;
    })

    (mkIf config.programs.zsh.vteIntegration {
      programs.zsh.interactiveShellInit = vteInitSnippet;
    })
  ];
}