Merge branch 'main' into main
This commit is contained in:
commit
59900252d0
1 changed files with 31 additions and 11 deletions
42
uwufetch.c
42
uwufetch.c
|
@ -73,12 +73,15 @@ int ram_total, ram_used = 0;
|
||||||
int pkgs, target_width = 0;
|
int pkgs, target_width = 0;
|
||||||
// all flags available
|
// all flags available
|
||||||
int ascii_image_flag = 0,
|
int ascii_image_flag = 0,
|
||||||
|
screen_width = 0,
|
||||||
|
screen_height = 0,
|
||||||
show_user_info = 1,
|
show_user_info = 1,
|
||||||
show_os = 1,
|
show_os = 1,
|
||||||
show_kernel = 1,
|
show_kernel = 1,
|
||||||
show_cpu = 1,
|
show_cpu = 1,
|
||||||
show_gpu = 1,
|
show_gpu = 1,
|
||||||
show_ram = 1,
|
show_ram = 1,
|
||||||
|
show_resolution = 1,
|
||||||
show_shell = 1,
|
show_shell = 1,
|
||||||
show_pkgs = 1,
|
show_pkgs = 1,
|
||||||
show_uptime = 1,
|
show_uptime = 1,
|
||||||
|
@ -184,6 +187,8 @@ void parse_config()
|
||||||
show_gpu = 0;
|
show_gpu = 0;
|
||||||
if (sscanf(line, "noram%s", temp_buffer))
|
if (sscanf(line, "noram%s", temp_buffer))
|
||||||
show_ram = 0;
|
show_ram = 0;
|
||||||
|
if (sscanf(line, "noresolution%s", temp_buffer))
|
||||||
|
show_resolution = 0;
|
||||||
if (sscanf(line, "noshell%s", temp_buffer))
|
if (sscanf(line, "noshell%s", temp_buffer))
|
||||||
show_shell = 0;
|
show_shell = 0;
|
||||||
if (sscanf(line, "nopkgs%s", temp_buffer))
|
if (sscanf(line, "nopkgs%s", temp_buffer))
|
||||||
|
@ -255,11 +260,11 @@ void print_info()
|
||||||
if (show_user_info)
|
if (show_user_info)
|
||||||
printf("\033[18C%s%s%s@%s\n", NORMAL, BOLD, user, host);
|
printf("\033[18C%s%s%s@%s\n", NORMAL, BOLD, user, host);
|
||||||
if (show_os)
|
if (show_os)
|
||||||
printf("\033[18C%s%sOWOS %s%s\n", NORMAL, BOLD, NORMAL, version_name);
|
printf("\033[18C%s%sOWOS %s%s\n", NORMAL, BOLD, NORMAL, version_name);
|
||||||
if (show_kernel)
|
if (show_kernel)
|
||||||
printf("\033[18C%s%sKEWNEL %s%s\n", NORMAL, BOLD, NORMAL, kernel);
|
printf("\033[18C%s%sKEWNEL %s%s\n", NORMAL, BOLD, NORMAL, kernel);
|
||||||
if (show_cpu)
|
if (show_cpu)
|
||||||
printf("\033[18C%s%sCPUWU %s%s\n", NORMAL, BOLD, NORMAL, cpu_model);
|
printf("\033[18C%s%sCPUWU %s%s\n", NORMAL, BOLD, NORMAL, cpu_model);
|
||||||
|
|
||||||
// print the gpus
|
// print the gpus
|
||||||
if (show_gpu)
|
if (show_gpu)
|
||||||
|
@ -267,7 +272,7 @@ void print_info()
|
||||||
int gpu_iter = 0;
|
int gpu_iter = 0;
|
||||||
while (gpu_model[gpu_iter][0] != '0')
|
while (gpu_model[gpu_iter][0] != '0')
|
||||||
{
|
{
|
||||||
printf("\033[18C%s%sGPUWU %s%s\n",
|
printf("\033[18C%s%sGPUWU %s%s\n",
|
||||||
NORMAL, BOLD, NORMAL, gpu_model[gpu_iter]);
|
NORMAL, BOLD, NORMAL, gpu_model[gpu_iter]);
|
||||||
gpu_iter++;
|
gpu_iter++;
|
||||||
}
|
}
|
||||||
|
@ -275,21 +280,28 @@ void print_info()
|
||||||
|
|
||||||
// print ram to uptime and colors
|
// print ram to uptime and colors
|
||||||
if (show_ram)
|
if (show_ram)
|
||||||
printf("\033[18C%s%sWAM %s%i MB/%i MB\n",
|
printf("\033[18C%s%sWAM %s%i MB/%i MB\n",
|
||||||
NORMAL, BOLD, NORMAL, (ram_used), ram_total);
|
NORMAL, BOLD, NORMAL, (ram_used), ram_total);
|
||||||
|
if (show_resolution)
|
||||||
|
printf("\033[18C%s%sRESOLUTION%s %dx%d\n",
|
||||||
|
NORMAL, BOLD, NORMAL, screen_width, screen_height);
|
||||||
if (show_shell)
|
if (show_shell)
|
||||||
printf("\033[18C%s%sSHELL %s%s\n",
|
printf("\033[18C%s%sSHELL %s%s\n",
|
||||||
NORMAL, BOLD, NORMAL, shell);
|
NORMAL, BOLD, NORMAL, shell);
|
||||||
if (show_pkgs)
|
if (show_pkgs)
|
||||||
printf("\033[18C%s%sPKGS %s%s%d %s\n",
|
printf("\033[18C%s%sPKGS %s%s%d %s\n",
|
||||||
NORMAL, BOLD, NORMAL, NORMAL, pkgs, pkgman_name);
|
NORMAL, BOLD, NORMAL, NORMAL, pkgs, pkgman_name);
|
||||||
if (show_uptime)
|
if (show_uptime)
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
printf("\033[18C%s%sUWUPTIME %s" /*"%lid, "*/ "%lih, %lim\n",
|
printf("\033[18C%s%sUWUPTIME %s" /*"%lid, "*/ "%lih, %lim\n",
|
||||||
NORMAL, BOLD, NORMAL, /*sys.uptime/60/60/24,*/ sys.uptime / 60 / 60, sys.uptime / 60 % 60);
|
NORMAL, BOLD, NORMAL, /*sys.uptime/60/60/24,*/ sys.uptime / 60 / 60, sys.uptime / 60 % 60);
|
||||||
#else
|
#else
|
||||||
printf("\033[18C%s%sUWUPTIME %s" "%ih, %im\n",
|
if(sys.uptime/3600 < 24)
|
||||||
NORMAL, BOLD, NORMAL, (uptime_mac() / 3600), ((uptime_mac() - (3600 * (uptime_mac() / 3600))) / 60));
|
printf("\033[18C%s%sUWUPTIME %s%lih, %lim\n",
|
||||||
|
NORMAL, BOLD, NORMAL, sys.uptime/3600, sys.uptime/60%60);
|
||||||
|
else
|
||||||
|
printf("\033[18C%s%sUWUPTIME %s%lid, %lih, %lim\n",
|
||||||
|
NORMAL, BOLD, NORMAL, sys.uptime/86400, sys.uptime/3600%24, sys.uptime/60%60);
|
||||||
#endif
|
#endif
|
||||||
if (show_colors)
|
if (show_colors)
|
||||||
printf("\033[18C%s%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\n",
|
printf("\033[18C%s%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\u2587\u2587%s\n",
|
||||||
|
@ -302,7 +314,7 @@ void get_info()
|
||||||
|
|
||||||
// terminal width used to truncate long names
|
// terminal width used to truncate long names
|
||||||
ioctl(STDOUT_FILENO, TIOCGWINSZ, &win);
|
ioctl(STDOUT_FILENO, TIOCGWINSZ, &win);
|
||||||
target_width = win.ws_col - 28;
|
target_width = win.ws_col - 30;
|
||||||
|
|
||||||
// os version
|
// os version
|
||||||
FILE *os_release = fopen("/etc/os-release", "r");
|
FILE *os_release = fopen("/etc/os-release", "r");
|
||||||
|
@ -359,7 +371,7 @@ void get_info()
|
||||||
|
|
||||||
// system resources
|
// system resources
|
||||||
uname(&sys_var);
|
uname(&sys_var);
|
||||||
//sysinfo(&sys); // somehow this function has to be called again in print_info()
|
sysinfo(&sys); // somehow this function has to be called again in print_info()
|
||||||
|
|
||||||
truncate_name(sys_var.release);
|
truncate_name(sys_var.release);
|
||||||
sprintf(kernel, "%s %s %s", sys_var.sysname, sys_var.release, sys_var.machine);
|
sprintf(kernel, "%s %s %s", sys_var.sysname, sys_var.release, sys_var.machine);
|
||||||
|
@ -453,6 +465,14 @@ void get_info()
|
||||||
truncate_name(gpu_model[i]);
|
truncate_name(gpu_model[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resolution
|
||||||
|
FILE *resolution = popen("xwininfo -root 2> /dev/null | grep -E 'Width|Height'", "r");
|
||||||
|
while (fgets(line, sizeof(line), resolution))
|
||||||
|
{
|
||||||
|
sscanf(line, " Width: %d", &screen_width);
|
||||||
|
sscanf(line, " Height: %d", &screen_height);
|
||||||
|
}
|
||||||
|
|
||||||
// package count
|
// package count
|
||||||
pkgs = pkgman();
|
pkgs = pkgman();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue