Get current window title in bash
Иванов Дмитрий <[email protected]> Wed, 9 Feb 2022 11:09:29 +0300
| Newsgroups | gmane.comp.gnu.screen.user |
|---|---|
| Message-ID | <20220209080929.GA49544@tower> |
My goal is to print the current window title in bash prompt. Currently I
know $WINDOW environment variable that contains the number of the
currently selected window.
I learned about "screen -Q title" command but 2 problems emerged:
1. This command is slow and makes a delay when used in .bashrc.
2. When I tried this code:
if [ -n "$STY" ]; then
TITLE=$(screen -Q title)
PS1=$PS1"\[\033[01;93m\]$TITLE "
fi
It shows the title in the prompt and I have to click extra Enter key. Is
it possible to get the name quickly?