diff options
Diffstat (limited to 'src/dwm.c')
| -rw-r--r-- | src/dwm.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -277,12 +277,27 @@ static void change_tag_action(Button *btn) { ButtonSimple *sbtn = CAST(btn, ButtonSimple); - g_assert(sbtn->text[0] >= 1 && sbtn->text[0] <= 9); int n = sbtn->text[0] - '0'; + g_assert(n >= 1 && n <= 9); log_debug("Toggled tag %d",n ); } +void dwm_register_tags(DwmIpc *dwm, Color color, Color selected, Color text_color, Color line_color) +{ + dwm->color = color; + dwm->selected = selected; + + // Tags button + for (int i = 0; i < 9; ++i) { + char text[] = { '1' + i, '\0' }; + dwm->tags[i] = button_simple_create(PANGO_ALIGN_LEFT, color, line_color); + button_simple_set_text(dwm->tags[i], g_strdup(text), text_color); + button_simple_set_action(dwm->tags[i], change_tag_action, dwm->state); + state_add_button(dwm->state, dwm->tags[i]); + } +} + void dwm_destroy(DwmIpc *dwm) { g_source_destroy((GSource *)dwm); |
