1# VTE
2
3{ config, pkgs, lib, ... }:
4
5with lib;
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}/etc/profile.d/vte.sh
13 '';
14
15in
16
17{
18
19 meta = {
20 maintainers = teams.gnome.members;
21 };
22
23 options = {
24
25 programs.bash.vteIntegration = mkOption {
26 default = false;
27 type = types.bool;
28 description = lib.mdDoc ''
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 = mkOption {
36 default = false;
37 type = types.bool;
38 description = lib.mdDoc ''
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 = mkMerge [
48 (mkIf config.programs.bash.vteIntegration {
49 programs.bash.interactiveShellInit = mkBefore vteInitSnippet;
50 })
51
52 (mkIf config.programs.zsh.vteIntegration {
53 programs.zsh.interactiveShellInit = vteInitSnippet;
54 })
55 ];
56}