diff options
| author | Federico Angelilli <code@fedang.net> | 2024-02-08 12:40:56 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-02-08 12:40:56 +0100 |
| commit | a81b8b36afad38e93ab2051e26d21d6125a46eca (patch) | |
| tree | cfa3ff11138783f7a85c6658a3f3284269e9a366 /src/dwm.c | |
| parent | 09505cb480274bdc154c1b4ae3dd6988e56b4368 (diff) | |
Add dwm tags
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); |
