| 
									
										
										
										
											2019-08-21 15:56:25 -04:00
										 |  |  | # VTE | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | { config, pkgs, lib, ... }: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | with lib; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | let | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   vteInitSnippet = ''
 | 
					
						
							|  |  |  |     # Show current working directory in VTE terminals window title. | 
					
						
							|  |  |  |     # Supports both bash and zsh, requires interactive shell. | 
					
						
							|  |  |  |     . ${pkgs.vte}/etc/profile.d/vte.sh | 
					
						
							|  |  |  |   '';
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | in | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-01 20:16:24 -04:00
										 |  |  |   meta = { | 
					
						
							|  |  |  |     maintainers = teams.gnome.members; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-21 15:56:25 -04:00
										 |  |  |   options = { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     programs.bash.vteIntegration = mkOption { | 
					
						
							|  |  |  |       default = false; | 
					
						
							|  |  |  |       type = types.bool; | 
					
						
							|  |  |  |       description = ''
 | 
					
						
							|  |  |  |         Whether to enable Bash integration for VTE terminals. | 
					
						
							|  |  |  |         This allows it to preserve the current directory of the shell | 
					
						
							|  |  |  |         across terminals. | 
					
						
							|  |  |  |       '';
 | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     programs.zsh.vteIntegration = mkOption { | 
					
						
							|  |  |  |       default = false; | 
					
						
							|  |  |  |       type = types.bool; | 
					
						
							|  |  |  |       description = ''
 | 
					
						
							|  |  |  |         Whether to enable Zsh integration for VTE terminals. | 
					
						
							|  |  |  |         This allows it to preserve the current directory of the shell | 
					
						
							|  |  |  |         across terminals. | 
					
						
							|  |  |  |       '';
 | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   config = mkMerge [ | 
					
						
							|  |  |  |     (mkIf config.programs.bash.vteIntegration { | 
					
						
							| 
									
										
										
										
											2019-08-23 10:11:48 -04:00
										 |  |  |       programs.bash.interactiveShellInit = mkBefore vteInitSnippet; | 
					
						
							| 
									
										
										
										
											2019-08-21 15:56:25 -04:00
										 |  |  |     }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     (mkIf config.programs.zsh.vteIntegration { | 
					
						
							|  |  |  |       programs.zsh.interactiveShellInit = vteInitSnippet; | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |   ]; | 
					
						
							|  |  |  | } |