aboutsummaryrefslogtreecommitdiff
path: root/bash.nix
diff options
context:
space:
mode:
authorTom Harley2020-12-31 07:45:43 +0000
committerTom Harley2020-12-31 07:45:43 +0000
commit18b5149daea03230be2f67c0db86a8b2a6a74f0e (patch)
tree2edeb76f2080f06e43acff5d5e1b26902eeed56c /bash.nix
parentPut xmonad config in separate file (diff)
downloadhome-manager-18b5149daea03230be2f67c0db86a8b2a6a74f0e.tar.gz
home-manager-18b5149daea03230be2f67c0db86a8b2a6a74f0e.zip

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.

Diffstat (limited to 'bash.nix')
-rw-r--r--bash.nix6
1 files changed, 4 insertions, 2 deletions
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="> "
'';