@@ -0,0 +1,52 @@
1+# VTE
2+
3+{ config, pkgs, lib, ... }:
4+
5+with lib;
6+
7+let
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+
15+in
16+
17+{
18+
19+ options = {
20+
21+ programs.bash.vteIntegration = mkOption {
22+ default = false;
23+ type = types.bool;
24+ description = ''
25+ Whether to enable Bash integration for VTE terminals.
26+ This allows it to preserve the current directory of the shell
27+ across terminals.
28+ '';
29+ };
30+
31+ programs.zsh.vteIntegration = mkOption {
32+ default = false;
33+ type = types.bool;
34+ description = ''
35+ Whether to enable Zsh integration for VTE terminals.
36+ This allows it to preserve the current directory of the shell
37+ across terminals.
38+ '';
39+ };
40+
41+ };
42+
43+ config = mkMerge [
44+ (mkIf config.programs.bash.vteIntegration {
45+ programs.bash.interactiveShellInit = vteInitSnippet;
46+ })
47+
48+ (mkIf config.programs.zsh.vteIntegration {
49+ programs.zsh.interactiveShellInit = vteInitSnippet;
50+ })
51+ ];
52+}