Wolverine Wolverine - 9 months ago 48
Node.js Question

How do you set the terminal tab title from Node.js?

I'm aware that this can be done manually from the terminal using:

echo -n -e "\033]0;My terminal tab title\007"

I tried putting this into a
and fiddling with the escaping, but I can't get it to work.

Answer Source

To save anyone reading this a bit of time, here is a function that will do it in strict mode:

function setTerminalTitle(title)
    String.fromCharCode(27) + "]0;" + title + String.fromCharCode(7)