From 7f88db5f34c37c804a7bb69fccb2c7dee86dfe98 Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Fri, 15 Mar 2024 21:05:52 +0100 Subject: Fix button border drawing --- src/comet.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/comet.c') diff --git a/src/comet.c b/src/comet.c index 617fcb5..5bcd9ac 100644 --- a/src/comet.c +++ b/src/comet.c @@ -220,12 +220,13 @@ static void menu_action(Button *btn) state_request_redraw(menu_ctx->state, true); } -static void register_buttons(State *state, Color color, Color text_color) +static void register_buttons(State *state, Color color, Color text_color, Color line_color, int line_w) { // Cpu usage button Button *cpu_btn = button_simple_create(PANGO_ALIGN_RIGHT, color); button_simple_set_text(cpu_btn, g_strdup(" 0%"), text_color); button_simple_set_action(cpu_btn, show_action, state); + button_set_line(cpu_btn, line_color, line_w); state_add_button(state, cpu_btn); cpu_update(cpu_btn); @@ -235,6 +236,7 @@ static void register_buttons(State *state, Color color, Color text_color) Button *temp_btn = button_simple_create(PANGO_ALIGN_RIGHT, color); button_simple_set_text(temp_btn, g_strdup("temp"), text_color); button_simple_set_action(temp_btn, show_action, state); + button_set_line(temp_btn, line_color, line_w); state_add_button(state, temp_btn); temp_update(temp_btn); @@ -244,6 +246,7 @@ static void register_buttons(State *state, Color color, Color text_color) Button *ram_btn = button_simple_create(PANGO_ALIGN_RIGHT, color); button_simple_set_text(ram_btn, g_strdup("ram"), text_color); button_simple_set_action(ram_btn, show_action, state); + button_set_line(ram_btn, line_color, line_w); state_add_button(state, ram_btn); ram_update(ram_btn); @@ -253,6 +256,7 @@ static void register_buttons(State *state, Color color, Color text_color) Button *disk_btn = button_simple_create(PANGO_ALIGN_RIGHT, color); button_simple_set_text(disk_btn, g_strdup("disk"), text_color); button_simple_set_action(disk_btn, show_action, state); + button_set_line(disk_btn, line_color, line_w); state_add_button(state, disk_btn); disk_update(disk_btn); @@ -287,14 +291,15 @@ int main(int argc, char **argv) Color color = { 0.4, 0.4, 0.4, 1 }; Color purple = { 0.502, 0.168, 0.886, 1 }; - //Color line_color = { 0.8, 0.8, 0.8, 1 }; + Color line_color = { 0.8, 0.8, 0.8, 1 }; Color text_color = { 0.9, 0.9, 0.9, 1 }; // Dwm tags DwmIpc *dwm = dwm_create(state, "/tmp/dwm.sock"); dwm_register_tags(dwm, color, purple, text_color); - register_buttons(state, color, text_color); + int line_w = 0; + register_buttons(state, color, text_color, line_color, line_w); // Buttons with special handling -- cgit v1.2.3