fixed bugs and added distros
このコミットが含まれているのは:
コミット
d02a6323bb
24
config.h
24
config.h
|
@ -1,9 +1,24 @@
|
|||
#include "logos/arch.h"
|
||||
#define COLOR "\e[1;36m"
|
||||
//define colors
|
||||
#define BLACK "\e[1;30m"
|
||||
#define RED "\e[1;31m"
|
||||
#define GREEN "\e[1;32m"
|
||||
#define YELLOW "\e[1;33m"
|
||||
#define BLUE "\e[1;34m"
|
||||
#define PURPLE "\e[1;35m"
|
||||
#define CYAN "\e[1;36m"
|
||||
#define WHITE "\e[1;37m"
|
||||
|
||||
|
||||
//define display colors
|
||||
#define COLOR BLUE
|
||||
#define LOGOCOLOR CYAN
|
||||
#define TITLECOLOR BLUE
|
||||
|
||||
#define CONFIG \
|
||||
{ \
|
||||
/* name function cached */\
|
||||
SPACER \
|
||||
{ "", get_title, false }, \
|
||||
{ "", get_bar, false }, \
|
||||
{ "OS: ", get_os, true }, \
|
||||
|
@ -11,14 +26,12 @@
|
|||
{ "Kernel: ", get_kernel, true }, \
|
||||
{ "Uptime: ", get_uptime, false }, \
|
||||
{ "Battery: ", get_battery_percentage, false }, \
|
||||
SPACER \
|
||||
{ "Packages: ", get_packages_pacman, false }, \
|
||||
{ "Shell: ", get_shell, false }, \
|
||||
{ "Resolution: ", get_resolution, false }, \
|
||||
{ "Terminal: ", get_terminal, false }, \
|
||||
SPACER \
|
||||
{ "CPU: ", get_cpu, true }, \
|
||||
{ "GPU: ", get_gpu1, true }, \
|
||||
{ "GPU: ", get_gpu1, true }, \
|
||||
{ "Memory: ", get_memory, false }, \
|
||||
SPACER \
|
||||
{ "", get_colors1, false }, \
|
||||
|
@ -40,4 +53,7 @@
|
|||
#define GPU_CONFIG \
|
||||
{ \
|
||||
REMOVE("Corporation"), \
|
||||
REMOVE("Controller"), \
|
||||
REMOVE("Graphics"), \
|
||||
REMOVE("Integrated"), \
|
||||
}
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
// And this was stolen from archey3
|
||||
char *LOGO[] = {
|
||||
" + ",
|
||||
" # ",
|
||||
" ### ",
|
||||
" ##### ",
|
||||
" ###### ",
|
||||
" ; #####; ",
|
||||
" +##.##### ",
|
||||
" +########## ",
|
||||
" #############; ",
|
||||
" ###############+ ",
|
||||
" ####### ####### ",
|
||||
" .######; ;###;`'. ",
|
||||
" .#######; ;#####. ",
|
||||
" #########. .########` ",
|
||||
" ######' '###### ",
|
||||
" ;#### ####; ",
|
||||
" ##' '## ",
|
||||
"#' `# "
|
||||
};
|
|
@ -1,22 +0,0 @@
|
|||
// made by Reddit user LnLcFlx2
|
||||
char *LOGO[] = {
|
||||
" ▄ ",
|
||||
" ▟█▙ ",
|
||||
" ▟███▙ ",
|
||||
" ▟█████▙ ",
|
||||
" ▟███████▙ ",
|
||||
" ▂▔▀▜██████▙ ",
|
||||
" ▟██▅▂▝▜█████▙ ",
|
||||
" ▟█████████████▙ ",
|
||||
" ▟███████████████▙ ",
|
||||
" ▟█████████████████▙ ",
|
||||
" ▟███████████████████▙ ",
|
||||
" ▟█████████▛▀▀▜████████▙ ",
|
||||
" ▟████████▛ ▜███████▙ ",
|
||||
" ▟█████████ ████████▙ ",
|
||||
" ▟██████████ █████▆▅▄▃▂ ",
|
||||
" ▟██████████▛ ▜█████████▙ ",
|
||||
" ▟██████▀▀▀ ▀▀██████▙ ",
|
||||
" ▟███▀▘ ▝▀███▙ ",
|
||||
" ▟▛▀ ▀▜▙ "
|
||||
};
|
|
@ -0,0 +1,23 @@
|
|||
// This was stolen from neofetch
|
||||
char *LOGO[] = {
|
||||
" ' ",
|
||||
" 'o' ",
|
||||
" 'ooo' ",
|
||||
" 'ooxoo' ",
|
||||
" 'ooxxxoo' ",
|
||||
" 'oookkxxoo' ",
|
||||
" 'oiioxkkxxoo' ",
|
||||
" ':;:iiiioxxxoo' ",
|
||||
" `'.;::ioxxoo' ",
|
||||
" '-. `':;jiooo' ",
|
||||
" 'oooio-.. `'i:io' ",
|
||||
" 'ooooxxxxoio:,. `'-;' ",
|
||||
" 'ooooxxxxxkkxoooIi:-. `' ",
|
||||
" 'ooooxxxxxkkkkxoiiiiiji' ",
|
||||
" 'ooooxxxxxkxxoiiii:'` .i' ",
|
||||
" 'ooooxxxxxoi:::'` .;ioxo' ",
|
||||
" 'ooooxooi::'` .:iiixkxxo' ",
|
||||
" 'ooooi:'` `'';ioxxo' ",
|
||||
" 'i:'` '':io' ",
|
||||
"'` `' "
|
||||
};
|
|
@ -0,0 +1,21 @@
|
|||
// This was stolen from neofetch
|
||||
char *LOGO[] = {
|
||||
" _,met$$$$$gg. ",
|
||||
" ,g$$$$$$$$$$$$$$$P. ",
|
||||
" ,g$$P\" \"\"\"Y$$.\". ",
|
||||
" ,$$P' `$$$. ",
|
||||
"',$$P ,ggs. `$$b: ",
|
||||
"`d$$' ,$P\"' . $$$ ",
|
||||
" $$P d$' , $$P ",
|
||||
" $$: $$. - ,d$$' ",
|
||||
" $$; Y$b._ _,d$P' ",
|
||||
" Y$$. `.`\"Y$$$$P\"' ",
|
||||
" `$$b \"-.__ ",
|
||||
" `Y$$ ",
|
||||
" `Y$$. ",
|
||||
" `$$b. ",
|
||||
" `Y$$b. ",
|
||||
" `\"Y$b._ ",
|
||||
" `\"\"\" "
|
||||
};
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
// This was stolen from neofetch
|
||||
char *LOGO[] = {
|
||||
" /:-------------:\\\\ ",
|
||||
" :-------------------:: ",
|
||||
" :-----------/shhOHbmp---:\\\\ ",
|
||||
" /-----------omMMMNNNMMD ---: ",
|
||||
" :-----------sMMMMNMNMP. ---: ",
|
||||
" :-----------:MMMdP------- ---\\\\ ",
|
||||
",------------:MMMd-------- ---: ",
|
||||
":------------:MMMd------- .---: ",
|
||||
":---- oNMMMMMMMMMNho .----: ",
|
||||
":-- .+shhhMMMmhhy++ .------/ ",
|
||||
":- -------:MMMd--------------: ",
|
||||
":- --------/MMMd-------------; ",
|
||||
":- ------/hMMMy------------: ",
|
||||
":-- :dMNdhhdNMMNo------------; ",
|
||||
":---:sdNMMMMNds:------------: ",
|
||||
":------:://:-------------:: ",
|
||||
":---------------------:// "
|
||||
};
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
// This was stolen from neofetch
|
||||
char *LOGO[] = {
|
||||
"██████████████████ ████████ ",
|
||||
"██████████████████ ████████ ",
|
||||
"██████████████████ ████████ ",
|
||||
"██████████████████ ████████ ",
|
||||
"████████ ████████ ",
|
||||
"████████ ████████ ████████ ",
|
||||
"████████ ████████ ████████ ",
|
||||
"████████ ████████ ████████ ",
|
||||
"████████ ████████ ████████ ",
|
||||
"████████ ████████ ████████ ",
|
||||
"████████ ████████ ████████ ",
|
||||
"████████ ████████ ████████ ",
|
||||
"████████ ████████ ████████ ",
|
||||
"████████ ████████ ████████ "
|
||||
};
|
|
@ -0,0 +1,22 @@
|
|||
// This was stolen from neofetch
|
||||
char *LOGO[] = {
|
||||
" ./+o+- ",
|
||||
" yyyyy- -yyyyyy+ ",
|
||||
" ://+//////-yyyyyyo ",
|
||||
" .++ .:/++++++/-.+sss/` ",
|
||||
" .:++o: /++++++++/:--:/- ",
|
||||
" o:+o+:++.`..```.-/oo+++++/ ",
|
||||
" .:+o:+o/. `+sssoo+/ ",
|
||||
" .++/+:+oo+o:` /sssooo. ",
|
||||
"/+++//+:`oo+o /::--:. ",
|
||||
"+/+o+++`o++o ++////. ",
|
||||
" .++.o+++oo+:` /dddhhh. ",
|
||||
" .+.o+oo:. `oddhhhh+ ",
|
||||
" +.++o+o``-````.:ohdhhhhh+ ",
|
||||
" `:o+++ `ohhhhhhhhyo++os: ",
|
||||
" .o:`.syhhhhhhh/.oo++o` ",
|
||||
" /osyyyyyyo++ooo+++/ ",
|
||||
" ````` +oo+++o: ",
|
||||
" `oo++. "
|
||||
};
|
||||
|
22
paleofetch.c
22
paleofetch.c
|
@ -135,7 +135,7 @@ static char *get_title() {
|
|||
title_length = strlen(hostname) + strlen(username) + 1;
|
||||
|
||||
char *title = malloc(BUF_SIZE);
|
||||
snprintf(title, BUF_SIZE, COLOR"%s\e[0m@"COLOR"%s", username, hostname);
|
||||
snprintf(title, BUF_SIZE, TITLECOLOR"%s\e[0m@"TITLECOLOR"%s", username, hostname);
|
||||
|
||||
return title;
|
||||
}
|
||||
|
@ -298,9 +298,9 @@ static char *get_shell() {
|
|||
char *shell_name = strrchr(getenv("SHELL"), '/');
|
||||
|
||||
if(shell_name == NULL) /* if $SHELL doesn't have a '/' */
|
||||
strncpy(shell, shell_path, BUF_SIZE); /* copy the whole thing over */
|
||||
strncpy(shell, shell_path, BUF_SIZE - 1); /* copy the whole thing over */
|
||||
else
|
||||
strncpy(shell, shell_name + 1, BUF_SIZE); /* o/w copy past the last '/' */
|
||||
strncpy(shell, shell_name + 1, BUF_SIZE - 1); /* o/w copy past the last '/' */
|
||||
|
||||
return shell;
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ static char *get_resolution() {
|
|||
modes = fopen(modes_file_name, "r");
|
||||
if (modes != NULL) {
|
||||
if (getline(&line, &len, modes) != -1) {
|
||||
strncpy(resolution, line, BUF_SIZE);
|
||||
strncpy(resolution, line, BUF_SIZE - 1);
|
||||
remove_newline(resolution);
|
||||
|
||||
free(line);
|
||||
|
@ -389,10 +389,10 @@ static char *get_terminal() {
|
|||
free(prop);
|
||||
} else {
|
||||
terminal_fallback:
|
||||
strncpy(terminal, getenv("TERM"), BUF_SIZE); /* fallback to old method */
|
||||
strncpy(terminal, getenv("TERM"), BUF_SIZE - 1); /* fallback to old method */
|
||||
/* in tty, $TERM is simply returned as "linux"; in this case get actual tty name */
|
||||
if (strcmp(terminal, "linux") == 0) {
|
||||
strncpy(terminal, ttyname(STDIN_FILENO), BUF_SIZE);
|
||||
strncpy(terminal, ttyname(STDIN_FILENO), BUF_SIZE - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -500,10 +500,10 @@ static char *find_gpu(int index) {
|
|||
dev = pacc->devices;
|
||||
|
||||
while(dev != NULL) {
|
||||
pci_fill_info(dev, PCI_FILL_IDENT);
|
||||
pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_CLASS);
|
||||
device_class = pci_lookup_name(pacc, buffer, sizeof(buffer), PCI_LOOKUP_CLASS, dev->device_class);
|
||||
if(strcmp("VGA compatible controller", device_class) == 0 || strcmp("3D controller", device_class) == 0) {
|
||||
strncpy(gpu, pci_lookup_name(pacc, buffer, sizeof(buffer), PCI_LOOKUP_DEVICE | PCI_LOOKUP_VENDOR, dev->vendor_id, dev->device_id), BUF_SIZE);
|
||||
strncpy(gpu, pci_lookup_name(pacc, buffer, sizeof(buffer), PCI_LOOKUP_DEVICE | PCI_LOOKUP_VENDOR, dev->vendor_id, dev->device_id), BUF_SIZE - 1);
|
||||
if(gpu_index == index) {
|
||||
found = true;
|
||||
break;
|
||||
|
@ -717,13 +717,13 @@ int main(int argc, char *argv[]) {
|
|||
for (int i = 0; i < COUNT(LOGO); i++) {
|
||||
// If we've run out of information to show...
|
||||
if(i >= COUNT(config) - offset) // just print the next line of the logo
|
||||
printf(COLOR"%s\n", LOGO[i]);
|
||||
printf(LOGOCOLOR"%s\n", LOGO[i]);
|
||||
else {
|
||||
// Otherwise, we've got a bit of work to do.
|
||||
char *label = config[i+offset].label,
|
||||
*value = get_value(config[i+offset], read_cache, cache_data);
|
||||
if (strcmp(value, "") != 0) { // check if value is an empty string
|
||||
printf(COLOR"%s%s\e[0m%s\n", LOGO[i], label, value); // just print if not empty
|
||||
printf(LOGOCOLOR"%s"COLOR"%s\e[0m%s\n", LOGO[i], label, value); // just print if not empty
|
||||
} else {
|
||||
if (strcmp(label, "") != 0) { // check if label is empty, otherwise it's a spacer
|
||||
++offset; // print next line of information
|
||||
|
@ -731,7 +731,7 @@ int main(int argc, char *argv[]) {
|
|||
label = config[i+offset].label; // read new label and value
|
||||
value = get_value(config[i+offset], read_cache, cache_data);
|
||||
}
|
||||
printf(COLOR"%s%s\e[0m%s\n", LOGO[i], label, value);
|
||||
printf(LOGOCOLOR"%s"COLOR"%s\e[0m%s\n", LOGO[i], label, value);
|
||||
}
|
||||
free(value);
|
||||
|
||||
|
|
新しいイシューから参照