From a81b8b36afad38e93ab2051e26d21d6125a46eca Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Thu, 8 Feb 2024 12:40:56 +0100 Subject: Add dwm tags --- src/comet.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/comet.c') diff --git a/src/comet.c b/src/comet.c index 825cb25..586245f 100644 --- a/src/comet.c +++ b/src/comet.c @@ -222,16 +222,6 @@ static void menu_action(Button *btn) static void register_buttons(State *state, Color color, Color line_color, Color text_color) { - // Tags button - // TODO: They don't do anything now... - for (int i = 0; i < 9; ++i) { - char text[] = { '1' + i, '\0' }; - Button *btn = button_simple_create(PANGO_ALIGN_LEFT, color, line_color); - button_simple_set_text(btn, g_strdup(text), text_color); - button_simple_set_action(btn, show_action, NULL); - state_add_button(state, btn); - } - // Cpu usage button Button *cpu_btn = button_simple_create(PANGO_ALIGN_RIGHT, color, line_color); button_simple_set_text(cpu_btn, g_strdup(" 0%"), text_color); @@ -296,8 +286,17 @@ int main(int argc, char **argv) State *state = state_create(win, draw); 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 text_color = { 0.9, 0.9, 0.9, 1 }; + + // Dwm tags + DwmIpc *dwm = dwm_create(state, "/tmp/dwm.sock"); + + // FIXME: BUG! Explodes if the buttons are not loaded with the left first!!! + // And I have no clue as to why!!!!! + dwm_register_tags(dwm, color, purple, text_color, line_color); + register_buttons(state, color, line_color, text_color); // Buttons with special handling @@ -321,7 +320,6 @@ int main(int argc, char **argv) date_update(date_btn); // Quit button - Color purple = { 0.502, 0.168, 0.886, 1 }; Button *q_btn = button_simple_create(PANGO_ALIGN_RIGHT, purple, line_color); button_simple_set_text(q_btn, g_strdup(""), text_color); button_simple_set_action(q_btn, quit_action, mainloop); @@ -365,8 +363,6 @@ int main(int argc, char **argv) button_group_append(group, menu); state_add_button(state, group); - DwmIpc *dwm = dwm_create(state, "/tmp/dwm.sock"); - connect_attach_state(con, state); connect_attach_source(con); -- cgit v1.2.3