sophuwu.site > bashprompt
ywfds
sophuwu sophie@skisiel.com
Thu, 25 Apr 2024 02:46:15 +0200
commit

fdcbb2844e0226a83143fc2b0e87e4d7379ab3d8

parent

8a26b86cf06c3e481403e1a062cf193ce4cd404e

1 files changed, 3 insertions(+), 4 deletions(-)

jump to
M src/prompt.cppsrc/prompt.cpp

@@ -65,8 +65,8 @@ std::string host = std::string(readfile("/etc/hostname"));

std::string user; user=std::string(getenv("USER")); if (host=="soph") { - host = "::"; - if (user == "sophuwu") user = "uwu"; + host = ""; + if (user == "sophuwu") user = ""; }

@@ -75,8 +75,7 @@ pipe("hostname -I | awk -F '.' ' { printf(\"%X%X%X%X\",int($1),int($2),int($3),int($4)); } ' ", ip);

unsigned char ipaddr[4]; for (int i = 0; i < 4; i++)ipaddr[i] = unhex(ip[2*i])<<4 | unhex(ip[2*i+1]); printf("\033[1;38;5;%dm%s\033[0m", ipaddr[0], user.c_str()); - if (ipaddr[0]==192||ipaddr[0]==127||ipaddr[0]==10)printf("\033[38;5;%dm%s\033[0m", ipaddr[1], "@"); - else printf("\033[38;5;%dm%s\033[0m", ipaddr[1], "@ext."); + printf("\033[38;5;%dm%s\033[0m", ipaddr[1], "@"); printf("\033[1;38;5;%dm%s\033[0m", ipaddr[2], host.c_str()); printf("\033[1;38;5;%dm%d", ipaddr[3], ipaddr[3]); printf("\033[0m\n");