mirror of
https://git.checksum.fail/alec/erythros
synced 2025-12-11 13:39:55 +02:00
System/Core/Shell: Set window title in @shell_input_loop()
This commit is contained in:
@@ -225,6 +225,24 @@ U0 @shell_update_prompts(@shell* sh)
|
|||||||
&sh->session->hostname, &buf);
|
&sh->session->hostname, &buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
U0 @shell_set_window_title(@shell* sh)
|
||||||
|
{
|
||||||
|
U8 buf[512];
|
||||||
|
U8 buf2[512];
|
||||||
|
U8 buf3[512];
|
||||||
|
StrCpy(&buf, &sh->cwd);
|
||||||
|
StrPrint(buf2, "/home/%s", &sh->session->user.name);
|
||||||
|
if (!StrCmp(&buf, &buf2))
|
||||||
|
StrCpy(&buf, "~");
|
||||||
|
else
|
||||||
|
StrCpy(&buf, StrLastOcc(&buf, "/") + 1);
|
||||||
|
StrPrint(buf3, "[%s@%s %s]", &sh->session->user.name,
|
||||||
|
&sh->session->hostname, &buf);
|
||||||
|
Stdio.WriteLine(sh, "\x1b]0;");
|
||||||
|
Stdio.WriteLine(sh, &buf3);
|
||||||
|
Stdio.WriteLine(sh, "\x07");
|
||||||
|
}
|
||||||
|
|
||||||
I64 @shell_input_loop(@shell* sh)
|
I64 @shell_input_loop(@shell* sh)
|
||||||
{
|
{
|
||||||
CHashFun* cmd;
|
CHashFun* cmd;
|
||||||
@@ -238,6 +256,7 @@ I64 @shell_input_loop(@shell* sh)
|
|||||||
while (!exit) {
|
while (!exit) {
|
||||||
|
|
||||||
@shell_update_prompts(sh);
|
@shell_update_prompts(sh);
|
||||||
|
@shell_set_window_title(sh);
|
||||||
Stdio.ReadLine(sh, sh->PS1, buf);
|
Stdio.ReadLine(sh, sh->PS1, buf);
|
||||||
|
|
||||||
@shell_history_append(sh, &buf);
|
@shell_history_append(sh, &buf);
|
||||||
|
|||||||
Reference in New Issue
Block a user