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