Theoretically fixed gpu name being too long, new 'Requisites' in readme, now uwufetch depends from lshw
This commit is contained in:
parent
694a09a47d
commit
a695c922f4
2 changed files with 14 additions and 11 deletions
|
@ -8,6 +8,11 @@ Nyalpine, Nyarch Linuwu, Nyartix Linuwu, Debinyan, Fedowa, GentOwO, Miwint, Myan
|
||||||
|
|
||||||
## Building and installation
|
## Building and installation
|
||||||
|
|
||||||
|
#### Requisites
|
||||||
|
|
||||||
|
[viu](https://github.com/atanunq/viu) to use images instead of ascii art.
|
||||||
|
[lshw](https://github.com/lyonel/lshw) to get gpu info.
|
||||||
|
|
||||||
##### Via package manager
|
##### Via package manager
|
||||||
|
|
||||||
Right now, the package is only available on the AUR:
|
Right now, the package is only available on the AUR:
|
||||||
|
|
20
uwufetch.c
20
uwufetch.c
|
@ -156,10 +156,7 @@ void get_info() { // get all necessary info
|
||||||
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) { // get normal vars
|
if (os_release) { // get normal vars
|
||||||
while (fgets(line, sizeof(line), os_release)) {
|
while (fgets(line, sizeof(line), os_release)) if (sscanf(line, "\nID=%s", version_name)) break;
|
||||||
sscanf(line, "\nID=%s", version_name);
|
|
||||||
if (strlen(version_name)) break;
|
|
||||||
}
|
|
||||||
while (fgets(line, sizeof(line), cpuinfo)) if (sscanf(line, "model name : %[^\n]", cpu_model)) break;
|
while (fgets(line, sizeof(line), cpuinfo)) if (sscanf(line, "model name : %[^\n]", cpu_model)) break;
|
||||||
sprintf(user, "%s", getenv("USER"));
|
sprintf(user, "%s", getenv("USER"));
|
||||||
fclose(os_release);
|
fclose(os_release);
|
||||||
|
@ -174,7 +171,7 @@ void get_info() { // get all necessary info
|
||||||
FILE *whoami = popen("whoami", "r");
|
FILE *whoami = popen("whoami", "r");
|
||||||
if (fscanf(whoami, "%s", user) == 3) sprintf(user, "unknown");
|
if (fscanf(whoami, "%s", user) == 3) sprintf(user, "unknown");
|
||||||
fclose(whoami);
|
fclose(whoami);
|
||||||
while (fgets(line, sizeof(line), cpuinfo)) if (fscanf(cpuinfo, "Hardware : %[^\n]", cpu_model)) break;
|
while (fgets(line, sizeof(line), cpuinfo)) if (sscanf(line, "Hardware : %[^\n]", cpu_model)) break;
|
||||||
} else sprintf(version_name, "unknown");
|
} else sprintf(version_name, "unknown");
|
||||||
}
|
}
|
||||||
fclose(cpuinfo);
|
fclose(cpuinfo);
|
||||||
|
@ -200,13 +197,14 @@ void get_info() { // get all necessary info
|
||||||
|
|
||||||
// gpu
|
// gpu
|
||||||
FILE *gpu;
|
FILE *gpu;
|
||||||
if (strcmp(version_name, "android") != 0) gpu = popen("lspci -mm | grep \"VGA\\|00:02\" | cut --fields=4,6 -d '\"' --output-delimiter=\" \" | sed \"s/ Controller.*//\"", "r");
|
gpu = popen("lshw -class display 2> /dev/null", "r");
|
||||||
else gpu = popen("getprop ro.hardware.vulkan", "r");
|
while (fgets(line, sizeof(line), gpu)) if (sscanf(line, " product: %[^\n]", gpu_model)) break;
|
||||||
if (gpu) {
|
if (strlen(gpu_model) < 1) {
|
||||||
// Ignore error
|
if (strcmp(version_name, "android") != 0) gpu = popen("lspci -mm 2> /dev/null | grep \"VGA\\|00:02\" | cut --fields=4,6 -d '\"' --output-delimiter=\" \" | sed \"s/ Controller.*//\"", "r");
|
||||||
if(fscanf(gpu, "%[^\n]", gpu_model) == 3) {};
|
else gpu = popen("getprop ro.hardware.vulkan 2> /dev/null", "r");
|
||||||
fclose(gpu);
|
while (fgets(line, sizeof(line), gpu)) if (sscanf(line, "%[^\n]", gpu_model)) break;
|
||||||
}
|
}
|
||||||
|
fclose(gpu);
|
||||||
|
|
||||||
pkgs = pkgman();
|
pkgs = pkgman();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue