bin: add title

This commit is contained in:
Paul Walker
2024-11-13 10:58:02 +00:00
parent 99b19ef275
commit 2ad62813f3

18
bin/title Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/sh
if [ "$1" == "" ] ; then
if [ "$STY" != "" ] ; then
item=$(echo $STY | sed -e 's/^[0-9]*\.//')
elif [ "$TMUX" != "" ] ; then
item=$(tmux display-message -p "#S")
else
item="${USER}@$(hostname -s)"
fi
else
if [ "$1" == "-d" ] ; then
item="$(basename $(pwd))"
else
item=$1
shift
fi
fi
echo -ne "\033]0;$item\007"