From b40c0f34c3d7cc043e2a714195b5b9643e4cce2c Mon Sep 17 00:00:00 2001 From: tdro Date: Mon, 26 Feb 2024 20:45:07 -0500 Subject: .bashrc: Improve window titles --- .bashrc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.bashrc b/.bashrc index bf3dfb3..c1310a0 100644 --- a/.bashrc +++ b/.bashrc @@ -124,10 +124,11 @@ docker-rootfs() { id=$(docker run --detach "$1" /bin/true) \ && docker container rm "$id" \ && ls -l rootfs.tar; } -# https://til.simonwillison.net/bash/escaping-a-string -# press ctrl+d after writing string to standard input +# press ctrl+d after writing string to standard input (https://til.simonwillison.net/bash/escaping-a-string) shellquote() { printf '%q\n' "$(cat)"; } -trap 'echo -ne "\033]2;command: $(history 1 | shellquote)\007"' DEBUG + +# show window title of last command (https://stackoverflow.com/a/5080670) +trap 'echo -ne "\033]2;command: $PWD $(history 1 | sed "s/^[ ]*[0-9]*[ ]*//g")\007"' DEBUG # swallow swallow() { "$@" & disown; exit; } -- cgit v1.2.3