Merge branch 'master' into enhancement/fix/powerline_position

This commit is contained in:
Calum MacRae 2020-07-08 21:08:58 +01:00 committed by GitHub
commit 85547b5ea0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 51 deletions

View file

@ -285,7 +285,6 @@ void bar_refresh(struct bar *bar)
if (has_batt) { if (has_batt) {
char batt[255]; char batt[255];
snprintf(batt, sizeof(batt), "%' '3d%%", percent); snprintf(batt, sizeof(batt), "%' '3d%%", percent);
struct bar_line batt_line = bar_prepare_line(g_bar_manager.t_font, batt, g_bar_manager.foreground_color); struct bar_line batt_line = bar_prepare_line(g_bar_manager.t_font, batt, g_bar_manager.foreground_color);
CGPoint p_pos = bar_align_line(bar, batt_line, ALIGN_RIGHT, ALIGN_CENTER); CGPoint p_pos = bar_align_line(bar, batt_line, ALIGN_RIGHT, ALIGN_CENTER);
p_pos.x = time_line_pos - 40; p_pos.x = time_line_pos - 40;

View file

@ -28,18 +28,6 @@ void bar_manager_set_text_font(struct bar_manager *bar_manager, char *font_strin
CFRelease(bar_manager->t_font); CFRelease(bar_manager->t_font);
} }
if (bar_manager->space_underline.line) {
bar_destroy_line(bar_manager->space_underline);
}
if (bar_manager->power_underline.line) {
bar_destroy_line(bar_manager->power_underline);
}
if (bar_manager->clock_underline.line) {
bar_destroy_line(bar_manager->clock_underline);
}
if (font_string != bar_manager->t_font_prop) { if (font_string != bar_manager->t_font_prop) {
if (bar_manager->t_font_prop) { if (bar_manager->t_font_prop) {
free(bar_manager->t_font_prop); free(bar_manager->t_font_prop);
@ -49,25 +37,6 @@ void bar_manager_set_text_font(struct bar_manager *bar_manager, char *font_strin
} }
bar_manager->t_font = bar_create_font(bar_manager->t_font_prop); bar_manager->t_font = bar_create_font(bar_manager->t_font_prop);
bar_manager->space_underline = bar_prepare_line(bar_manager->t_font, "______", rgba_color_from_hex(0xffd4d232));
bar_manager->power_underline = bar_prepare_line(bar_manager->t_font, "__________", rgba_color_from_hex(0xffd75f5f));
time_t rawtime;
time(&rawtime);
struct tm *timeinfo = localtime(&rawtime);
if (timeinfo) {
char time[255];
strftime(time, sizeof(time), g_bar_manager._clock_format, timeinfo);
char underline[255] = {0};
for (int i = 0; i < strlen(time) + 4; ++i)
underline[i] = '_';
bar_manager->clock_underline = bar_prepare_line(bar_manager->t_font, underline, rgba_color_from_hex(0xff458588));
}
else
bar_manager->clock_underline = bar_prepare_line(bar_manager->t_font, "__________", rgba_color_from_hex(0xff458588));
bar_manager_refresh(bar_manager); bar_manager_refresh(bar_manager);
} }

View file

@ -23,9 +23,6 @@ struct bar_manager
struct bar_line clock_icon; struct bar_line clock_icon;
struct bar_line battr_icon; struct bar_line battr_icon;
struct bar_line power_icon; struct bar_line power_icon;
struct bar_line space_underline;
struct bar_line power_underline;
struct bar_line clock_underline;
}; };
void bar_manager_set_foreground_color(struct bar_manager *bar_manager, uint32_t color); void bar_manager_set_foreground_color(struct bar_manager *bar_manager, uint32_t color);