aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2024-02-26 20:45:07 -0500
committertdro <tdro@users.noreply.github.com>2024-02-26 20:45:07 -0500
commitb40c0f34c3d7cc043e2a714195b5b9643e4cce2c (patch)
treeeced6c49a00e95b3dc901960233870cedf667f01
parent6b75c4809a1a55894cc49a74a337aefe90b348cc (diff)
downloaddotfiles-b40c0f34c3d7cc043e2a714195b5b9643e4cce2c.tar.gz
dotfiles-b40c0f34c3d7cc043e2a714195b5b9643e4cce2c.tar.bz2
dotfiles-b40c0f34c3d7cc043e2a714195b5b9643e4cce2c.zip
.bashrc: Improve window titles
-rw-r--r--.bashrc7
1 files 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; }