nixpkgs/nixos/modules/config/vte.nix

57 lines
1.2 KiB
Nix
Raw Permalink Normal View History

{
config,
pkgs,
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 = {
2024-08-27 20:42:49 +02:00
maintainers = lib.teams.gnome.members;
};
options = {
2024-08-27 20:42:49 +02:00
programs.bash.vteIntegration = lib.mkOption {
default = false;
2024-08-27 20:42:49 +02:00
type = lib.types.bool;
description = ''
Whether to enable Bash integration for VTE terminals.
This allows it to preserve the current directory of the shell
across terminals.
'';
};
2024-08-27 20:42:49 +02:00
programs.zsh.vteIntegration = lib.mkOption {
default = false;
2024-08-27 20:42:49 +02:00
type = lib.types.bool;
description = ''
Whether to enable Zsh integration for VTE terminals.
This allows it to preserve the current directory of the shell
across terminals.
'';
};
};
2024-08-27 20:42:49 +02:00
config = lib.mkMerge [
(lib.mkIf config.programs.bash.vteIntegration {
programs.bash.interactiveShellInit = lib.mkBefore vteInitSnippet;
})
2024-08-27 20:42:49 +02:00
(lib.mkIf config.programs.zsh.vteIntegration {
programs.zsh.interactiveShellInit = vteInitSnippet;
})
];
}