Skip to content

Commit

Permalink
ncneofetch: default background on palette
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Jul 1, 2020
1 parent 5f3e1b8 commit 238ba10
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions src/fetch/main.c
Expand Up @@ -257,7 +257,7 @@ drawpalette(struct ncdirect* nc){
return -1;
}
}
if(ncdirect_bg_palindex(nc, 0)){
if(ncdirect_bg_default(nc)){
return -1;
}
if(putchar('\n') == EOF){
Expand All @@ -267,29 +267,28 @@ drawpalette(struct ncdirect* nc){
return 0;
}

static int
/*static int
infoplane(struct ncdirect* nc, const fetched_info* fi){
// FIXME look for an area without background logo in it. pick the one
// closest to the center horizontally, and lowest vertically. if none
// can be found, just center it on the bottom as we do now
const int dimy = ncdirect_dim_y(nc);
const int planeheight = 8;
const int planewidth = 60;
const int infox = (ncdirect_dim_x(nc) - planewidth) / 2;
if(infox < 0){
return -1;
}
printf("\n");
ncdirect_fg_rgb(nc, 0xd0, 0xd0, 0xd0);
ncdirect_bg_rgb(nc, 0x50, 0x50, 0x50);
ncdirect_styles_set(nc, NCSTYLE_UNDERLINE);
if(ncdirect_cursor_move_yx(nc, -1, infox) < 0){
return -1;
}
int r = printf(" %s %s", fi->kernel, fi->kernver);
if(r < 0){
struct ncplane* infop = ncplane_aligned(notcurses_stdplane(nc),
planeheight, planewidth,
dimy - (planeheight + 1),
NCALIGN_CENTER, NULL);
if(infop == NULL){
return -1;
}
ncplane_set_fg_rgb(infop, 0xd0, 0xd0, 0xd0);
ncplane_set_attr(infop, NCSTYLE_UNDERLINE);
ncplane_printf_aligned(infop, 1, NCALIGN_LEFT, " %s %s", fi->kernel, fi->kernver);
if(fi->distro_pretty){
printf("%*s ", planewidth - r, fi->distro_pretty);
ncplane_printf_aligned(infop, 1, NCALIGN_RIGHT, "%s ", fi->distro_pretty);
}
ncdirect_styles_set(nc, NCSTYLE_NONE);
/*
ncplane_set_attr(infop, NCSTYLE_NONE);
#ifdef __linux__
struct sysinfo sinfo;
sysinfo(&sinfo);
Expand Down Expand Up @@ -350,14 +349,11 @@ infoplane(struct ncdirect* nc, const fetched_info* fi){
fi->username, fi->hostname) < 0){
return -1;
}
*/
ncdirect_fg_default(nc);
ncdirect_bg_default(nc);
if(printf("\n") < 0){
return -1;
}
channels_set_fg_rgb(&channels, 0, 0, 0);
channels_set_bg_rgb(&channels, 0x50, 0x50, 0x50);
ncplane_set_base(infop, " ", 0, channels);
return 0;
}
}*/

struct marshal {
struct ncdirect* nc;
Expand Down Expand Up @@ -413,9 +409,12 @@ ncneofetch(struct ncdirect* nc){
fetch_x_props(&fi);
fetch_cpu_info(&fi);
sem_wait(&display_marshal.sem);
if(infoplane(nc, &fi)){
/*if(infoplane(nc, &fi)){
return -1;
}
if(notcurses_render(nc)){
return -1;
}*/
return 0;
}

Expand Down

0 comments on commit 238ba10

Please sign in to comment.