commit 1754f606f1ff831e677ee97c0607aab1cced3b8e
parent ee320e67be657d84b14befa0b79cb06fbf3d8f86
Author: sam-barr <samfbarr@outlook.com>
Date: Wed, 22 Apr 2020 21:03:23 -0500
have information float up rather than vertically center
I think this will be easier to configure, plus your addition
of spacer makes any vertical figuration feasible
Diffstat:
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/paleofetch.c b/paleofetch.c
@@ -26,6 +26,7 @@ struct conf {
{ "OS: ", get_os, true },
{ "Host: ", get_host, true },
{ "Kernel: ", get_kernel, true },
+ { "Uptime: ", get_uptime, false },
{ "", spacer, false },
{ "Packages: ", get_packages, false },
{ "Shell: ", get_shell, false },
@@ -519,23 +520,35 @@ int main(int argc, char *argv[]) {
#define COUNT(x) (int)(sizeof x / sizeof *x)
- // for vertically centering the data with the logo
- int offset = (COUNT(logo) - COUNT(config)) / 2;
-
- for (int i = 0; i < COUNT(logo); ++i) {
- // If we haven't started showing data (or we're done doing so)...
- if(i < offset || i >= offset + COUNT(config))
- puts(logo[i]); // just print the next line of the logo
+ for (int i = 0; i < COUNT(logo); i++) {
+ if(i >= COUNT(config))
+ puts(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);
+ char *label = config[i].label,
+ *value = get_value(config[i], read_cache, cache_data);
printf("%s%s\e[0m%s\n", logo[i], label, value);
free(value);
}
}
puts("\e[0m");
+ // for vertically centering the data with the logo
+ //int offset = (COUNT(logo) - COUNT(config)) / 2;
+
+ //for (int i = 0; i < COUNT(logo); ++i) {
+ // // If we haven't started showing data (or we're done doing so)...
+ // if(i < offset || i >= offset + COUNT(config))
+ // puts(logo[i]); // just print the next line of the logo
+ // 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);
+ // printf("%s%s\e[0m%s\n", logo[i], label, value);
+ // free(value);
+ // }
+ //}
+ //puts("\e[0m");
+
/* Write out our cache data (if we have any). */
if(!read_cache && *cache_data) {
cache_file = fopen(cache, "w");