Terminal: Support setting the window title using Xterm escape sequences.

Use this in the /bin/sh prompt to keep the window title in sync with the
shell's working directory. :^)
This commit is contained in:
Andreas Kling 2019-01-25 05:51:39 +01:00
commit 5adaeeaa3b
Notes: sideshowbarker 2024-07-19 15:57:08 +09:00
3 changed files with 60 additions and 1 deletions

View file

@ -26,8 +26,10 @@ static void prompt()
{
if (g->uid == 0)
printf("# ");
else
else {
printf("\033]0;%s@%s:%s\007", g->username.characters(), g->hostname, g->cwd.characters());
printf("\033[31;1m%s\033[0m@\033[37;1m%s\033[0m:\033[32;1m%s\033[0m$> ", g->username.characters(), g->hostname, g->cwd.characters());
}
fflush(stdout);
}