all repos — tint2 @ 89c02d39129e0806705b9ca81ba3c414288a2889

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

use simpler battery blink method
Chris Lee @klee93
commit

89c02d39129e0806705b9ca81ba3c414288a2889

parent

da7599983227facf8538932c86d2df986a3765e0

1 files changed, 6 insertions(+), 25 deletions(-)

jump to
M src/battery/battery.csrc/battery/battery.c

@@ -63,7 +63,6 @@ char *battery_dwheel_command;

gboolean battery_found; gboolean battery_warn; gboolean battery_warn_red; -Background *battery_warn_bg; char *battery_sys_prefix = (char *)"";

@@ -84,7 +83,6 @@ INIT_TIMER(battery_timer);

INIT_TIMER(battery_blink_timer); battery_warn = FALSE; battery_warn_red = FALSE; - battery_warn_bg = NULL; bat1_has_font = FALSE; bat1_font_desc = NULL; bat1_format = NULL;

@@ -138,7 +136,6 @@ ac_disconnected_cmd = NULL;

destroy_timer(&battery_timer); destroy_timer(&battery_blink_timer); battery_found = FALSE; - free_and_null(battery_warn_bg); battery_os_free(); }

@@ -330,30 +327,8 @@ {

if (!battery_enabled) return; battery_warn_red = battery_warn ? !battery_warn_red : FALSE; - if (battery_warn_red && !battery_warn_bg) { - battery_warn_bg = calloc(1, sizeof(*battery_warn_bg)); - *battery_warn_bg = *panel_config.battery.area.bg; - battery_warn_bg->fill_color.alpha = 1.0; - battery_warn_bg->border.color.alpha = 1.0; - } - if (battery_warn_red) { - battery_warn_bg->fill_color.rgb[0] = 0.6; - battery_warn_bg->fill_color.rgb[1] = 0.1; - battery_warn_bg->fill_color.rgb[2] = 0.1; - battery_warn_bg->border.color.rgb[0] = 0.5; - battery_warn_bg->border.color.rgb[1] = 0.0; - battery_warn_bg->border.color.rgb[2] = 0.0; - } else { - battery_warn_bg->fill_color.rgb[0] = 0.9; - battery_warn_bg->fill_color.rgb[1] = 0.7; - battery_warn_bg->fill_color.rgb[2] = 0.1; - battery_warn_bg->border.color.rgb[0] = 0.7; - battery_warn_bg->border.color.rgb[1] = 0.5; - battery_warn_bg->border.color.rgb[2] = 0.1; - } for (int i = 0; i < num_panels; i++) { if (panels[i].battery.area.on_screen) { - panels[i].battery.area.bg = battery_warn_bg; schedule_redraw(&panels[i].battery.area); } }

@@ -490,6 +465,12 @@ void draw_battery(void *obj, cairo_t *c)

{ Battery *battery = (Battery *)obj; Panel *panel = (Panel *)battery->area.panel; + if (battery_warn && battery_warn_red) { + cairo_set_source_rgb(c, 0.7, 0.3, 0); + cairo_set_line_width(c, 0); + cairo_rectangle(c, 0, 0, battery->area.width, battery->area.height); + cairo_fill(c); + } draw_text_area(&battery->area, c, buf_bat_line1,