From 18b5149daea03230be2f67c0db86a8b2a6a74f0e Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Thu, 31 Dec 2020 07:45:43 +0000 Subject: Add terminal-title-setting code Adds code based on https://tldp.org/HOWTO/Bash-Prompt-HOWTO/xterm-title-bar-manipulations.html to edit the terminal emulator's window title each time PS1 is evaluated. --- bash.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bash.nix') diff --git a/bash.nix b/bash.nix index b223742..5e757bd 100644 --- a/bash.nix +++ b/bash.nix @@ -10,10 +10,12 @@ }; initExtra = '' + TITLEBAR='\[\033]0;\u@\h:\w\007\]' + if [ -z $IN_NIX_SHELL ] ; then - export PS1="[\[\e[34m\]\u@\h \W\[\e[39m\]]\$ " + export PS1="$TITLEBAR[\[\e[34m\]\u@\h \W\[\e[39m\]]\$ " else - export PS1="[\[\e[34m\]\u@\h \W\[\e[39m\]]* " + export PS1="$TITLEBAR[\[\e[34m\]\u@\h \W\[\e[39m\]]* " fi export PS2="> " ''; -- cgit v1.2.1