Add Windows
This commit is contained in:
parent
dbf1df4a2f
commit
997b2d0239
3 changed files with 80 additions and 23 deletions
|
@ -10,7 +10,7 @@ Nyalpine, Nyarch Linuwu, Nyartix Linuwu, Debinyan, endOwO, Fedowa, GentOwO, GnUw
|
||||||
|
|
||||||
#### Partial support (Either no Ascii art, or no image is provided)
|
#### Partial support (Either no Ascii art, or no image is provided)
|
||||||
|
|
||||||
KDE NeOwOn, nixOwOs, Swackwawe, sOwOlus; Plus FweeBSD, OwOpenBSD and macOwOS
|
KDE NeOwOn, nixOwOs, Swackwawe, sOwOlus; Plus FweeBSD, OwOpenBSD and macOwOS; Plus WinyandOwOws.
|
||||||
|
|
||||||
## Building and installation
|
## Building and installation
|
||||||
|
|
||||||
|
|
100
uwufetch.c
100
uwufetch.c
|
@ -68,6 +68,8 @@ struct utsname sys_var;
|
||||||
struct sysinfo sys;
|
struct sysinfo sys;
|
||||||
#endif
|
#endif
|
||||||
struct winsize win;
|
struct winsize win;
|
||||||
|
|
||||||
|
int iscygwin = 0;
|
||||||
// initialise the variables to store data, gpu array can hold up to 8 gpus
|
// initialise the variables to store data, gpu array can hold up to 8 gpus
|
||||||
int target_width = 0, screen_width = 0, screen_height = 0, ram_total, ram_used = 0, pkgs = 0;
|
int target_width = 0, screen_width = 0, screen_height = 0, ram_total, ram_used = 0, pkgs = 0;
|
||||||
long uptime = 0;
|
long uptime = 0;
|
||||||
|
@ -350,16 +352,25 @@ void get_info()
|
||||||
// os version
|
// os version
|
||||||
FILE *os_release = fopen("/etc/os-release", "r");
|
FILE *os_release = fopen("/etc/os-release", "r");
|
||||||
FILE *cpuinfo = fopen("/proc/cpuinfo", "r");
|
FILE *cpuinfo = fopen("/proc/cpuinfo", "r");
|
||||||
if (os_release)
|
#ifdef __CYGWIN__
|
||||||
|
iscygwin = 1;
|
||||||
|
#endif
|
||||||
|
if(iscygwin == 1)
|
||||||
|
sprintf(version_name, "windows");
|
||||||
|
|
||||||
|
if (os_release || iscygwin == 1)
|
||||||
{ // get normal vars
|
{ // get normal vars
|
||||||
while (fgets(line, sizeof(line), os_release))
|
if(iscygwin == 0) {
|
||||||
if (sscanf(line, "\nID=%s", version_name))
|
while (fgets(line, sizeof(line), os_release))
|
||||||
break;
|
if (sscanf(line, "\nID=%s", version_name))
|
||||||
|
break;
|
||||||
|
}
|
||||||
while (fgets(line, sizeof(line), cpuinfo))
|
while (fgets(line, sizeof(line), cpuinfo))
|
||||||
if (sscanf(line, "model name : %[^\n]", cpu_model))
|
if (sscanf(line, "model name : %[^\n]", cpu_model))
|
||||||
break;
|
break;
|
||||||
sprintf(user, "%s", getenv("USER"));
|
sprintf(user, "%s", getenv("USER"));
|
||||||
fclose(os_release);
|
if(iscygwin == 0)
|
||||||
|
fclose(os_release);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // try for android vars, next for macOS var, or unknown system
|
{ // try for android vars, next for macOS var, or unknown system
|
||||||
|
@ -414,25 +425,48 @@ void get_info()
|
||||||
|
|
||||||
// ram
|
// ram
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
FILE *meminfo;
|
#ifndef __CYGWIN__
|
||||||
|
FILE *meminfo;
|
||||||
|
|
||||||
meminfo = popen("LANG=EN_us free 2> /dev/null", "r");
|
meminfo = popen("LANG=EN_us free 2> /dev/null", "r");
|
||||||
while (fgets(line, sizeof(line), meminfo))
|
while (fgets(line, sizeof(line), meminfo))
|
||||||
{
|
|
||||||
// free command prints like this: "Mem:" total used free shared buff/cache available
|
|
||||||
if (sscanf(line, "Mem: %d %d", &ram_total, &ram_used))
|
|
||||||
{
|
{
|
||||||
// convert to megabytes
|
// free command prints like this: "Mem:" total used free shared buff/cache available
|
||||||
if (ram_total > 0 && ram_used > 0)
|
if (sscanf(line, "Mem: %d %d", &ram_total, &ram_used))
|
||||||
{
|
{
|
||||||
// data is in bytes
|
// convert to megabytes
|
||||||
ram_total /= 1024;
|
if (ram_total > 0 && ram_used > 0)
|
||||||
ram_used /= 1024;
|
{
|
||||||
break;
|
// data is in bytes
|
||||||
|
ram_total /= 1024;
|
||||||
|
ram_used /= 1024;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
fclose(meminfo);
|
||||||
fclose(meminfo);
|
#else
|
||||||
|
//wmic OS get FreePhysicalMemory
|
||||||
|
|
||||||
|
FILE *mem_used_fp, *mem_total_fp;
|
||||||
|
mem_used_fp = popen("wmic OS GET FreePhysicalMemory | sed -n 2p", "r");
|
||||||
|
mem_total_fp = popen("wmic ComputerSystem GET TotalPhysicalMemory | sed -n 2p", "r");
|
||||||
|
char mem_used_ch[2137], mem_total_ch[2137];
|
||||||
|
while (fgets(mem_used_ch, sizeof(mem_used_ch), mem_used_fp) != NULL) {
|
||||||
|
while (fgets(mem_total_ch, sizeof(mem_total_ch), mem_total_fp) != NULL) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
pclose(mem_used_fp);
|
||||||
|
pclose(mem_total_fp);
|
||||||
|
|
||||||
|
int mem_used = atoi(mem_used_ch);
|
||||||
|
|
||||||
|
ram_used = mem_used / 1024;
|
||||||
|
|
||||||
|
// I couldn't get it to show the total amount of ram correctly, so for now this cursed method here
|
||||||
|
ram_total = mem_total_ch;
|
||||||
|
ram_total = ram_total * -1;
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
// Used
|
// Used
|
||||||
FILE *mem_wired_fp, *mem_active_fp, *mem_compressed_fp;
|
FILE *mem_wired_fp, *mem_active_fp, *mem_compressed_fp;
|
||||||
|
@ -482,7 +516,11 @@ void get_info()
|
||||||
if (strcmp(version_name, "android") != 0)
|
if (strcmp(version_name, "android") != 0)
|
||||||
{
|
{
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
gpu = popen("lspci -mm 2> /dev/null | grep \"VGA\" | cut --fields=4,6 -d '\"' --output-delimiter=\" \" | sed \"s/ Controller.*//\"", "r");
|
#ifdef __CYGWIN__
|
||||||
|
gpu = popen("wmic PATH Win32_VideoController GET Name | sed -n 2p", "r");
|
||||||
|
#else
|
||||||
|
gpu = popen("lspci -mm 2> /dev/null | grep \"VGA\" | cut --fields=4,6 -d '\"' --output-delimiter=\" \" | sed \"s/ Controller.*//\"", "r");
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
gpu = popen("system_profiler SPDisplaysDataType | awk -F ': ' '/Chipset Model: /{ print $2 }'", "r");
|
gpu = popen("system_profiler SPDisplaysDataType | awk -F ': ' '/Chipset Model: /{ print $2 }'", "r");
|
||||||
#endif
|
#endif
|
||||||
|
@ -531,12 +569,12 @@ void list(char *arg)
|
||||||
" %sBSD %sbased:\n"
|
" %sBSD %sbased:\n"
|
||||||
" %sfreebsd, %sopenbsd, %sm%sa%sc%so%ss\n\n"
|
" %sfreebsd, %sopenbsd, %sm%sa%sc%so%ss\n\n"
|
||||||
" %sOther/spare distributions:\n"
|
" %sOther/spare distributions:\n"
|
||||||
" %salpine, %sfedora, %sgentoo, %s\"void\", \"opensuse-leap\", android, %sgnu, guix, %sunknown\n",
|
" %salpine, %sfedora, %sgentoo, %s\"void\", \"opensuse-leap\", android, %sgnu, guix, %swindows, %sunknown\n",
|
||||||
arg,
|
arg,
|
||||||
BLUE, NORMAL, BLUE, GREEN, // Arch based colors
|
BLUE, NORMAL, BLUE, GREEN, // Arch based colors
|
||||||
RED, YELLOW, NORMAL, RED, GREEN, BLUE, RED, // Debian based colors
|
RED, YELLOW, NORMAL, RED, GREEN, BLUE, RED, // Debian based colors
|
||||||
RED, NORMAL, RED, YELLOW, GREEN, YELLOW, RED, PINK, BLUE, // BSD colors
|
RED, NORMAL, RED, YELLOW, GREEN, YELLOW, RED, PINK, BLUE, // BSD colors
|
||||||
NORMAL, BLUE, BLUE, PINK, GREEN, YELLOW, WHITE); // Other/spare distributions colors
|
NORMAL, BLUE, BLUE, PINK, GREEN, YELLOW, BLUE, WHITE); // Other/spare distributions colors
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_ascii()
|
void print_ascii()
|
||||||
|
@ -742,6 +780,21 @@ void print_ascii()
|
||||||
GREEN, YELLOW, RED, PINK, BLUE);
|
GREEN, YELLOW, RED, PINK, BLUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Windows
|
||||||
|
else if (strcmp(version_name, "windows") == 0)
|
||||||
|
{
|
||||||
|
printf("%sMMMMMMM MMMMMMM\n"
|
||||||
|
"M ^ M M ^ M\n"
|
||||||
|
"M M M M\n"
|
||||||
|
"MMMMMMM MMMMMMM\n"
|
||||||
|
"\n"
|
||||||
|
"MMMMMMM MMMMMMM\n"
|
||||||
|
"M W W W M\n"
|
||||||
|
"M WW WW M\n"
|
||||||
|
"MMMMMMM MMMMMMM\n",
|
||||||
|
BLUE);
|
||||||
|
}
|
||||||
|
|
||||||
// everything else
|
// everything else
|
||||||
else
|
else
|
||||||
printf("\033[0E\033[2C%s._.--._.\n"
|
printf("\033[0E\033[2C%s._.--._.\n"
|
||||||
|
@ -833,6 +886,9 @@ void uwu_name()
|
||||||
|
|
||||||
else STRING_TO_UWU("macos", "macOwOS");
|
else STRING_TO_UWU("macos", "macOwOS");
|
||||||
|
|
||||||
|
// Windows
|
||||||
|
else STRING_TO_UWU("windows", "WinyandOwOws");
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(version_name, "%s", "unknown");
|
sprintf(version_name, "%s", "unknown");
|
||||||
|
|
|
@ -89,6 +89,7 @@ sOwOlus\ \ \ \ \ \ \ \ \ \ solus\
|
||||||
FweeBSD\ \ \ \ \ \ \ \ \ \ freebsd\
|
FweeBSD\ \ \ \ \ \ \ \ \ \ freebsd\
|
||||||
OwOpenBSD\ \ \ \ \ \ \ \ \ openbsd
|
OwOpenBSD\ \ \ \ \ \ \ \ \ openbsd
|
||||||
macOwOS\ \ \ \ \ \ \ \ \ macos
|
macOwOS\ \ \ \ \ \ \ \ \ macos
|
||||||
|
WinyandOwOws\ \ \ \ \ \ \ \ \ windows
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue