Size: 52
Comment: This one has been merged into 044 and is now available.
|
Size: 643
Comment: How can I set the contents of my terminal's title bar?
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
== Placeholder == Placeholder. |
== How can I set the contents of my terminal's title bar? == If you have a terminal that understands `xterm`-compatible escape sequences, and you just want to set the title one time, you can use a function like this: {{{ settitle() { printf '\e]2;%s\a' "$*"; } }}} If you want to set the title bar to the currently-running process's title every time you type a command, then this solution approximates it: {{{ trap 'printf "\e]2;%s\a" "$(HISTTIMEFORMAT='' history 1)"' DEBUG }}} However, it leaves the command history number in place, and it doesn't trigger on explicit subshells like `(cd foo && make)`. |
How can I set the contents of my terminal's title bar?
If you have a terminal that understands xterm-compatible escape sequences, and you just want to set the title one time, you can use a function like this:
settitle() { printf '\e]2;%s\a' "$*"; }
If you want to set the title bar to the currently-running process's title every time you type a command, then this solution approximates it:
trap 'printf "\e]2;%s\a" "$(HISTTIMEFORMAT='' history 1)"' DEBUG
However, it leaves the command history number in place, and it doesn't trigger on explicit subshells like (cd foo && make).