2020-04-24 23:36:52 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
|
|
|
|
|
|
vteInitSnippet = ''
|
|
|
|
# Show current working directory in VTE terminals window title.
|
|
|
|
# Supports both bash and zsh, requires interactive shell.
|
2024-02-29 20:09:43 +00:00
|
|
|
. ${pkgs.vte.override { gtkVersion = null; }}/etc/profile.d/vte.sh
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
meta = {
|
2024-09-19 14:19:46 +00:00
|
|
|
maintainers = lib.teams.gnome.members;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
programs.bash.vteIntegration = lib.mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
default = false;
|
2024-09-19 14:19:46 +00:00
|
|
|
type = lib.types.bool;
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
Whether to enable Bash integration for VTE terminals.
|
|
|
|
This allows it to preserve the current directory of the shell
|
|
|
|
across terminals.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
programs.zsh.vteIntegration = lib.mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
default = false;
|
2024-09-19 14:19:46 +00:00
|
|
|
type = lib.types.bool;
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
Whether to enable Zsh integration for VTE terminals.
|
|
|
|
This allows it to preserve the current directory of the shell
|
|
|
|
across terminals.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
config = lib.mkMerge [
|
|
|
|
(lib.mkIf config.programs.bash.vteIntegration {
|
|
|
|
programs.bash.interactiveShellInit = lib.mkBefore vteInitSnippet;
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
(lib.mkIf config.programs.zsh.vteIntegration {
|
2020-04-24 23:36:52 +00:00
|
|
|
programs.zsh.interactiveShellInit = vteInitSnippet;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|