From bb6d49c8f1e41fd77d0a3f19da164276e4b564c6 Mon Sep 17 00:00:00 2001 From: Jan Krag Date: Tue, 7 Feb 2023 16:55:50 +0100 Subject: [PATCH] Set title of terminal (tab) to 'channel@repo-name' --- chat.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/chat.sh b/chat.sh index e346b52..ffb98fe 100755 --- a/chat.sh +++ b/chat.sh @@ -33,8 +33,16 @@ welcome() { echo } -welcome +title(){ + BASE=$(basename -s .git "$(git config --get remote.origin.url)") + BRANCH=$(git branch --show-current) + TITLE="#$BRANCH @ $BASE" + printf '\033]2;%s\a' "$TITLE" + #printf "\[\e]2;%s\a\]" +} +welcome +title fetch_print_ff() { git fetch --quiet git chatlog "..@{u}" @@ -57,6 +65,7 @@ while true ; do echo elif [ "$cm" = "/switch" ]; then git switch "$options" + title echo "Showing last 5 messages in $options" git chatlog -5 elif [ "$cm" = "/list" ]; then @@ -67,6 +76,7 @@ while true ; do git switch --quiet --orphan "$options" git commit --allow-empty --message "Beginning of Channel $options" git push --set-upstream --quiet origin "$options" + title elif [ "$cm" = "/repeat" ]; then : "${options:=5}" echo -e "Repeating last $options messages in ${RED}$(git branch --show-current)${RC}"