1{ config, pkgs, lib, ... }:
2
3with lib;
4
5let
6
7 vteInitSnippet = ''
8 # Show current working directory in VTE terminals window title.
9 # Supports both bash and zsh, requires interactive shell.
10 . ${pkgs.vte.override { gtkVersion = null; }}/etc/profile.d/vte.sh
11 '';
12
13in
14
15{
16
17 meta = {
18 maintainers = teams.gnome.members;
19 };
20
21 options = {
22
23 programs.bash.vteIntegration = mkOption {
24 default = false;
25 type = types.bool;
26 description = ''
27 Whether to enable Bash integration for VTE terminals.
28 This allows it to preserve the current directory of the shell
29 across terminals.
30 '';
31 };
32
33 programs.zsh.vteIntegration = mkOption {
34 default = false;
35 type = types.bool;
36 description = ''
37 Whether to enable Zsh integration for VTE terminals.
38 This allows it to preserve the current directory of the shell
39 across terminals.
40 '';
41 };
42
43 };
44
45 config = mkMerge [
46 (mkIf config.programs.bash.vteIntegration {
47 programs.bash.interactiveShellInit = mkBefore vteInitSnippet;
48 })
49
50 (mkIf config.programs.zsh.vteIntegration {
51 programs.zsh.interactiveShellInit = vteInitSnippet;
52 })
53 ];
54}